Leverages Zlib.Portable to enable automatic GZIP and DEFLATE decompression for the new HttpClient Portable Class Library.
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.


HttpClient.Compression 1.0 Beta

HttpClient.Compression is a Portable Class Library for using GZIP and DEFLATE compression in conjunction with Microsoft's new PCL version of the HttpClient. It is based on a Gist created by Morten Nielsen, but runs on all platforms.

Works on .NET 4.0, 4.0.3, & 4.5, Silverlight 4 & 5, Windows Phone 7.5 & 8, and Windows 8.

Quick start

Install the NuGet package: Install-Package HttpClient.Compression -Pre, clone the repo, git clone git://github.com/advancedrei/HttpClient.Compression.git, or download the latest release.

To use in your code, create a new instance of the CompressedHttpClientHandler, and pass it into the HttpClient, as shown below.

    var handler = new CompressedHttpClientHandler();
    var client = new HttpClient(handler);
    var result = await client.GetStringAsync("https://nuget.org/api/v2/Packages()?$filter=tolower(Id)%20eq%20'microsoft.bcl.async'&$orderby=Id&$skip=0&$top=30");

You can verify that the payload was compressed using Fiddler.

Bug tracker

Have a bug? Please create an issue here on GitHub that conforms with necolas's guidelines.


Twitter account

Keep up to date on announcements and more by following AdvancedREI on Twitter, @AdvancedREI.


Read more detailed announcements, discussions, and more on The AdvancedREI Dev Blog.


Robert McLaws

Copyright and license

Copyright 2013 AdvancedREI, LLC.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:


Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.