[HTTPS-Everywhere] question - nsiHTTPChannel replacement

Peter Eckersley pde at eff.org
Wed Sep 28 11:56:14 PDT 2011


Hi Gábor,

There's no easy way around the fact that XPCOM code is hard to follow :/.  
The code path you want to follow is this:


FILE                               PORTION              NOTES
components/https-everywhere.js     observe()            topic == "http-on-modify-request"
                                                        note you have to register an
                                                        nsIObserver to get these
                                                        callback

chrome/content/code/HTTPS.js       replaceChannel()     Function has three portions:
                                                        1. work out what rewrite we want
                                                        2. redirect loop detection
                                                        3. do the actual replacement

chrome/content/code/IOUtil.js      ChannelReplacement() 100% copied from NoScript

----------------------------------------------------------------------
Once you've understood that, you also need to read:

FILE                               PORTION              NOTES
components/https-everywhere.js     onChannelRedirect()  callback from nsIChannelEventSink

this is necessary if the browser is being redirected to somewhere you don't want it to go
----------------------------------------------------------------------

Until recently, we had a third path shouldLoad() / shouldProcess() in https-everywhere.js,
ForceURI() in HTTPS.js but we just disabled that in 1.0.3 and hopefully it will stay disabled for
good.


On Mon, Sep 12, 2011 at 07:50:56PM +0200, Gábor Hornyák wrote:
> Hi,
> 
> I am Gabor Hornyak and I am new to this list so it may not be the place to
> ask this question, but I could not find any information about this.
> So, my question is could anyone please explain me the steps of replacing an
> http channel in a Firefox extension? I tried to understand to code of HTTPS
> Everywhere, but I got lost after a few callbacks.
> 
> Thanks,
> Gabor Hornyak


-- 
Peter Eckersley                            pde at eff.org
Technology Projects Director      Tel  +1 415 436 9333 x131
Electronic Frontier Foundation    Fax  +1 415 436 9993



More information about the HTTPS-everywhere mailing list