I presume that by "user parameters" you mean the form post parameters, either encoded in the URL or encoded as the body of the request message. In the former case you cannot really change what is sent to the server. The URL for the HTTP channel is fixed.

However, in the latter case, it is probably possible to use nsIUploadChannel to change the nsIInputStream containing the data to be sent to the server. This is known to work.

NOTE: With regards to URL params, I haven't tried modifying the URL of the HTTP channel from on-modify-request, but it might just be possible. However, it is a risky thing to do since so many things in the browser use it as a key. I suppose you could try modifying it in on-modify-request to see what breaks (if anything):

You'd want to call nsIChannel::GetURI, QueryInterface the result to nsIURL, and then modify the "query" portion of the nsIURL (use GetQuery and SetQuery). This should work ok except when the browser uses a proxy server, which just goes to show how risky and unsupported this hackery would be. I'm sure other things would break too.

Don't say I didn't warn you! ;-)

-Darin


nitro wrote:


> see nsIHttpChannel. it inherits from nsIChannel, which inherits from

nsIRequest.

you can use nsIObserverService to hook your application up to receive notifications about HTTP requests and responses. nsIHttpProtocolHandler.idl documents these observer topics.

see the online xpcom book (http://www.mozilla.org/projects/xpcom/book/cxc/) for more info on using nsIObserverService to intercept various Gecko events.

if you have any questions, don't hesistate to ask.

-darin


Alright, but I don't understand how mozilla send parameters to HTTP servers. I mean there are two common ways to send informations :

1) GET for URLs
http://www.some-site.com/some-page.ext?param1=value1&param2=value2
HTTP request look like :
GET /some-page.ext?param1=value1&param2=value2 HTTP/1.X
...

2) POST for FORMs
http://www.some-site.com/some-page.ext and then there is something in request content.
HTTP request look like :
GET /some-page.ext HTTP/1.X
...
\n\n
====================someseparator============
param1=value1
====================someseparator============
param2=value2



I known all HTTP request fields are accessible like user-agent, referrer, host, ... But then for user-parameters can I access them the same way as common HTTP-parameters ?


I mean can I use nsIHTTPChannel::GetRequestHeader(...), nsIHTTPChannel::SetRequestHeader(...) and nsIHTTPChannel::VisitRequestHeaders(...) to check and then modify user-parameters ?

Regards

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


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

Reply via email to