I think I might have found what I needed. I came across this link, which is used to track HTTP calls: http://blues.ath.cx/firekeeper/resources/http_tracer.html
For some reason, there are apparently some problems with the JavaScript implementation, and I am not a JavaScript guru to understand this, but I implemented it in C ++, and the original results show that I should be able to modify it for my needs.
Basically, we replace the nsIHttpProtocolHandler service with our own implementation, which keeps a reference to the original implementation. When a call is made for a service, we simply pass it on to the stored original implementation. Then we provide our own implementation of nsIHttpChannel and nsIStreamListener, which we also use as a proxy.
Again we proxied most calls to the original handlers. But in OnDataAvailable, instead of passing data to the base nsIStreamListener, we save it with nsIStorageStream. Then in OnStopRequest, after we got all the data, we can unzip it and then call OnDataAvailable in the source handler and then OnStopRequest.
So far, he has been working on some small simple tests, but I will have to go through more rigorous tests ... I also need to find out if I can do the same with HTTPS.
The biggest problem that I see at the moment is that it relies on some non-freezing interfaces, such as nsIHttpChannelInternal. It is impossible to help, as far as I can tell, and my requirements for version compatibility are pretty small, so I can live with it if I need to.
In the meantime, if anyone has any other suggestions, I'm all ears: D
Gerald
source share