Re: SetRequestMethod fails on XULRunner 9.0.1

[email protected]
Newsgroups gmane.comp.mozilla.devel.xpfe
Message-ID <[email protected]>
Hi Neil,

Thank you so much.
I am able to set POST as you suggested setting the POST header in stream and empty content type parameter.

Should we know the root cause of the SetRequestMethod() failure ? Is there any reason ?

Thanks,


On Monday, July 8, 2013 5:10:44 PM UTC+5:30, [email protected] wrote:
> Hi All,
> 
> 
> 
> I am using XULRunner 9.0.1 and having one sample application that will send the "POST" data to the server but while setting the post parameter below is the code.
> 
> 
> 
> ns_smartptr postStream(nsCreateInstance("@mozilla.org/io/string-input-stream;1"));
> 
> 
> 
> postStream->SetData(<post_data>, <post_data_length>);
> 
> 
> 
> nsIUploadChannel *uploadChannel; ((nsIHttpChannel *)channel)->QueryInterface(NS_GET_IID(nsIUploadChannel), (void **)&uploadChannel);
> 
> 
> 
> uploadChannel->SetUploadStream(postStream, NS_LITERAL_CSTRING("application/x-www-form-urlencoded"), -1);
> 
> 
> 
> nsresult ww = ((nsIHttpChannel *)channel)->SetRequestMethod(NS_LITERAL_CSTRING("POST"));
> 
> 
> 
> After setting the "SetUploadStream" It required to set "POST" method again because it is reseting the method to "PUT".
> 
> 
> 
> In above code "SetRequestMethod" API is getting failed and giving error NS_ERROR_NOT_AVAILABLE (0x80040111).
> 
> 
> 
> Can anyone tell what is wrong with this ?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.