File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes HTTP content-encoding / transfer-encoding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "HTTP content-encoding / transfer-encoding" Watch "HTTP content-encoding / transfer-encoding" New topic
Author

HTTP content-encoding / transfer-encoding

Craig Taylor
Ranch Hand

Joined: Jul 17, 2008
Posts: 64
I've been looking over the RFC and am a bit confused over how responses that have both a content-encoding and a transfer-encoding are transmitted.

Is it :

Option A:


Or

Option B


(OB Disclaimer: Examples not meant to be accurate - adjust examples as appropriate for spacing / formatting etc .... )
Gamini Sirisena
Ranch Hand

Joined: Aug 05, 2008
Posts: 347
Your question is not too clear.. but..

from the following..
3.6 Transfer Codings

Transfer-coding values are used to indicate an encoding transformation that has been, can be, or may need to be applied to an entity-body in order to ensure "safe transport" through the network. This differs from a content coding in that the transfer-coding is a property of the message, not of the original entity.


found at the w3c

It seems to suggest that in the case of chunked encoding for Transfer-Encoding is applied on top of the whole entity body encoded with a Content-Encoding. So the whole entity body has to be assembled first before decoding with the Content-Encoding.

This wikipedia article says the same thing...
Craig Taylor
Ranch Hand

Joined: Jul 17, 2008
Posts: 64
From that, I'm to conclude that the following rough format is valid:



Now, given that's the format of a chunk accept-encoding - how is the compression applied to it? Is compression only applied to the compressed data portions or to the whole message.

In other words, which of the following algorithms is correct:
getContent().getGUnzip().getChunks()

or
getContent().getChunks().combine().getGUnzip().uncombine()

where combine() and uncombine() record the length of the chunk portions and combine or uncombine them into one binary chunk.

Thanks,
Craig Taylor
Ranch Hand

Joined: Jul 17, 2008
Posts: 64
Just to followup - I saw your posting about this question at http://archives.free.net.ph/message/20090713.040925.99228eb7.en.html .... Thanks for following up and finding where to find the answer...

Thanks,

Gamini Sirisena
Ranch Hand

Joined: Aug 05, 2008
Posts: 347
Hi Craig,
Sorry for not updating earlier. I posted your (our ) doubt to the httpd users list.

You've already seen the answer. However, if I was working on an http implementation I would still be confused. I was going through the BNF and the "augmented BNF" that the http 1.1 spec is using. I'll be spending a bit more time trying figure out for sure how to derive the solution to this problem.
Alexandre de Paula
Greenhorn

Joined: May 15, 2006
Posts: 8
Same problem here. I think (but not sure yet) that I unchunked message body but I can't unzip it. I have already tried to unzip chunk by chunk and all assembled chunks, but I have failed both ways.
Alexandre de Paula
Greenhorn

Joined: May 15, 2006
Posts: 8
I think I figured it out.
I assembled all chunks and then I could unzip the message. My mistake was ignoring the two last bytes after reading the zero-sized chunk!


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTTP content-encoding / transfer-encoding
 
Similar Threads
Passing a date
Cross-Browser Dropdown List
while handling the SOAP message Content-Transfer-Encoding is missing.
Want to understand SOAP Exception's meaning?
Help wanted on control select/option by javascript