> > What if i replace the component @mozilla.org/network/protocol;1?
> > name=http
> > with my own protocol handler that basically forwards all API methods
> > to the original
> > http handler.
>
> > I should be able to intercept requests i'm interested in (presumably
> > within the
> > newChannel method) and return a channel of my own that i can control
> > at will.
>
> > Would this method work implemented in javascript ?

> I once tried to do the same think in javascript and had some problems
> with AJAX requests using my handler (I don't remember now if these
> requests were using original handler or weren't working at all).  I
> wrote then some note about this approach and attached source code, it
> may be useful for 
> you:http://blues.ath.cx/firekeeper/archives/2006-06.html#e2006-06-09T00_0...

Many thanks for this link Jan.

I presume this AJAX issue should not be a problem in my case, as the
connections i want to alter are unlikely to be generated from
javascript
so even if the implementation of XMLHTTPRequest shortcuts the
protocol
mechanism and accesses the original http handler through its uuid, i
just
won't see those requests which will be just fine. Of course this AJAX
problem might have another reason, like a channel being QI'd  to a
non-supported interface.

> I ended up doing this in C++ but it is really painful. As Boris wrote
> to make it work I had to implement all the interfaces that
> nsHttpChannel implements.

That the problem i oversee, knowing what interfaces to implement. I
don't have a real way to know to what interfaces my channel object
will be QI'd against. I guess i can trace calls to QueryInterface to
see
what is being used, but this might change over time.

> But additionally, it turned out that I also had to implement replacement
> objects for channel's LoadGroup and NotificationCallback.  These
> objects receive some progress notification for a request, but without
> replacing them, listener receives information about original requests
> not proxy ones and doesn't know what to do with them.

That definitely doesn't sound obvious :(

> It basically is a lot of work and lot of frustrating debugging.

I'll do my best to keep my software faith up :)

Thanks again Boris and Jan.

Marie.


_______________________________________________
dev-tech-network mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-network

Reply via email to