summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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