Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to modify response data from HTTP GET requests

5 views
Skip to first unread message

wsh...@gmail.com

unread,
Mar 21, 2008, 7:58:30 PM3/21/08
to

I registered a listener for http-on-examine-response but it only has
access to the header and status code information from the channel
subject. How do I examine the response body and make modifications, if
necessary, before passing this to the browser.

I searched this group and found a long thread titled " How can
retrieved content be manipulated before being displayed by the
browser?" But the cited code did not work in my extension.

Also, for getResponseHeader(), is there any way to enumerate all
headers in the response?

Thanks,
Wayne

Boris Zbarsky

unread,
Mar 21, 2008, 10:28:52 PM3/21/08
to
wsh...@gmail.com wrote:
> How do I examine the response body and make modifications, if
> necessary, before passing this to the browser.

You have to put the data through a stream converter (generally by setting it to
a type that the browser can't handle and registering a stream converter for that
type). That will only work for loads in a Window, though.

> I searched this group and found a long thread titled " How can
> retrieved content be manipulated before being displayed by the
> browser?" But the cited code did not work in my extension.

See http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

> Also, for getResponseHeader(), is there any way to enumerate all
> headers in the response?

http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/netwerk/protocol/http/public/nsIHttpChannel.idl&rev=1.21&mark=265-275#265

-Boris

wsh...@gmail.com

unread,
Mar 23, 2008, 4:07:46 AM3/23/08
to
On Mar 21, 7:28 pm, Boris Zbarsky <bzbar...@mit.edu> wrote:

> wsha...@gmail.com wrote:
> > How do I examine the response body and make modifications, if
> > necessary, before passing this to the browser.
>
> You have to put the data through a stream converter (generally by setting it to
> a type that the browser can't handle and registering a stream converter for that

> type).  That will only work for loads in a Window, though.
>

I try to inspect/modify the responses from AJAX type of requests. any
other options for this to work?

Thanks!
Wayne


> > I searched this group and found a long thread titled " How can
> > retrieved content be manipulated before being displayed by the
> > browser?"  But the cited code did not work in my extension.
>

> Seehttp://www.chiark.greenend.org.uk/~sgtatham/bugs.html


>
> > Also, for getResponseHeader(), is there any way to enumerate all
> > headers in the response?
>

> http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/netwerk/protocol/...
>
> -Boris

Boris Zbarsky

unread,
Mar 23, 2008, 1:21:15 PM3/23/08
to
wsh...@gmail.com wrote:
> I try to inspect/modify the responses from AJAX type of requests. any
> other options for this to work?

You can always override the protocol handler and do your own thing... It'll be
pretty painful, though.

-Boris

0 new messages