summaryrefslogtreecommitdiffstats
path: root/htgen.sh
diff options
context:
space:
mode:
authortv <tv@vix>2010-02-07 01:59:29 +0100
committertv <tv@vix>2010-02-07 01:59:29 +0100
commit021b3208adb10cd25763450129c762042ed251a7 (patch)
tree7c63b8c3a9b172aa0ce7f6a66ca4dc43054e5d8f /htgen.sh
parent3b6fa7d72a3b7987c06348c985da9123a45c10ff (diff)
Added handler for /dump.txt
Diffstat (limited to 'htgen.sh')
-rwxr-xr-xhtgen.sh24
1 files changed, 22 insertions, 2 deletions
diff --git a/htgen.sh b/htgen.sh
index e94e714..ff401c8 100755
--- a/htgen.sh
+++ b/htgen.sh
@@ -54,9 +54,23 @@ case "$Host" in
case "${Method-Invalid-Request}" in
GET|HEAD)
case "$Request_URI" in
+ /dump.txt)
+ body_type=file
+ body=~/public_html$Request_URI
+ status=200
+ cat<<EOF
+HTTP/1.0 200 OK
+Connection: close
+Content-Length: `du -b $body | cut -f1`
+Content-Type: text/plain; charset=utf-8
+Server: $Server
+
+EOF
+ ;;
/style5.css)
body_type=file
body=~/public_html$Request_URI
+ status=200
cat<<EOF
HTTP/1.0 200 OK
Connection: close
@@ -69,6 +83,7 @@ EOF
/favicon5.png|/favicon2.png)
body_type=file
body=~/public_html$Request_URI
+ status=200
cat<<EOF
HTTP/1.0 200 OK
Connection: close
@@ -80,13 +95,15 @@ Cache-Control: public
EOF
;;
/|/index.html)
- # XXX this is a hack:
make -C ~/public_html index.html >&2
+ #### XXX this is a hack:
+ ### make -C ~/public_html index.html >&2
# TODO 304 Not Modified
# TODO better max-age(?)
# TODO may we use more than one Cache-Control?
body_type=file
body=~/public_html/index.html
+ status=200
cat<<EOF
HTTP/1.0 200 OK
Content-Type: text/html; charset=UTF-8
@@ -100,6 +117,7 @@ EOF
*)
body_type=string
body="404 Not found: $Request_URI"
+ status=404
cat<<EOF
HTTP/1.0 404 Not Found
Content-Type: text/plain; charset=UTF-8
@@ -114,6 +132,7 @@ EOF
*) # Method
body_type=string
body="501 Not Implemented: $Method"
+ status=501
cat<<EOF
HTTP/1.0 501 Not Implemented
Content-Type: text/plain; charset=UTF-8
@@ -129,6 +148,7 @@ EOF
*) # Host
body_type=string
body="403 Forbidden"
+ status=403
cat<<EOF
HTTP/1.1 403 Forbidden
Content-Type: text/plain; charset=UTF-8
@@ -154,5 +174,5 @@ esac
# Success (mod transfer)
-echo "# OK" >&2
+echo "# OK: $status" >&2
exit