In my embedding app, I want to get programmatic access to the request
body for a POST request.

Here's what I thought would work.

  * Create an nsIWebProgressListener.

  * In my OnStateChange(),

      if ((aStateFlags & STATE_STOP) && (aStateFlags &
STATE_IS_REQUEST)) {
        nsCOMPtr<nsIHttpChannel> channel = do_QueryInterface(aRequest);
        nsCOMPtr<nsIUploadChannel> upload = do_QueryInterface(channel);
        if (upload) {
          nsCOMPtr<nsIInputStream> uploadStream = nsnull;
          if (NS_SUCCEEDED(rv =
upload->GetUploadStream(getter_AddRefs(uploadStream)))) {
            PRUint32 avail;
            rv = uploadStream->Available(&avail);
          }
         }
       }

But I'm finding that avail is always 0, even when I know there is a
post
body.

I've tried putting this code into the

    if ((aStateFlags & STATE_START) && (aStateFlags &
STATE_IS_REQUEST)) {

case, but still I get the same result.

How can I get the POST body sent by the browser?

Thanks,

Ed

_______________________________________________
mozilla-embedding mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-embedding

Reply via email to