Since the content length of a gzipped response is unpredictable and it's potentially expensive and slow to compress it fully in memory first, then calculate the length and then stream the gzipped response from memory, the average webserver will send them in chunks using Transfer-Encoding: chunked without a Content-Length header.
Since the content length of a gzipped response is unpredictable and it's potentially expensive and slow to compress it fully in memory first, then calculate the length and then stream the gzipped response from memory, the average webserver will send them in chunks using Transfer-Encoding: chunked without a Content-Length header. Since it's a homegrown HTTP client, it sounds like as if it doesn't handle chunked requests correctly. You have to determine the Transfer-Encoding response header and if it equals to chunked, then you have to parse it as a chunked stream.
You can learn from the aforementioned HTTP spec links and from Wikipedia how to parse a chunked stream. Each chunk consists of a header denoting the chunk length in hexadecimal, then a CRLF, then the actual chunk content, then a CRLF. This is repeated until a chunk with a header denoting the chunk length of 0.
You need to ungzip the chunks separately and then glue them together. To save all the tedious coding work (likely also for the remnant of your homegrown HTTP client), I strongly recommend to have a look at Apache HttpComponents Client.
It works perfectly with other sites, and with this service if I turn gzipping off. I actually installed tomcat myself on my work machine and it fails to deliver content sometimes too. I would be happy to think that it's my issue, but if I use .
Net wrapper to call methods of this service (not my http implementation) it too fails to get full XML response sometimes just like mine client. Are you familiar with tomcat? – hoodoos Apr 8 '10 at 13:08 How are you sure that the problem is in Tomcat and not in the server side application running on Tomcat?
If we should look in this direction for the cause, then I would check if there isn't any Java (servlet) code which manually gzips the output using GzipOutputStream and if so, then check if it properly invokes close() on the outputstream. – BalusC Apr 8 '10 at 13:40 actually, it was really MY code doing chunks removal :) strange I didn't expirience with other webservers then tomcat! I will look further to find difference really.
– hoodoos Apr 12 '10 at 11:13.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.