cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_easy_perform hangs on 7.9.8

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 2 Jun 2003 14:59:44 +0200 (CEST)

On Wed, 28 May 2003 RBramante_at_on.com wrote:

> I just hit this weird condition with 7.9.8. I haven't tried it with the
> latest yet, and it's not clear to me if the problem is curl vs. with the
> server response header. Any thoughts?

I've read the other mails in this thread, I'm replying to your initial mail
though since I can quote better here. I was gone for a few days and couldn't
reply sooner...

> Basically, I've started to hit a scenario where curl hangs until its IO
> timeout if the server responds with something like the following:
>
> HTTP/1.1 400 Bad Request
> Content-Type: text/html
> Date: Wed, 28 May 2003 18:37:02 GMT
> Connection: close
> Server: Apache Tomcat/4.0.3 (HTTP/1.1 Connector)
>
> eventually perform will return 28 "Operation timed out with 0 out of -1
> bytes received"

(In later mails you noted that this also happens using libcurl 7.10.5.)

In your original test, this didn't close the socket after this response? If
so, what did you expect libcurl to do? It says "Connection: close" and
there's no content-length, which to my understanding basicly means that the
client should keep on reading everything until the server closes the
connection. The client has no other means of knowing when the server has sent
everything it wants to send. HTTP error code 400 is not forbidden to include
a body-part (in fact RFC2616 says "the server SHOULD include an entity") so
we can't bluntly stop reading after the headers either.

I wrote up a quick test case that returned these headers as shown above, and
then the server immediately closed the socket. Then curl stopped reading at
once and return back quite as expected. You mentioned a different test result
when you close the socket immediately after this response. Can you provide a
test setup for me?

I can commit my test case for this to CVS in case it'll help.

-- 
 Daniel Stenberg -- curl: been grokking URLs since 1998
-------------------------------------------------------
This SF.net email is sponsored by: eBay
Get office equipment for less on eBay!
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
Received on 2003-06-02