digitalmars.D.learn - HelloWordl in Webserver
- Xan (7/7) Mar 17 2012 I dont' want to battle among languages, but I see that in Golang
- Adam D. Ruppe (22/23) Mar 17 2012 It all depends on the library. If you use my code
- Xan (4/27) Mar 17 2012 So, there is not built-in functions?
- Kapps (3/6) Mar 17 2012 There's no built in webserver class, and it's not something that
- Xan (12/35) Apr 03 2012 I receive errors:
-
Xan
(10/21)
Apr 03 2012
It works when I change arsd.
to in import.But I - Timon Gehr (3/30) Apr 03 2012 You can just comment out the code there (afaik it is only a custom
- Adam D. Ruppe (8/10) Apr 03 2012 You're probably thinking of the std.date use in web.d.
- Xan (13/17) Apr 03 2012 $ gdmd-4.6 -d server.d cgi.d netman.d httpd.d
- Xan (13/13) Apr 03 2012 And with comment the UTC line I get:
- Adam D. Ruppe (6/7) Apr 03 2012 Use the newer standalone code:
- Adam D. Ruppe (7/8) Apr 03 2012 I changed some stuff since the beginning of thi thread.
- Xan (6/14) Apr 04 2012 Not, I receive the error:
- Adam D. Ruppe (6/7) Apr 04 2012 What version of D is that?
- Dmitry Olshansky (3/8) Apr 04 2012 --
- dennis luehring (7/16) Mar 17 2012 no its creates and simple webserver and displays your Hello world
I dont' want to battle among languages, but I see that in Golang there is a beatiful solution to display HelloWorld program in web server [rosettacode.org/wiki/Hello_world/Web_server#Go]. I'm convinced there is a D equivalent? Can someone say what's its aspect? Thanks in advance, Xan.
Mar 17 2012
On Saturday, 17 March 2012 at 20:08:24 UTC, Xan wrote:I'm convinced there is a D equivalent?It all depends on the library. If you use my code https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff It looks like this: == import arsd.cgi; void hello(Cgi cgi) { cgi.write("Hello, world!"); } mixin GenericMain!hello; == You can build that as a cgi app to drop into any web server, a FastCGI app to use a longer running process on almost any webserver, or a HTTP server, standalone. Get cgi.d from my github then Fast CGI C library from the internet (search for libfcgi) or get netman.d and httpd.d and standalone, only works on linux
Mar 17 2012
So, there is not built-in functions? Thanks, Xan. On Saturday, 17 March 2012 at 20:18:39 UTC, Adam D. Ruppe wrote:On Saturday, 17 March 2012 at 20:08:24 UTC, Xan wrote:I'm convinced there is a D equivalent?It all depends on the library. If you use my code https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff It looks like this: == import arsd.cgi; void hello(Cgi cgi) { cgi.write("Hello, world!"); } mixin GenericMain!hello; == You can build that as a cgi app to drop into any web server, a FastCGI app to use a longer running process on almost any webserver, or a HTTP server, standalone. Get cgi.d from my github then Fast CGI C library from the internet (search for libfcgi) or get netman.d and httpd.d and standalone, only works on linux
Mar 17 2012
On Saturday, 17 March 2012 at 20:52:33 UTC, Xan wrote:So, there is not built-in functions? Thanks, Xan.There's no built in webserver class, and it's not something that should be in the standard library in the first place.
Mar 17 2012
On Sunday, 18 March 2012 at 05:19:48 UTC, Kapps wrote:On Saturday, 17 March 2012 at 20:52:33 UTC, Xan wrote:A pain. A planning for that?So, there is not built-in functions? Thanks, Xan.There's no built in webserver class, and it's not something that should be in the standard library in the first place.
Mar 19 2012
Am 19.03.2012 20:36, schrieb Xan:On Sunday, 18 March 2012 at 05:19:48 UTC, Kapps wrote:Why is this a pain, I don't see the problem. You've got an awesome solution, just because it's not in Phobos? I don't understand why people hate to install (it's not even installing just downloading) libs.On Saturday, 17 March 2012 at 20:52:33 UTC, Xan wrote:A pain. A planning for that?So, there is not built-in functions? Thanks, Xan.There's no built in webserver class, and it's not something that should be in the standard library in the first place.
Apr 03 2012
On Sun, 18 Mar 2012 06:19:47 +0100, Kapps <opantm2+spam gmail.com> wrote:On Saturday, 17 March 2012 at 20:52:33 UTC, Xan wrote:I think phobos should include a simple http server for testing purposes.So, there is not built-in functions? Thanks, Xan.There's no built in webserver class, and it's not something that should be in the standard library in the first place.
Mar 19 2012
I receive errors: xan gerret:~/proves/dlang-proves$ ls cgi.d functions.d httpd.d netman.d server.d xan gerret:~/proves/dlang-proves$ gdmd-4.6 server.d cgi.d netman.d httpd.d httpd.d:5: Error: module netman is in file 'arsd/netman.d' which cannot be read import path[0] = /usr/include/d2/4.6/i686-linux-gnu import path[1] = /usr/include/d2/4.6 What fails? I use gdmd instead of dmd On Saturday, 17 March 2012 at 20:18:39 UTC, Adam D. Ruppe wrote:On Saturday, 17 March 2012 at 20:08:24 UTC, Xan wrote:I'm convinced there is a D equivalent?It all depends on the library. If you use my code https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff It looks like this: == import arsd.cgi; void hello(Cgi cgi) { cgi.write("Hello, world!"); } mixin GenericMain!hello; == You can build that as a cgi app to drop into any web server, a FastCGI app to use a longer running process on almost any webserver, or a HTTP server, standalone. Get cgi.d from my github then Fast CGI C library from the internet (search for libfcgi) or get netman.d and httpd.d and standalone, only works on linux
Apr 03 2012
On Tuesday, 3 April 2012 at 08:42:01 UTC, Xan wrote:I receive errors: xan gerret:~/proves/dlang-proves$ ls cgi.d functions.d httpd.d netman.d server.d xan gerret:~/proves/dlang-proves$ gdmd-4.6 server.d cgi.d netman.d httpd.d httpd.d:5: Error: module netman is in file 'arsd/netman.d' which cannot be read import path[0] = /usr/include/d2/4.6/i686-linux-gnu import path[1] = /usr/include/d2/4.6 What fails? I use gdmd instead of dmdIt works when I change arsd.<name> to <name> in import.But I receive several warnings: $ gdmd-4.6 server.d cgi.d netman.d httpd.d Notice: As of Phobos 2.055, std.date and std.dateparse have been deprecated. They will be removed in February 2012. Please use std.datetime instead. netman.d:428: Error: function std.date.getUTCtime is deprecated I suspect your code is too elder. Thanks,
Apr 03 2012
On 04/03/2012 10:45 AM, Xan wrote:On Tuesday, 3 April 2012 at 08:42:01 UTC, Xan wrote:You can just comment out the code there (afaik it is only a custom formatting routine), or compile with the -d flag.I receive errors: xan gerret:~/proves/dlang-proves$ ls cgi.d functions.d httpd.d netman.d server.d xan gerret:~/proves/dlang-proves$ gdmd-4.6 server.d cgi.d netman.d httpd.d httpd.d:5: Error: module netman is in file 'arsd/netman.d' which cannot be read import path[0] = /usr/include/d2/4.6/i686-linux-gnu import path[1] = /usr/include/d2/4.6 What fails? I use gdmd instead of dmdIt works when I change arsd.<name> to <name> in import.But I receive several warnings: $ gdmd-4.6 server.d cgi.d netman.d httpd.d Notice: As of Phobos 2.055, std.date and std.dateparse have been deprecated. They will be removed in February 2012. Please use std.datetime instead. netman.d:428: Error: function std.date.getUTCtime is deprecated I suspect your code is too elder. Thanks,
Apr 03 2012
On Tuesday, 3 April 2012 at 11:39:24 UTC, Timon Gehr wrote:You can just comment out the code there (afaik it is only a custom formatting routine), or compile with the -d flag.You're probably thinking of the std.date use in web.d. This one though is just older stuff that you don't need with the new cgi.d. BTW the Phobos team deciding to break std.date is still though if -property becomes the default, we'll have a new king.
Apr 03 2012
$ gdmd-4.6 -d server.d cgi.d netman.d httpd.d Notice: As of Phobos 2.055, std.date and std.dateparse have been deprecated. They will be removed in February 2012. Please use std.datetime instead. httpd.d:72: Error: undefined identifier peerAddress httpd.d:72: Error: constructor cgi.Cgi.this (long maxContentLength = cast(long)5000000, in const(immutable(char)[][string]) env = null, const(ubyte)[] delegate() readdata = null, void delegate(const(ubyte)[]) _rawDataOutput = null) is not callable using argument types (string[],immutable(ubyte)[],_error_,void delegate(const(ubyte)[])) What happens now?Thanks,You can just comment out the code there (afaik it is only a custom formatting routine), or compile with the -d flag.
Apr 03 2012
And with comment the UTC line I get: s$ gdmd-4.6 server.d cgi.d netman.d httpd.d Notice: As of Phobos 2.055, std.date and std.dateparse have been deprecated. They will be removed in February 2012. Please use std.datetime instead. httpd.d:72: Error: undefined identifier peerAddress httpd.d:72: Error: constructor cgi.Cgi.this (long maxContentLength = cast(long)5000000, in const(immutable(char)[][string]) env = null, const(ubyte)[] delegate() readdata = null, void delegate(const(ubyte)[]) _rawDataOutput = null) is not callable using argument types (string[],immutable(ubyte)[],_error_,void delegate(const(ubyte)[]))
Apr 03 2012
On Tuesday, 3 April 2012 at 19:07:10 UTC, Xan wrote:What happens now?Use the newer standalone code: http://forum.dlang.org/thread/cifekffsnaimfsvuxlrw forum.dlang.org?page=2#post-pfojnbnvhuahnyviekut:40forum.dlang.org don't need netman.d anymore. Just use: gdmd server.d cgi.d -version=embedded_httpd to compile it.
Apr 03 2012
On Tuesday, 3 April 2012 at 08:42:01 UTC, Xan wrote:I receive errors:I changed some stuff since the beginning of thi thread. cgi.d now includes a http server without needing the other modules. So if you just get the new cgi.d, you can: dmd server.d cgi.d -version=embedded_httpd without bothering with the httpd.d nor netman.d
Apr 03 2012
On Tuesday, 3 April 2012 at 13:33:19 UTC, Adam D. Ruppe wrote:On Tuesday, 3 April 2012 at 08:42:01 UTC, Xan wrote:Not, I receive the error: $ gdmd-4.6 server.d cgi.d -version=embedded_httpd std.algorithm.indexOf has been scheduled for deprecation. You may want to use std.algorithm.countUntil instead. cgi.d:2231: Error: undefined identifier lastSocketErrorI receive errors:I changed some stuff since the beginning of thi thread. cgi.d now includes a http server without needing the other modules. So if you just get the new cgi.d, you can: dmd server.d cgi.d -version=embedded_httpd without bothering with the httpd.d nor netman.d
Apr 04 2012
On Wednesday, 4 April 2012 at 08:04:14 UTC, Xan wrote:Not, I receive the error:What version of D is that? lastSocketError is in phobos: http://dlang.org/phobos/std_socket.html#lastSocketError and it should work in windows and linux. Maybe your compiler is old.
Apr 04 2012
Not, I receive the error: $ gdmd-4.6 server.d cgi.d -version=embedded_httpd std.algorithm.indexOf has been scheduled for deprecation. You may want to use std.algorithm.countUntil instead.Oh my, indexOf was deprecated? News to me.cgi.d:2231: Error: undefined identifier lastSocketError-- Dmitry Olshansky
Apr 04 2012
Am 17.03.2012 21:08, schrieb Xan:I dont' want to battle among languages,its maybe only a library battlebut I see that in Golang there is a beatiful solution to display HelloWorld program in web server [rosettacode.org/wiki/Hello_world/Web_server#Go].no its creates and simple webserver and displays your Hello worldI'm convinced there is a D equivalent?i think you've got only pure stocket library around std.socket or something like that - maybe you find an implementation of an web-server in the tango libraryCan someone say what's its aspect????Thanks in advance, Xan.
Mar 17 2012