Skip to content

Inconsistent appconnect_time reporting over HTTP #3760

@1ma

Description

@1ma

I did this

# Make 2 HTTPS requests, reusing the connection
$ curl -s -w@curl-format.txt -o /dev/null https://www.google.com/ -o /dev/null https://www.google.com/
    time_namelookup:  0.001085
       time_connect:  0.010285
    time_appconnect:  0.063561
   time_pretransfer:  0.063676
 time_starttransfer:  0.126158
                    ----------
         time_total:  0.128053

    time_namelookup:  0.000031
       time_connect:  0.000032
    time_appconnect:  0.000032
   time_pretransfer:  0.000085
 time_starttransfer:  0.080010
                    ----------
         time_total:  0.082248


# Make 2 HTTP requests, reusing the connection
$ curl -s -w@curl-format.txt -o /dev/null http://www.google.com/ -o /dev/null http://www.google.com/
    time_namelookup:  0.001781
       time_connect:  0.010850
    time_appconnect:  0.000000
   time_pretransfer:  0.010889
 time_starttransfer:  0.072396
                    ----------
         time_total:  0.081564

    time_namelookup:  0.000031
       time_connect:  0.000032
    time_appconnect:  0.000032
   time_pretransfer:  0.000080
 time_starttransfer:  0.068770
                    ----------
         time_total:  0.071535

Contents of curl-format.txt:

    time_namelookup:  %{time_namelookup}\n
       time_connect:  %{time_connect}\n
    time_appconnect:  %{time_appconnect}\n
   time_pretransfer:  %{time_pretransfer}\n
 time_starttransfer:  %{time_starttransfer}\n
                    ----------\n
         time_total:  %{time_total}\n\n

I expected the following

On the second run the appconnect_time of the first request should have been 0.010850 instead of 0.000000.

The documentation states that appconnect_time is "the time, in seconds, it took from the start until the SSL/SSH connect/handshake to the remote host was completed". However, seems that when cURL has to open a new TCP connection and the protocol is plain HTTP the reported timing is just 0.

curl/libcurl version

curl 7.64.0 (x86_64-alpine-linux-musl) libcurl/7.64.0 OpenSSL/1.1.1b zlib/1.2.11 libssh2/1.8.2 nghttp2/1.35.1
Release-Date: 2019-02-06
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy

operating system

Alpine Linux 3.9.3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions