hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Samuel Liard <sam...@net-liard.com>
Subject RE: Response and gzip
Date Tue, 14 Nov 2006 11:15:12 GMT
Yes, I'm the client.

I made a POST request to the server and I use :
   post.setRequestHeader( "Content-Encoding", "gzip" );
And I have problem when I read the response with GZIPInputStream.

But I don't why I ask a gzip encoding... I don't need it ! :)
So I just delete the line setRequestHeader.

Thank's

Samuel
 

-----Original Message-----
From:	Julius Davies
Sent:	Mon 11/13/2006 6:30 PM
To:	HttpClient User Discussion; httpclient-user@jakarta.apache.org
Cc:	
Subject:	RE: Response and gzip

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




Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message