views:

621

answers:

3

I want to modify HTTP requests headers using an Internet Explorer Browser Helper Object. I basically need to change a few headers for every request, and then modify the response before it returns to the browser.

I tried using the OnNavigate2 events, but those don't even give you access to all of the headers.

I tried making an Asynchronous Pluggable Protocol, but then I don't really have access to the default HTTP implementation, and i can't override the default HTTP requests.

Do you have any idea how this is supposed to be done? I prefer C#, but could use C++ if necessary.

A: 

The easiest way to do it is to use an http proxy to intercept everything the way Fiddler does.

See this description of the Fiddler PowerToy (Part 1).

jeffamaphone
A: 

It seems that you can only modify CUSTOM headers by using the headers parameters of the BeforeNavigate2 event. Not all the headers are accessible. This is a way to try to minimize the potential of the BHOs to act as a Trojans. Use a HTTP proxy instead.

backslash17
That's not actually true: <<This is a way to try to minimize the potential of the BHOs to act as a Trojans.>>
EricLaw -MSFT-
+2  A: 

It can be done with URL monikers. There is an implementation of something like that by a guy called Igor Tandetik. You can find links to the code in: microsoft.public.inetsdk.programming google group - just look for PassthruAPP. (I would have posted a link but apparently new users are not allowed to do this)

It doesn't directly support modifying the response body though. You will have to insert a hook into the IInternetProtocolImpl::Read method.

Google toolbar uses the APP-wrapper approach. Microsoft specifically recommends that developers not do this, as it leads to stability, performance, and reliability problems. If more than one addon does it (e.g. Gears and anything else) the result is almost always a crash or a broken addon.
EricLaw -MSFT-