hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Morris, Chris" <Chris.Mor...@epsilon.com>
Subject RE: HTTP Response contains headers last
Date Thu, 27 Sep 2007 16:24:05 GMT
Thanks Roland!  That aligns with my conclusion as well.

I'm working on a workaround using the HttpURLConnection (java.util.net)
class.  It's probably no where near as elegant or bullet proof as
HttpClient, but at least I have direct access to the input stream so
that I can parse it myself.

If you're interested, the server actually sends the headers last on
purpose.  Reason being, it includes a header field containing a record
count.  I don't think it's worth all the trouble that this has caused
me.  I'd much rather make a second API call to get the record count then
have to deal with this, but, that's the way it is for now!

Thanks again for your help!

Chris Morris

-----Original Message-----
From: Roland Weber [mailto:ossfwot@dubioso.net] 
Sent: Thursday, September 27, 2007 10:16 AM
To: HttpClient User Discussion
Subject: Re: HTTP Response contains headers last

Hello Chris,

that server is not only sending the headers last.
It is sending the whole head section of the HTTP
response after the body. That is not HTTP at all.
Not even close.
Even though the supposed body is listed in the
output as "headers", that's not what HttpClient
makes of it. HttpClient simply skips garbage
lines at the beginning of a response, until it
finds the line starting with "HTTP/1.1". Then,
it reads in the head section. And then, it would
try to read the body, except that there is none.
There is not even the required empty line that
terminates the head section.

I have two explanations for this. One: the server
is using persistent connections, but gets confused
by something the client does. That could happen if
you use the SimpleHttpConnectionManager from multiple
threads. But if that log is the full log of a test
run, that's not what happens.
Two: the server is totally screwed and has no idea
of what HTTP specifies. In that case, you're best
off by connecting directly to the server using a
Socket. I'm sorry, but that behavior is way too far
off to tweak HttpClient into tolerance.

cheers,
  Roland

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
The information contained in this communication is
confidential, and is intended only for the sole use of
the recipient named above. If the reader of this
message is not the intended recipient, you are hereby
notified that any dissemination, distribution, or copying
of this communication is strictly prohibited. If you have
received this communication in error, please re-send
this communication to the sender and delete the original
message or any copy of it from your computer system.
Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Mime
View raw message