summaryrefslogtreecommitdiffstats
path: root/htgen-plain
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2017-03-15 01:16:08 +0100
committertv <tv@krebsco.de>2017-03-15 01:16:08 +0100
commit658a4ecfdf660274dbfa9eaaa80f2a97ee7917ab (patch)
treeed0b37a761d3a91c65088abb3627a36810b7acb1 /htgen-plain
parentf6dce79e752e57909981cf455a82a8e48f732f62 (diff)
rename executable to htgen
Diffstat (limited to 'htgen-plain')
-rwxr-xr-xhtgen-plain94
1 files changed, 0 insertions, 94 deletions
diff --git a/htgen-plain b/htgen-plain
deleted file mode 100755
index 659576f..0000000
--- a/htgen-plain
+++ /dev/null
@@ -1,94 +0,0 @@
-#! /bin/sh
-# vim:set fdm=marker:
-set -euf
-
-Server='htgen-plain/1.0'
-
-## htgen --serve {{{
-case $# in
- (1)
- case "$1" in
- (--serve)
- HTGEN_HOST="${HTGEN_HOST-0.0.0.0}"
- HTGEN_PORT="${HTGEN_PORT-42380}"
- TCPSERVER_OPTS='-c 423 -t 2 -D'
- echo "#### $Server $HTGEN_HOST:$HTGEN_PORT" >&2
- exec tcpserver $TCPSERVER_OPTS "$HTGEN_HOST" "$HTGEN_PORT" "$0"
- ## this should not happen...
- exit 23
- esac
-esac
-## }}}
-
-## reply_404 {{{
-reply_404() {
- cat<<EOF
-HTTP/1.0 404 Not Found
-Content-Type: text/plain; charset=UTF-8
-Server: $Server
-Connection: close
-Content-Length: 0
-
-EOF
-}
-## }}}
-
-## date. {{{
-#date=`date --rfc-3339=ns`
-date="`date '+%Y-%m-%d %H:%M:%S'`"
-cat>&2<<EOF
-
-# ${TCPREMOTEHOST-}[$TCPREMOTEIP]:$TCPREMOTEPORT connected at $date over $PROTO
-EOF
-## }}}
-## Parse Request-Line. {{{
-read Request_Line
-eval "$(echo "$Request_Line" | sed -rn '
- s^([a-zA-Z]+) ([a-zA-Z0-9?&+*/.-]+) HTTP/([0-9]+\.[0-9]+)\r$\
- Request_Line="&"\
- Method="\1"\
- Request_URI="\2"\
- HTTP_Version="\3"\
- p;t;i\
- Request_Line= # invalid request
-')"
-#echo "Request-Line: $Request_Line" >&2
-# cat>&2<<EOF
-# Request_Line='$Request_Line'
-# Method='$Method'
-# Request_URI='$Request_URI'
-# HTTP_Version='$HTTP_Version'
-# EOF
-
-## debug
-cat>&2<<EOF
-$Method $Request_URI HTTP/$HTTP_Version
-EOF
-## }}}
-## Parse HTTP-Headers. {{{
-HTTP_Headers="`sed -rn 's/ $//;/^$/q;p'`"
-
-## debug
-echo "$HTTP_Headers" | sed -r 's/.*/^&$/' >&2
-
-## Parse HTTP_Headers into Variables.
-eval "$(
-echo "$HTTP_Headers" | sed -r '
- ## TODO concatenate lines
- /^[^:]+-[^:]+:/s/^([a-zA-Z-]+):[[:space:]]*([^'\'']*)*$/\
- x=`echo \1 | tr - _`; \
- echo $x=\\'\'''\''\2'\''\\'\''\\;;\
- echo HTTP_Header_Variables=\\\${HTTP_Header_Variables+\\\$HTTP_Header_Variables:}$x\\;;\
- /;t
- s/^([a-zA-Z]+):[[:space:]]*([^'\'']*)*$/\
- echo \1=\\'\'''\''\2'\''\\'\''\\;;\
- echo HTTP_Header_Variables=\\\${HTTP_Header_Variables+\\\$HTTP_Header_Variables:}\1\\;;\
- /;t
- s/^.*/# &/
- '| sh)" >&2
-
-echo >&2
-## }}}
-
-reply_404
-exit