I've been sifting through the code in netwerk/protocol/http/src (and elsewhere) trying to find a way to get the text of a POST request's entity body (i.e., the form data that is sent after the request headers in a POST request). All I want to do is put this text in a char array and fwrite() it to the screen (in debug mode) as a diagnostic print.
I'm able to this with the request and response *headers* in nsHttpTransaction::Init() and nsHttpTransaction::HandleContentStart(), respectively, but I can't find where I can get ahold of the request body that is sent in a POST request.
If anyone can help out, I'd really appreciate it.
Thanks.
--Mike
_______________________________________________
Mozilla-netlib mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-netlib
you could read nsHttpChannel::mUploadStream and then rewind it (via nsISeekableStream::Seek) after you are finished reading it. you would want to be sure to do this before the nsHttpTransaction takes ownership of a reference to the same nsIInputStream object. you also should not attempt to read if mUploadStream does not support nsISeekableStream because otherwise you'd interfere with the data being sent to the server. mUploadStream should always support nsISeekableStream, but just in case it doesn't... ;-)
you can also access this stream object via nsIUploadChannel::GetUploadStream. NOTE: the contents of this stream are sometimes preceded by a few headers.
it is possible to write a utility class that observes all of the outgoing requests and incoming responses. see http://livehttpheaders.mozdev.org/ for example.
-darin _______________________________________________ Mozilla-netlib mailing list [EMAIL PROTECTED] http://mail.mozilla.org/listinfo/mozilla-netlib
