#!/bin/sh # http://neil.franklin.ch/Projects/webcam - webcam for SGI Indy # author Neil Franklin, last modification 2000.09.14 # this script only works on an SGI Indy with vidtomen and imgcopy # OK, one can do this by Apache+CGI, but where is the fun in doing that? ## inetd provides us with: waiting on port, forking, IO socket, change user ## parse HTTP request read command # strip the \r that HTTP allows/demands in input stream # no ";" evaluation after "$" evaluation, so no security hole command=`echo $command | tr -d "\r"` # split HTTP request method=`echo $command | cut -f 1 -d " "` url=`echo $command | cut -f 2 -d " "` http_version=`echo $command | cut -f 3 -d " "` # if HTTP/1.* is being used, digest the request header fields, do nothing if [ "$http_version" != "" ] ; then option="dummy" while [ "$option" != "" ] ; do read option option=`echo $option | tr -d "\r"` done fi ## decide what to do # what method does the user want, we only implement HEAD and GET if [ "$method" != "HEAD" -a "$method" != "GET" ] ; then echo "HTTP/1.0 501 Not Implemented" echo echo "" echo "
" echo "