Post requests were being decoded before splitting into an ALIST. This

caused problems if the post data contained an '&' or '='. Now the
decoding is done after the splitting. Also added logging of the original
post data and the decoded alist.
cvs
Chris Double 2004-08-01 22:28:50 +00:00
parent 7c0ae6a136
commit c72246cedd
1 changed files with 11 additions and 3 deletions

View File

@ -41,6 +41,7 @@ USE: kernel
USE: logic
USE: cont-html
USE: logging
USE: url-encoding
: expiry-timeout ( -- timeout-seconds )
#! Number of seconds to timeout continuations in
@ -257,19 +258,26 @@ DEFER: show
"&" split [ "=" split1 ] inject
] [
"=" split1 unit
] ifte ;
] ifte [ uncons >r url-decode r> url-decode cons ] inject ;
: post-request>namespace ( post-request -- namespace )
#! Return a namespace containing the name/value's from the
#! post data.
post-request>alist alist>namespace ;
post-request>alist dup log alist>namespace ;
: read-undecoded-post-request ( -- string )
#! Read the post request from the socket and return the post data
#! before it has been url decoded.
read-header content-length dup [
read#
] when ;
: cont-post-responder ( id -- )
#! httpd responder that retrieves a continuation for the given
#! id and calls it with the POST data as an alist on the top
#! of the stack.
[
read-post-request dup log post-request>namespace swap resume-continuation
read-undecoded-post-request dup log post-request>namespace swap resume-continuation
] with-exit-continuation
print drop ;