Skip to content

total_time is lower than CURLOPT_TIMEOUT when request timed out #538

@lukasruzicka

Description

@lukasruzicka

Using request with CURLOPT_TIMEOUT = 1.
Then request is timed out and total_time is set to 0.204s as showed at output 1.

Without using CURLOPT_TIMEOUT, total_time is set properly as showed at output 2.

Version cURL used: 7.45.0

output 1

time curl -s --max-time 1 -w '\nLookup time:\t%{time_namelookup}\nConnect time:\t%{time_connect}\nPreXfer time:\t%{time_pretransfer}\nStartXfer time:\t%{time_starttransfer}\n\nTotal time:\t%{time_total}\n' -I http://www.url-that-timed-out-in-2-seconds.com

Lookup time:    0.003
Connect time:   0.003
PreXfer time:   0.004
StartXfer time: 0.000

Total time:     0.204

real    0m1.016s
user    0m0.005s
sys     0m0.011s

output 2

time curl -s -w '\nLookup time:\t%{time_namelookup}\nConnect time:\t%{time_connect}\nPreXfer time:\t%{time_pretransfer}\nStartXfer time:\t%{time_starttransfer}\n\nTotal time:\t%{time_total}\n' -I http://www.url-that-timed-out-in-2-seconds.com
HTTP/1.1 200 OK
Server: nginx/1.8.0
Date: Mon, 23 Nov 2015 16:02:50 GMT
Content-Type: text/html
Connection: keep-alive
Vary: Accept-Encoding


Lookup time:    0.003
Connect time:   0.003
PreXfer time:   0.003
StartXfer time: 2.004

Total time:     2.004

real    0m2.018s
user    0m0.006s
sys     0m0.008s

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions