Re: Where does the data go?

Jacob Smullyan <[email protected]> Fri, 9 Sep 2005 23:29:11 -0400
Newsgroups gmane.comp.web.skunkweb
Message-ID <[email protected]>
On Fri, Sep 09, 2005 at 07:34:45PM -0700, Gregory Brauer wrote:
> 
> I am attempting to use Skunkweb to receive data from a client
> that is doing a POST using XMLHTTPRequest instead of using a
> form.  On the client, on the instance of the XMLHTTPRequest
> there is a "send" method that takes a string arguement of the
> data string that you want to send to the server via the post
> method.  I cannot seem to figure out where this data ends up
> in the CONNECTION object on the server side.
> 
> I was able to get it to show up in CONNECTION.args by using a
> GET instead of a POST and manually specifying
> "?foo=.....my_data.....", but I would rather do a POST.  Does
> Skunkweb allow raw access to this non-form POST data?

The data should also show up in CONNECTION.args.  As you can verify by
writing a form with method='post' that submits to a page like:
   
   <:val `CONNECTION.args`:>

, posted form data is does wind up in args.

What is the content-type of the data you are submitting?  Check
CONNECTION.requestHeaders['Content-Type'].  If you are sending
something other than form data, say, 'text/plain', then indeed it
won't end up in CONNECTION.args; it needs to be
application/x-www-form-urlencoded or multipart/form-data.  (The raw
input can be found in CONNECTION._stdin.)  

My guess is that you just need to set the content-type appropriately,
and you'll be good to go.


js



-- 
Jacob Smullyan
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDIlMHuqamFyFXXLIRAucEAKCW+HUhKDCTMR9e1SBQBvZ4MOT0qQCfaBvX
f5iEgwxkMi2CSlQMljpUM8A=
=htPM
-----END PGP SIGNATURE-----