"Darin Fisher" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Michael Mangino wrote:
<snip>
>> I can't find where I can get ahold of the request body
>> that is sent in a POST request.
<snip>
> you could read nsHttpChannel::mUploadStream and then rewind it (via
> nsISeekableStream::Seek) after you are finished reading it.

I've already tried that with the nsIInputStream::Read() method, which I
can't get to read anything. (See code below.) What's weird is that the
nsIInputStream::Available() method that I call right before Read() does
return a value that I can see change when I change my POST data length..
Yet, Read() always returns 0 and leaves aBuf empty. Any idea why this
doesn't work? Is using Read() not the right approach? Here's the code:

         if (mRequestStream)
         {
            char aBuf[1024];
            int iBytesRead;
            uint uiAvail;

            mRequestStream->Available(&uiAvail);
            iBytesRead = mRequestStream->Read(aBuf, 1024, &rv);


printf("\n-------------------------------------------------------------\n");
            printf("Avail %d\n", (int)uiAvail);
            printf("Bytes Read %d\n", iBytesRead);
            fwrite(aBuf, 1, iBytesRead, stdout);

printf("\n-------------------------------------------------------------\n\n"
);

             // rewind the upload stream
             if (mRequestStream) {
                 nsCOMPtr<nsISeekableStream> seekableMM =
do_QueryInterface(mRequestStream);
                 if (seekableMM)
                     seekableMM->Seek(nsISeekableStream::NS_SEEK_SET, 0);
             }
         }


_______________________________________________
Mozilla-netlib mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-netlib

Reply via email to