cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Windows bug assistance needed

From: Andrés García <fandom_at_retemail.es>
Date: Wed, 20 Feb 2002 14:34:16 +0100

Hi,

> We have this bug report that identifies a problem with -I and -w with
> time_total with curl 7.9.4 on a Windows machine.
>
> As noted below, I can't repeat this problem on my test machines (none of
> them being Windows).

I have tested this using the command:

curl -w "time= %{time_total}" http://slashdot.org -I

The problem seems to be that in Windows the function
Curl_readwrite is only invoked once, all the headers get
read in one single pass, so it reaches:

            if(!k->header) {
              /*
               * really end-of-headers.
               *
               * If we requested a "no body", this is a good time to get
               * out and return home.
               */
              bool stop_reading = FALSE;

              if(data->set.no_body) {
                stop_reading = TRUE;
              }
...

and the function returns without ever going to Curl_pgrsUpdate, so the
total time never gets set.

In Linux though it takes two passes through Curl_readwrite to read all
the headers and so Curl_pgrsUpdate is invoked at least once.

And easy way to solve this can be doing:

    if(data->set.no_body) {
        stop_reading = TRUE;
        Curl_pgrsUpdate(conn);
    }

forcing a final update before returning from Curl_readwrite, I have tried in
Windows and Linux and it seems to work.

Andres
Received on 2002-02-20