Simon Fell > Its just code > Http Compression

Sunday, July 27, 2003

Digging though http compression again, found Ben Lowery's HttpCompressionModule for ASP.NET, which works great, except for one bug, it doesn't take caching into account. Fortunately its easy to fix, in HttpCompressionModule,CompressContent add app.Context.Response.Cache.VaryByHeaders["Accept-Encoding"] = true ; after the HttpApplication app = (HttpApplication)sender; (line 58 in HttpCompressionModule.cs) and you're good to go!. GetFilterForScheme could also do with some work to apply q values properly when trying to determine which compression scheme to use, but practically speaking, that's a very minor problem.

I've also been looking at the compression handling in PocketHTTP, and spotted a problem, seems the http spec/implementations aren't very clear on whether a deflate encoded response should include the 2 byte zlib header or not, sigh. Currently PocketHTTP will only handle deflate responses that include the header, you'll get deflate data errors if you get a response without the header (such as from IIS6.0). The fix will be in CVS by the end of the weekend.