From c877493fb00717de1a22860d88efb75ebf14ebec Mon Sep 17 00:00:00 2001 From: stanley lieber Date: Mon, 4 Feb 2013 16:40:05 -0600 Subject: add rc-httpd --- rc/bin/rc-httpd/handlers/error | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 rc/bin/rc-httpd/handlers/error (limited to 'rc/bin/rc-httpd/handlers/error') diff --git a/rc/bin/rc-httpd/handlers/error b/rc/bin/rc-httpd/handlers/error new file mode 100755 index 000000000..e38d41f01 --- /dev/null +++ b/rc/bin/rc-httpd/handlers/error @@ -0,0 +1,38 @@ +#!/bin/rc +# DO NOT make this script callable directly from the web! +fn do_error{ + echo 'HTTP/1.1 '^$1^$cr + emit_extra_headers + echo 'Content-type: text/html'^$cr + echo $cr + echo ' + +'^$1^' + + +

'^$1^'

' + echo $2 + echo '

rc-httpd at' $SERVER_NAME '' + echo ' + + + ' +} + +fn 404{ + do_error '404 Not Found' \ + 'The requested path '^$"location^' was not found on this server.' +} + +fn 500{ + do_error '500 Internal Server Error' \ + 'The server has encountered an internal misconfiguration and is unable to satisfy your request.' +} + +fn 503{ + do_error '503 Forbidden' \ + 'You do not have permission to access '^$"location^' on this server.' +} + +do_log $1 +$1 -- cgit v1.2.3