Beautiful, I can integrate this easily into our library.
David Hay wrote:
I don't believe that HttpClient handles GZip or any other kind of decoding of the
reply content. That's up to the application using the library. Here's what we do to
handle the case when the server doesn't report the content type correctly:
if ( contentType == null || contentType.equals( "content/unknown" ) ) {
// Let's look for gzip data another way if we can
if ( urlStream.markSupported() ) {
urlStream.mark( 2 );
int id1 = urlStream.read();
int id2 = urlStream.read();
urlStream.reset();
// These numbers are magic. See the RFC 1952 Gzip File
// Format Specification located at:
// http://www.gzip.org/zlib/rfc-gzip.html
if ( id1 == 0x1F && id2 == 0x8B ) {
// we've got gzip data
contentType = "application/x-gzip-compressed";
}
}
}
if ( contentType != null && contentType.startsWith(
"application/x-gzip-compressed" ) ) {
urlStream = GZIPInputStream( urlStream );
}
-----Original Message-----
From: Mark R. Diggory [mailto:[EMAIL PROTECTED]
Sent: Friday, May 21, 2004 9:42 AM
To: Commons HttpClient Project
Subject: GZip encoding
We're having issues where content from our service is being sent GZip
encoded to the HttpClient, But with an error that its gzip transfer
encoding header isn't set properly by the server (thank our server
developer). Most browsers (and clients in perl etc) seem to catch this
error early and fall into GZip decoding. I would like to catch this
condition and have the client still gzip decode the stream. First, does
HttpClient support gzip decoding, and Second, is there a way I can force
to gzip decode if the header is broken?
thanks,
Mark
This email and any files transmitted with it are confidential and intended solely for
the use of the individual or entity to whom they are addressed. If you have received
this email in error please notify the system manager. This message contains
confidential information and is intended only for the individual named. If you are not
the named addressee you should not disseminate, distribute or copy this e-mail.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]