I have build a POST handler into sh-httpd but haven't had the time to
thoroughly test it. Here it is as a diff script:

JamesS

*** sh-httpd    Mon May 13 09:01:27 2002
--- sh-httpd.org        Mon May 13 09:02:21 2002
***************
*** 182,193 ****
                ;;
        esac
  
!       if [ -f /tmp/sh-httpd$PID.input ] ; then
!               $LOCALURL "$@" </tmp/sh-httpd$PID.input > $OUTPUT &
!               rm -f /tmp/sh-httpd$PID.input
!       else
!               $LOCALURL "$@" > $OUTPUT &
!       fi
        CGI_PID=$!
  
        CNT=1
--- 182,188 ----
                ;;
        esac
  
!       $LOCALURL "$@" > $OUTPUT &
        CGI_PID=$!
  
        CNT=1
***************
*** 200,206 ****
                fi
        done
  
!       file_stats $OUTPUT
        STATUS="200 OK"
        case $FILE in
        nph-*)  if [ -n "${PROTOCOL}" ] ; then
--- 195,201 ----
                fi
        done
  
! #     file_stats $OUTPUT
        STATUS="200 OK"
        case $FILE in
        nph-*)  if [ -n "${PROTOCOL}" ] ; then
***************
*** 349,377 ****
        local HEADER
        local HEADERDATA
  
        read COMMAND URI PROTOCOL
  
!       COMMAND=${COMMAND%"${CR}"}
        URI=${URI%"$CR"}
        PROTOCOL=${PROTOCOL%"${CR}"}
        REQUEST="$COMMAND $URI $PROTOCOL"
        if [ -n "$PROTOCOL" ] ; then
                IFS=' :'
                while   read -r HEADER HEADERDATA
!                       [ "x$HEADER" != "x$CR" ]
!               do
                        HEADER=`toupper "$HEADER"`
!                       HEADERDATA="${HEADERDATA%${CR}}"
!                       setvar HTTP_$HEADER "$HEADERDATA"
                        export HTTP_$HEADER
                done
!               if [ "$HTTP_CONTENT_LENGTH" != "" ] ; then
!                       PID=$$
!                       export PID
!                       dd bs=$HTTP_CONTENT_LENGTH count=1
of=/tmp/sh-httpd$PID.input
!               fi
                IFS=$OIFS
!       fi
        REQ_DATE="`date -uR`"
  
        case $COMMAND in
--- 344,395 ----
        local HEADER
        local HEADERDATA
  
+         PID=$$
        read COMMAND URI PROTOCOL
  
! echo "Processing $COMMAND $URI $PROTOCOL" >>/tmp/sh-http.log
!       COMMAND=${COMMAND%"${CR}"}
        URI=${URI%"$CR"}
        PROTOCOL=${PROTOCOL%"${CR}"}
        REQUEST="$COMMAND $URI $PROTOCOL"
+         export COMMAND URI PROTOCOL REQUEST
+ 
        if [ -n "$PROTOCOL" ] ; then
                IFS=' :'
                while   read -r HEADER HEADERDATA
!               do
!                   HEADER="${HEADER%${CR}}"
!                   HEADERDATA="${HEADERDATA%${CR}}"
!                   if  [ "x$HEADER" != "x" ] ; then
                        HEADER=`toupper "$HEADER"`
!                       eval HTTP_$HEADER=$HEADERDATA
                        export HTTP_$HEADER
+ echo "Header variable HTTP_$header = $HEADERDATA" >>/tmp/sh-http.log
+                     else
+                       PID=$$
+                         export PID
+                         dd bs=$HTTP_CONTENT_LENGTH count=1
of=/tmp/sh-httpd$PID.input
+                         LINE=`cat /tmp/sh-httpd$PID.input`
+                         rm -f /tmp/sh-httpd$PID.input
+                         while [ "$LINE" != "" ] ; do
+                             var=`echo "$LINE" | sed "s/\&.*//"`
+                             if [ "$var" == "" ] ; then
+                                 var="$LINE"
+                                 LINE=""
+                             else
+                                 LINE=`echo "$LINE" | sed "s/$var//" | sed
"s/^\&//"`
+                             fi
+                             eval $var
+                             vname=`echo "$var" | sed "s/=.*//"`
+                             export $vname
+ echo "Form Data $var" >>/tmp/sh-http.log
+                         done
+                         break 2
+                     fi
                done
! 
                IFS=$OIFS
!       fi
        REQ_DATE="`date -uR`"
  
        case $COMMAND in

-----------------------------
At 09:40 PM 5/11/02 +0200, Jon Clausen wrote:
<snip>
>While this all works, I'm going to need some way of setting 'time to run'
and 
>a couple other things from the 'master' page. 
>
>One (rather clunky) way would be to have a whole bunch of links of this type:
>"Hour(tens) = 0, 1, 2"
>"Hour(ones)= 0,1,2,3,4,5,6,7,8,9"
>"Minute(tens)= 0,1,2,3,4,5
>"Minute(ones)= 0,1,2,3,4,5,6,7,8,9
>... and so on... 
>Pretty ugly.
>
>So what I'm asking now is this:
>
>Is anyone aware of any way to have an input field on a page served by the 
>weblet...?
>
>It just occurred to me that I might get away with setting up a 'settime' 
>script in cgi-bin that could get the value from the address line in the 
>browser... something like:
>
>http://blinder/cgi-bin/settime?06:30
>
>-but a 'real' input field on the page *would* be nicer... 
>
>I realize that the weblet is really only meant to be a passive thingy, but I 
>thought I might as well ask anyway... In case somebody had already made 
>something that might be adapted...
>
>TIA for any thoughts/ideas
>
>Jon Clausen
>



_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]

------------------------------------------------------------------------
leaf-user mailing list: [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-user
SR FAQ: http://leaf-project.org/pub/doc/docmanager/docid_1891.html

Reply via email to