benlowery

HttpCompress

The open compression engine for ASP.NET

News

Want to learn how to hack on this module? Check out the following books:

Jan 14, 2008 – Version 7 available

A while ago I worked in a patch for the very commonly reported bug “HttpCompress doesn’t work for documents in the root of a site”, but never cut a release. So, here’s a release with that patch incorporated.

Oct 27, 2007 – Project Hosting now at Google Code

In an effort to allow others to easily contribute to this project, I’m not hosting it at http://code.google.com/p/httpcompress/. Head over there to track issues, contribute patches and keep up to date on what’s going on. I’ll still keep current downloads available here, but the build of the project will be taking place over on the new site.

Nov 15, 2005 – Version 6 for .NET 2.0 released!

This is a pretty simple recompile of the version 6 source, targeting the 2.0 version of the .NET Framework. It now uses the built-in deflate and gzip streams found in System.IO.Compression instead of #ziplib. I consider this a beta release; please test it thoroughly before releasing it onto any production systems. [Binary Only, Source Only]

Apr 21, 2004 – Version 6 released!

Another bugfix release:

  • Changed how the Content-Encoding header is written. It is now written on the first call to the compressing stream’s Write method. This fixes the issue where the response would come back with a header indicating it was compressed when the filter was really skipped. This allows Server.Transfer and the default exception reporting mechanism in ASP.NET to work without modification, though their output will not be compressed.

Mar 19, 2004 – Version 5 released!

This is mainly a bugfix release over version 4. New Features:

  • (v5) Plays nice with the OutputCache using the VaryByHeader property.
  • (v5) No longer installs the filter if the CompressionLevel is set to “None”.
  • (v5) No longer throws an exception if a q-value cannot be parsed.
  • (v5) Properly install the INSTALLED_TAG, preventing double processing when
    a filter is not installed
  • Path-based exclusions
  • ContentType / MimeType based exclusions
  • A newer SharpZipLib

Download

Current Version
Older Versions

Known Bugs

Compression breaks when Server.Transfer is used
In ASP.NET 1.0 and 1.1, Server.Transfer and response filters do not play well together. Thankfully, a fix is available.
Images compressed with the filter are broken
This usually occurs with Internet Explorer 5.5 or 6.0. Both of these browsers can drop the first 2048 bytes of the response, breaking images that are compressed. The situation is documented by KnowledgeBase articles Q312496 for IE 6 and Q313712 for IE 5.5. The latest service pack fixes the issue for IE6, while you have to get a hotfix for IE 5.5.

Articles

OnDotNet -Filtering HTTP Requests with .NET
An article about filtering HTTP requests using ASP.NET. The article was based upon my experiences building the HttpCompressionModule.

11 Responses to “HttpCompress”

  1. chiefconcern

    I have a bug I found with this compression module. I have tried to debug but have not found a way. When you use the asp substitution control with this module it causes the substition to not occur.

    Thought?

  2. Please file a bug over on the code.google.com site.

  3. I just want to inquire if this module is supported in ASP.NET Development Server environment. Thanks!

  4. If that environment supports HttpModules and Response.Filter, it should work. Are you talking about the super-Cassini that ships with the more recent ASP.NET environments?

    That said, you probably want the svn version right now. It fixes a bug with paths to apps that live off the root of the application instead of in a virtual directory.

  5. Thanks Ben, for HttpCompress. I’m using it to compress the data from an ASP.NET web service. I’d like to know if the deflate compression method uses zlib. If so, how can I turn on the zlib headers in the response?

  6. Google code block me, why you host this project else where like SF.Net that is greater? google code is not realy open! becuase of political functions.

  7. Hi, it’s a good tool. Do you have any plans to add functionality to compress webresource.axd files also to compress other resources files which are emitted by some third party components such as Telrik, Infragistics etc.

  8. hi
    is there any known bug in this module related to ajax?
    i want to use this http module with asp.net ajax and i want to know is there any problem or not?

  9. Hi Ben,

    I’m using your compression module and it works very well. I use some PageMethods in my application and have noticed that the response from these does not get compressed. Is the mime type of “application/json” not supported at all?

    Thanks.

  10. May I have the source code of version 7? I want to apply the code from issue 15 from google code.

  11. The source is available via Subversion, over on the Google Code project page. See http://code.google.com/p/httpcompress/

Leave a Reply