cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker Archives

[curl:bugs] #1272 separate connect timeout and total timeout

From: he qin <hqin6_at_users.sf.net>
Date: Thu, 29 Aug 2013 09:41:44 +0000

Now I edit the curl-7.31.0 code:

lib/connect.c: Curl_timeleft function : Line 206

switch (timeout_set) {
  case 1:
    timeout_ms = data->set.timeout;
    break;
  case 2:
    timeout_ms = data->set.connecttimeout;
    break;
  case 3:
    if (nowp) { // add this
       data->set.timeout += data->set.connecttimeout;// add this
    }// add this
    if(data->set.timeout < data->set.connecttimeout)
      timeout_ms = data->set.timeout;
    else
      timeout_ms = data->set.connecttimeout;
    break;

If edit the code as above, the timeout is not total timeout , but is transfer timeout.
I think curl can supply an interface that we can set the transfer timeout. such as

curl_easy_setopt(curl, CULROPT_TRANSFER_TIMEOUT, 100);

this is particularly useful for keep alive connection.

how do you think?

---
** [bugs:#1272] separate connect timeout and total timeout **
**Status:** open
**Created:** Thu Aug 29, 2013 09:31 AM UTC by he qin
**Last Updated:** Thu Aug 29, 2013 09:31 AM UTC
**Owner:** nobody
hi,
When I use libcurl, I want separate connect timeout and total timeout. Because when I use keep-alive for connection,  I want to set the different time for connect timeout and transfer timeout. But curl just has CURLOPT_CONNECTTIMEOUT_MS & CURLOPT_TIMEOUT_MS which is set just for connect timeout and total timeout. 
For example, keep-alive,  I want to connect an addr, and it will spend 40ms in network from client to server. If I set total timeout is 60ms, then I can't get anything from server, because tcp connect will spend 40ms and the real data transfer will spend 40ms. But if I can set connect timeout to 60ms and transfer timeout to 60ms, so I can connect the server and get some real data, because tcp connect can complete in 60ms, and transfer data can cpmplete in 60ms too.
I can't set the CURLOPT_TIMEOUT_MS  too long, because I must protect my client.
---
Sent from sourceforge.net because curl-tracker@cool.haxx.se is subscribed to https://sourceforge.net/p/curl/bugs/
To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/curl/admin/bugs/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.
Received on 2013-08-29

These mail archives are generated by hypermail.

donate! Page updated May 06, 2013.
web site info

File upload with ASP.NET