On Thu, 2012-05-31 at 02:07 +0300, Mugoma Joseph Okomba wrote:
> Thanks for the suggestions. I moved to HC 4.2 and tested several links and
> compression appears to work. The only time compression fails is when the
> URL redirects.
> 
> e.g.
> 
> a) curl -v -H "Accept-Encoding: gzip"
> http://timesofindia.indiatimes.com/nri/us-canada-news/Indian-diplomats-daughter-files-lawsuit-seeks-1-5-million-in-damages/articleshow/13047591.cms
> > test-it.gzip
> 
> vs
> 
> b) curl -v -H "Accept-Encoding: gzip"
> http://articles.timesofindia.indiatimes.com/2012-05-08/us-canada-news/31626225_1_obscene-emails-lawsuit-krittika-biswas
> > test-it-b.gzip
> 
> 
> Note that the link in a) redirects to the link in b). Only the final URL
> (in b) benefits from compression.
> 
> Is it possible that compression applies even for redirected URLs?
> 
> Thanks.
> 
> Joseph.
> 

Hi Joseph 

This is a bug in HttpClient 4.2

https://issues.apache.org/jira/browse/HTTPCLIENT-1199

While we are working on the fix for it you can make DefaultHttpClient
capable of handling compressed responses transparently by explicitly
adding two additional protocol interceptors

DefaultHttpClient client = new DefaultHttpClient();
client.addRequestInterceptor(new RequestAcceptEncoding());
client.addResponseInterceptor(new ResponseContentEncoding());

This is all it actually takes.

Oleg




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to