Netbeans HTTP Monitor

I’m working on a somewhat difficult (as in hard to solve) problem at work. We want to add Internet Explorer to the HTTP monitor in Netbeans.

Netbeans is an “IDE” or “editor” for writing computer programs or web applications. The HTTP monitor feature shows you all the HTTP headers (not to be confused with HTML headers) that the broswer sends to websites you visit and the sites send back to your browser, before it sends the actual webpage. The headers include things like whether or not the page you’re trying to view really exists, whether it hasn’t changed since the last time you viewed it (so your browser can load it faster by using its cache) and what website you came to that website from and a bunch of other stuff…most normal people wouldn’t care about what’s in the HTTP headers, but if you’re a web-developer trying to debug a complex web-application, it could be helpful diagnostic information. Right now our HTTP monitor only supports Firefox. But now I’m working on trying to add that same feature for IE.

So basically…for me, that means, I have to figure out how to get the HTTP headers out of IE. That’s the hard part. We already have a “C++ COM DLL” that intercepts page requests to do javascript debugging, but this new part you have to go a bit deeper into the browser communication and get down to the level where IE sends HTTP requests, several layers down in the browser architecture slide.

I’ve been doing a lot of internet searching. And most of that searching has gone nowhere. Other than a few people have written expensive closed source programs that monitor IE’s HTTP headers, so theoretically *what* we want to do should be possible, but not a lot of help on the *how*. And being a closed source browser, its not as easy to “hack into” as firefox. Even just doing javascript debugging, where firefox requires some javascript, IE requires a DLL written in C++ with lots of COM calls (and if you don’t know what that means, just think…its hard to read and understand ugly stuff to code).

But finally, today I’ve come across something slightly promising, a full demo-app on CodeProject.com that includes HTTP monitoring as well as the kitchen sink of other unrelated features I don’t need. The important part for me is it includes the full source code including their “C++ COM DLL” (notice how this is the same type of DLL we have? ;-)) that intercepts the requests the browser sends and acts as a pass through, mangled in with some code to be a download helper app stuff I don’t need.

On the upside this is promising because if I could understand this code, I could probably figure out exactly what I need to do to to add my new feature to our app. But the downside is that even with a several page long article on CodeProject about that app, they actually don’t document almost anything about the part I’m interested in. And the source code is extremely cryptic because it uses all these obsure programming constructs/libraries/something? like ATL that I barely know what the acronym means, and I certainly haven’t read the 500 page book on it that my coworker left me…

Its kind of like a puzzle where I’m trying to crack this code of deciphering cryptic pages on MSDN like “How to get Protocol Headers in a Pluggable Protocol Handler” which might be a little more obvious if I were a Microsoft Programming Guru (course, if I were, I’d probably be working for Microsoft or as a consultant selling my knowledge about these cryptic technologies at an obscene hourly rate…one of the other reasons those who “understand this stuff” don’t just post lots of articles all over the internet about how to do what I want to do…) so that I can figure out how this stuff works to mangle it into something different…while not recycling any code that is not appropriately licensed to be reused in an open source app (eg: big no no to recycle GPL code because GPL license requires the resulting product to also be released as GPL, which is a different license than the one we’re using) according to the legal department 😉