You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Samuel Liard <sa...@net-liard.com> on 2006/11/13 23:09:13 UTC
Response and gzip
Hy,
I receive an HTTP response but the content is in gzip format.
I can't read it... It try to use GZIPInputStream, but I just read 633 caracteres...Maybe a EOF is in this content...
What libraries did you use to read gzip stream ?
Thanks
Samuel
RE: Response and gzip
Posted by Julius Davies <ju...@cucbc.com>.
Oh wait, maybe I'm confused. You're the client, aren't you?
In that case, are you setting the "Accept-Encoding" header? Here's what my firefox sets:
Accept-Encoding: gzip,deflate
I've set that header in the past, and then just used Java's built in GZIPInputStream. Maybe try a few test runs against Google to make sure your client code is getting the hang of it.
yours,
Julius
-----Original Message-----
From: Julius Davies
Sent: Mon 11/13/2006 6:25 PM
To: HttpClient User Discussion; httpclient-user@jakarta.apache.org
Cc:
Subject: RE: Response and gzip
Hi, Samuel,
I would be surprised if the content actually has an EOF in the middle. That would trip up any program that tried to read it!
It's very rare for clients to send gzip encoded content in HTTP POST or PUT requests. It's much more common for the server to gzip encode the response (Google, for example), but for client to gzip the upload is very rare.
If you are sure that's what's happening, I do have some example code that does just that. Here's some example code for playing with gzip POST uploads and httpclient:
http://juliusdavies.ca/gzip-post-example/
Maybe it will help!
The lynchpin to the whole gzip operation is this header:
Content-Encoding: gzip
If you don't see that, then your content is probably not gzip encoded.
yours,
Julius Davies
http://juliusdavies.ca/
-----Original Message-----
From: Samuel Liard [mailto:samuel@net-liard.com]
Sent: Mon 11/13/2006 2:09 PM
To: httpclient-user@jakarta.apache.org
Cc:
Subject: Response and gzip
Hy,
I receive an HTTP response but the content is in gzip format.
I can't read it... It try to use GZIPInputStream, but I just read 633 caracteres...Maybe a EOF is in this content...
What libraries did you use to read gzip stream ?
Thanks
Samuel
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
RE: Response and gzip
Posted by Julius Davies <ju...@cucbc.com>.
Hi, Samuel,
I would be surprised if the content actually has an EOF in the middle. That would trip up any program that tried to read it!
It's very rare for clients to send gzip encoded content in HTTP POST or PUT requests. It's much more common for the server to gzip encode the response (Google, for example), but for client to gzip the upload is very rare.
If you are sure that's what's happening, I do have some example code that does just that. Here's some example code for playing with gzip POST uploads and httpclient:
http://juliusdavies.ca/gzip-post-example/
Maybe it will help!
The lynchpin to the whole gzip operation is this header:
Content-Encoding: gzip
If you don't see that, then your content is probably not gzip encoded.
yours,
Julius Davies
http://juliusdavies.ca/
-----Original Message-----
From: Samuel Liard [mailto:samuel@net-liard.com]
Sent: Mon 11/13/2006 2:09 PM
To: httpclient-user@jakarta.apache.org
Cc:
Subject: Response and gzip
Hy,
I receive an HTTP response but the content is in gzip format.
I can't read it... It try to use GZIPInputStream, but I just read 633 caracteres...Maybe a EOF is in this content...
What libraries did you use to read gzip stream ?
Thanks
Samuel
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org