At the bottom of this message is a diff of the changes I made. It was to
the Users list as a response to "Weblet Abuse". It still hasn't been
thouroughly tested by me since I found a better method to handle my issue.
I'm not a registered developer so someone else will have to add the changes
to the distribution.

JamesS

At 10:36 AM 7/1/02 +0200, Erich Titl wrote:
>Lynn
>
>At 04:50 01.07.2002, you wrote:
>
>>James Sturdevant posted POST support in patch form to the list a while
>>back. I think this will work fine.
>
>I would be very interested in that patch. I changed sh-httpd to support a 
>GET with multiple parameters to at least be able to use forms in a still 
>very primitive state, but of course a fully fledged POST would be superior.
>
>



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
+                         done
+                         break 2
+                     fi
                done
! 
                IFS=$OIFS
!       fi
        REQ_DATE="`date -uR`"
  
        case $COMMAND in

-----------------------------




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

_______________________________________________
Leaf-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-devel

Reply via email to