diff --git a/resources/httpd/error/404.html b/resources/httpd/error/404.html new file mode 100644 index 0000000..0979969 --- /dev/null +++ b/resources/httpd/error/404.html @@ -0,0 +1,27 @@ + + + + 404: File not found + + + +

404: I'm sorry, Dave, I can't do that

+ +

The file you requested was not found on this server.

+ + + + \ No newline at end of file diff --git a/resources/httpd/error/501.html b/resources/httpd/error/501.html new file mode 100644 index 0000000..347e446 --- /dev/null +++ b/resources/httpd/error/501.html @@ -0,0 +1,27 @@ + + + + 501: Not implemented + + + +

501: I'm sorry, Dave, I can't do that

+ +

The GILD HTTP handler is very simple, and can only handle HEAD and GET requests.

+ + + + \ No newline at end of file diff --git a/resources/httpd/htdocs/index.html b/resources/httpd/htdocs/index.html new file mode 100644 index 0000000..fe2f346 --- /dev/null +++ b/resources/httpd/htdocs/index.html @@ -0,0 +1,70 @@ + + + + + Welcome to the GILD HTTP handler + + + + +

GILD

+

The Generic Internet Listener Daemon

+

This is ancient history, and never was meant for doing anything practical; it's essentially + a joke. Its practical use - when it had any practical use - was to experiment with new + protocols.

+

The fact that protocols can be implemented in more or less any language you like is an added + jape: see HTTP in under 100 lines of shell script.

+

Enjoy!

+

Building

+
pushd src; make clean; make; popd
+
+

Running

+

It depends what you want to do with it. Review the contents of gild.conf; in practice + only the HTTP handler is going to work out of the box, and, out of the box, it expects to find the website to + serve in /usr/local/etc/gild/httpd/htdocs. To change where it looks for its website, edit the HTTP + handler.

+

The HTTP handler will serve HTML files, plain text files and common image formats, but nothing more + sophisticated. It currently won't serve CSS correctly (although your browser will probably cope) because it + can't tell the difference between CSS and plain text.

+

Having said all that, to run it,

+
bin/gild -f gild.conf
+
+

will start gild listening on its default port, 8421. If you'd prefer it to listen on, + for example, port 6666, you would use

+
bin/gild -f gild.conf -p 6666
+
+

Be aware that gild is a true daemon. It will immediately detach from the console, and you + will get your prompt back as if nothing had happened. But if you look in the syslog, you'll see something + like this:

+
Mar  8 19:05:25 fletcher gild: Loading configuration from gild.conf
+Mar  8 19:05:25 fletcher gild: registering handler [handlers/http] for protocol http
+Mar  8 19:05:25 fletcher gild: registering handler [handlers/crp] for protocol crp
+Mar  8 19:05:25 fletcher gild: registering handler [handlers/mdlscp] for protocol mdlscp
+Mar  8 19:05:25 fletcher gild: started; awaiting requests on port 6666
+Mar  8 19:06:14 fletcher gild: using handler 'handlers/http' [28001] to handle http request from 127.0.0.1
+
+

Back in the day, gild really did run a public website for several years. However, back in + the day, the internet was a much less hostile and dangerous place. It is not at all security hardened. + If you're going to run it on a public network, do it on a Raspberry Pi or something of that nature which has + nothing you value on it, and keep a close eye on what happens.

+

Using

+

If you have a bright idea for a completely new application layer protocol, gild is a good + tool for prototyping, because it's absurdly easy to get things working. Apart from that, I strongly advise + you to treat it as an amusing curiousity, only.

+

License

+

GPL version 2. You never were going to use this for anything commercial, seriously.

+ + + \ No newline at end of file diff --git a/resources/httpd/logs/access_log b/resources/httpd/logs/access_log new file mode 100644 index 0000000..e69de29 diff --git a/resources/httpd/logs/error_log b/resources/httpd/logs/error_log new file mode 100644 index 0000000..e69de29 diff --git a/src/Makefile b/src/Makefile index ecd12e6..473b19f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -28,8 +28,9 @@ clean: rm -f core $(COMPONENTS) $(TARGETS) install: $(TARGETS) - install --strip $(TARGETS) $(HOMEDIR) - install gild.conf $(HOMEDIR) - cd handlers; make install - + test -d $(HOMEDIR) || mkdir -p $(HOMEDIR) + install -v --strip $(TARGETS) $(HOMEDIR) + install -v ../gild.conf $(HOMEDIR) + cp -r ../resources/httpd $(HOMEDIR) + cp -r ../handlers $(HOMEDIR) diff --git a/src/wrapper.c b/src/wrapper.c index e16e0fb..9528326 100644 --- a/src/wrapper.c +++ b/src/wrapper.c @@ -86,7 +86,7 @@ void wrapper( int conversation, char * client_id) /* ...execute the command (shouldn't return) */ { /* if it did we've got an error */ sprintf( errorBuff, - "error [errno %d] whislt execing handler '%s' [%d]\n", + "error [errno %d] whilst execing handler '%s' [%d]\n", errno, command->command, ( int)getpid()), error( LOG_ERR); }