cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Timout in HTTP data transfer

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Thu, 18 Nov 2010 22:14:51 -0800

On Fri, Nov 19, 2010 at 10:22:30AM +0530, arnuld uttre wrote:
> libcurl is waiting for the data from HTTP server, here is the output
> from CURLOPT_VERBOSE, Between Accept: */* and <HTTP/1.1 200 OK its
> waits for 60 seconds only even when CURLOPT_TIMEOUT is set to 100L or
> 80L or 101L etc.

But what about 50L or 20L? That would show if the timeout mechanism is
even working on your platform (I don't think yo said what it is).

> [arnuld_at_dune CBL]$ ./BC.out
> Fri Nov 19 10:15:53 2010: [LOG_DEBG]: Started Thread
> * About to connect() to localhost port 80
> * Trying 127.0.0.1... * connected
> * Connected to localhost (127.0.0.1) port 80
> > GET /recv_data_after_one_min.php HTTP/1.1
> Host: localhost
> Accept: */*
>
>
> < HTTP/1.1 200 OK
> < Date: Fri, 19 Nov 2010 04:45:53 GMT
> < Server: Apache/2.2.3 (CentOS)
> < X-Powered-By: PHP/5.1.6
> < Content-Length: 0
> < Connection: close
> < Content-Type: text/html; charset=UTF-8
> * Closing connection #0

I'm assuming libcurl waits for 60 seconds just before printing that
last line, right? Since libcurl doesn't print a timeout log message here,
I think it's the remote server that's the one closing the connection. A
Wireshark or similar trace would show that for sure. That would certainly
match the symptoms you're seeing. Setting a value < 60 seconds as a timeout
would cause the debug logs show that it's libcurl timing out if this
hypothesis is true.
>
> I tried chaning the values (with a L in the end for long) but result
> is same. DNS lookups I don't know because connection is already made,
> only data transfer is taking place. I have configured the php
> application to wait for 60 sec before sending data when a request is
> made by libcurl, if I configure it to send data immediatly as soon as
> request is made then libcurl receives data without any problems, so I
> don't think DNS lookup is the issue here.

It's not a DNS lookup because not only is the connection being made, but
the server even sends part of a reply. It wouldn't surprise me if there's
a bug in the app that closes the connection after 60 sec. instead of sending
data, or perhaps Apache is closing the connection 60 seconds after the app
becomes (apparently) nonresponsive.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-11-19