curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: HTTP request timeout and multi interface

From: Andrei Bica via curl-library <curl-library_at_cool.haxx.se>
Date: Fri, 12 Mar 2021 15:45:20 +0200

I've managed to produce this behavior by using a modified multi-poll.c
example (see https://pastebin.com/3iua80G8) which makes 10 HTTP requests to
"example.org:8200", set CURLOPT_TIMEOUT_MS to 1000 for each request and
CURLMOPT_MAX_TOTAL_CONNECTIONS to 1 for the multi handle.

I've used iptables to drop all packets going to URL address:
    iptables -A OUTPUT -p tcp --destination-port 8200 -j DROP

I would expect the runtime to be around 1000 ms (the value of
CURLOPT_TIMEOUT_MS), but instead I get a runtime of about 7000 ms.

On Mon, Mar 8, 2021 at 11:47 PM Daniel Stenberg <daniel_at_haxx.se> wrote:

> On Mon, 8 Mar 2021, Andrei Bica via curl-library wrote:
>
> > By using CURLOPT_TIMEOUT we can only set the transfer timeout, which
> doesn't
> > include the time it waits for the transfer to begin.
>
> I believe this is wrong.
>
> CURLOPT_TIMEOUT sets the maximum time allowed for the entire operation to
> use,
> no matter what state the transfer is in and how long it waits in what
> queues.
>
> Technically, it means that the timeout value is counted from the
> TIMER_STARTOP
> time-stamp which is set in the INIT state, before the transfer gets queued
> up
> in the PENDING state waiting for a connection.
>
> --
>
> / daniel.haxx.se
> | Commercial curl support up to 24x7 is available!
> | Private help, bug fixes, support, ports, new features
> | https://www.wolfssl.com/contact/
>


-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.se/mail/etiquette.html
Received on 2021-03-12