From 466b8c5103208e7393fdb710d275e7d687be2592 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 2 Feb 2010 04:49:37 +0100 Subject: Added default cases for $Host and $Method Added default case for $Host: Forbidded Added default case for $Method: Not Implemented Added preliminary Cache-Control --- htgen.sh | 116 ++++++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 67 insertions(+), 49 deletions(-) (limited to 'htgen.sh') diff --git a/htgen.sh b/htgen.sh index c76283a..262e81b 100755 --- a/htgen.sh +++ b/htgen.sh @@ -2,8 +2,12 @@ set -euf +# TODO Cache-Control [RFC 2616, Section 14.9] +# TODO Accept-Encoding: gzip,deflate +# TODO Keep-Alive: 300 +# TODO Connection: keep-alive -Server='httpd-single/0.2' +Server='htgen' Request="$(sed 's/\r$//;/^$/q')" date="`date '+%Y-%m-%d %H:%M:%S'`" @@ -33,27 +37,28 @@ cat>&2<&2 - - # TODO Date: `date --utc` + +## +## Handle request. +## +if test -z "$Request_Line" ; then + echo "# FAIL" + exit -23 +fi >&2 - ## - ## Handle request. - ## - case "$Host" in - src.mine.nu:42380|src.mine.nu|vix|vix:42380|localhost:42380) - case "${Method-Invalid-Request}" in - GET|HEAD) - case "$Request_URI" in - /style5.css) - body_type=file - body=~/public_html$Request_URI - cat<&2 exit - -# tcpserver info: -# $PROTO is the string TCP. -# -# $TCPLOCALIP is the IP address of the local host, in dotted-decimal form. -# -# $TCPLOCALPORT is the local TCP port number, in decimal. -# -# $TCPLOCALHOST is the name listed in DNS for the local host. If no name is available, $TCPLOCALHOST is not set. Beware that $TCPLOCALHOST can contain arbitrary characters. -# -# $TCPREMOTEIP is the IP address of the remote host, in dotted-decimal form. -# -# $TCPREMOTEPORT is the remote TCP port number, in decimal. -# -# $TCPREMOTEHOST is the name listed in DNS for the remote host. If no name is available, $TCPREMOTEHOST is not set. Beware that $TCPREMOTEHOST can contain arbitrary characters. -# -# $TCPREMOTEINFO is a connection-specific string supplied by the remote host via the 931/1413/IDENT/TAP protocol. If no information is available, $TCPREMOTEINFO is not set. Beware that $TCPREMOTEINFO can contain arbitrary characters. -- cgit v1.2.3