Commit 91386937 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

- Michael Wallner provided a patch that adds support for CURLOPT_TIMEOUT_MS

  and CURLOPT_CONNECTTIMEOUT_MS that, as their names should hint, do the
  timeouts with millisecond resolution instead. The only restriction to that
  is the alarm() (sometimes) used to abort name resolves as that uses full
  seconds. I fixed the FTP response timeout part of the patch.

  Internally we now count and keep the timeouts in milliseconds but it also
  means we multiply set timeouts with 1000. The effect of this is that no
  timeout can be set to more than 2^31 milliseconds (on 32 bit systems), which
  equals 24.86 days.  We probably couldn't before either since the code did
  *1000 on the timeout values on several places already.
parent 0fc51ac5
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -6,6 +6,19 @@

                                  Changelog

Daniel (5 February 2007)
- Michael Wallner added support for CURLOPT_TIMEOUT_MS and
  CURLOPT_CONNECTTIMEOUT_MS that, as their names suggest, do the timeouts with
  millisecond resolution. The only restriction to that is the alarm()
  (sometimes) used to abort name resolves as that uses full seconds. I fixed
  the FTP response timeout part of the patch.

  Internally we now count and keep the timeouts in milliseconds but it also
  means we multiply set timeouts with 1000. The effect of this is that no
  timeout can be set to more than 2^31 milliseconds (on 32 bit systems), which
  equals 24.86 days.  We probably couldn't before either since the code did
  *1000 on the timeout values on several places already.

Daniel (3 February 2007)
- Yang Tse fixed the cookie expiry date in several test cases that started to
  fail since they used "1 feb 2007"...
+2 −2
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ Curl and libcurl 7.16.2

This release includes the following changes:
 
 o
 o Added CURLOPT_TIMEOUT_MS and CURLOPT_CONNECTTIMEOUT_MS

This release includes the following bugfixes:

@@ -33,6 +33,6 @@ New curl mirrors:
This release would not have looked like this without help, code, reports and
advice from friends like these:

 Yang Tse, Manfred Schwarb
 Yang Tse, Manfred Schwarb, Michael Wallner

        Thanks! (and sorry if I forgot to mention someone)
+9 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@
.\" * $Id$
.\" **************************************************************************
.\"
.TH curl_easy_setopt 3 "2 Nov 2006" "libcurl 7.16.1" "libcurl Manual"
.TH curl_easy_setopt 3 "5 Feb 2007" "libcurl 7.16.2" "libcurl Manual"
.SH NAME
curl_easy_setopt \- set options for a curl easy handle
.SH SYNOPSIS
@@ -1078,6 +1078,10 @@ SIGALRM to enable time-outing system calls.

In unix-like systems, this might cause signals to be used unless
\fICURLOPT_NOSIGNAL\fP is set.
.IP CURLOPT_TIMEOUT_MS
Like \fICURLOPT_TIMEOUT\fP but takes number of milliseconds instead. If
libcurl is built to use the standard system name resolver, that part will
still use full-second resolution for timeouts. (Added in 7.16.2)
.IP CURLOPT_LOW_SPEED_LIMIT
Pass a long as parameter. It contains the transfer speed in bytes per second
that the transfer should be below during \fICURLOPT_LOW_SPEED_TIME\fP seconds
@@ -1135,6 +1139,10 @@ timeouts). See also the \fICURLOPT_TIMEOUT\fP option.

In unix-like systems, this might cause signals to be used unless
\fICURLOPT_NOSIGNAL\fP is set.
.IP CURLOPT_CONNECTTIMEOUT_MS
Like \fICURLOPT_CONNECTTIMEOUT\fP but takes number of milliseconds instead. If
libcurl is built to use the standard system name resolver, that part will
still use full-second resolution for timeouts. (Added in 7.16.2)
.IP CURLOPT_IPRESOLVE
Allows an application to select what kind of IP addresses to use when
resolving host names. This is only interesting when using host names that
+4 −0
Original line number Diff line number Diff line
@@ -1054,6 +1054,10 @@ typedef enum {
  /* Send CCC (Clear Command Channel) after authentication */
  CINIT(FTP_SSL_CCC, LONG, 154),

  /* Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */
  CINIT(TIMEOUT_MS, LONG, 155),
  CINIT(CONNECTTIMEOUT_MS, LONG, 156),

  CURLOPT_LASTENTRY /* the last unused */
} CURLoption;

+9 −9
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
 *                            | (__| |_| |  _ <| |___
 *                             \___|\___/|_| \_\_____|
 *
 * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
 * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution. The terms
@@ -558,15 +558,15 @@ CURLcode Curl_is_connected(struct connectdata *conn,
  /* subtract the most strict timeout of the ones */
  if(data->set.timeout && data->set.connecttimeout) {
    if (data->set.timeout < data->set.connecttimeout)
      allow_total = allow = data->set.timeout*1000;
      allow_total = allow = data->set.timeout;
    else
      allow = data->set.connecttimeout*1000;
      allow = data->set.connecttimeout;
  }
  else if(data->set.timeout) {
    allow_total = allow = data->set.timeout*1000;
    allow_total = allow = data->set.timeout;
  }
  else if(data->set.connecttimeout) {
    allow = data->set.connecttimeout*1000;
    allow = data->set.connecttimeout;
  }

  if(has_passed > allow ) {
@@ -826,14 +826,14 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
    /* get the most strict timeout of the ones converted to milliseconds */
    if(data->set.timeout && data->set.connecttimeout) {
      if (data->set.timeout < data->set.connecttimeout)
        timeout_ms = data->set.timeout*1000;
        timeout_ms = data->set.timeout;
      else
        timeout_ms = data->set.connecttimeout*1000;
        timeout_ms = data->set.connecttimeout;
    }
    else if(data->set.timeout)
      timeout_ms = data->set.timeout*1000;
      timeout_ms = data->set.timeout;
    else
      timeout_ms = data->set.connecttimeout*1000;
      timeout_ms = data->set.connecttimeout;

    /* subtract the passed time */
    timeout_ms -= has_passed;
Loading