@@ -98,9 +98,9 @@ public function request(string $method, string $url, array $options = []): Respo
98
98
'http_code ' => 0 ,
99
99
'redirect_count ' => 0 ,
100
100
'start_time ' => 0.0 ,
101
- 'fopen_time ' => 0.0 ,
102
101
'connect_time ' => 0.0 ,
103
102
'redirect_time ' => 0.0 ,
103
+ 'pretransfer_time ' => 0.0 ,
104
104
'starttransfer_time ' => 0.0 ,
105
105
'total_time ' => 0.0 ,
106
106
'namelookup_time ' => 0.0 ,
@@ -118,7 +118,7 @@ public function request(string $method, string $url, array $options = []): Respo
118
118
$ onProgress = static function (...$ progress ) use ($ onProgress , &$ lastProgress , &$ info ) {
119
119
$ progressInfo = $ info ;
120
120
$ progressInfo ['url ' ] = implode ('' , $ info ['url ' ]);
121
- unset($ progressInfo ['fopen_time ' ], $ progressInfo [ ' size_body ' ]);
121
+ unset($ progressInfo ['size_body ' ]);
122
122
123
123
if ($ progress && -1 === $ progress [0 ]) {
124
124
// Response completed
@@ -133,14 +133,14 @@ public function request(string $method, string $url, array $options = []): Respo
133
133
134
134
// Always register a notification callback to compute live stats about the response
135
135
$ notification = static function (int $ code , int $ severity , ?string $ msg , int $ msgCode , int $ dlNow , int $ dlSize ) use ($ onProgress , &$ info ) {
136
- $ now = microtime (true );
137
- $ info ['total_time ' ] = $ now - $ info ['start_time ' ];
136
+ $ info ['total_time ' ] = microtime (true ) - $ info ['start_time ' ];
138
137
139
138
if (STREAM_NOTIFY_PROGRESS === $ code ) {
139
+ $ info ['starttransfer_time ' ] = $ info ['starttransfer_time ' ] ?: $ info ['total_time ' ];
140
140
$ info ['size_upload ' ] += $ dlNow ? 0 : $ info ['size_body ' ];
141
141
$ info ['size_download ' ] = $ dlNow ;
142
142
} elseif (STREAM_NOTIFY_CONNECT === $ code ) {
143
- $ info ['connect_time ' ] + = $ now - $ info ['fopen_time ' ];
143
+ $ info ['connect_time ' ] = $ info ['total_time ' ];
144
144
$ info ['debug ' ] .= $ info ['request_header ' ];
145
145
unset($ info ['request_header ' ]);
146
146
} else {
@@ -310,7 +310,7 @@ private static function dnsResolve(array $url, NativeClientState $multi, array &
310
310
throw new TransportException (sprintf ('Could not resolve host "%s". ' , $ host ));
311
311
}
312
312
313
- $ info ['namelookup_time ' ] + = microtime (true ) - $ now ;
313
+ $ info ['namelookup_time ' ] = microtime (true ) - ( $ info [ ' <
10000
span class="pl-s x">start_time' ] ?: $ now) ;
314
314
$ multi ->dnsCache [$ host ] = $ ip = $ ip [0 ];
315
315
$ info ['debug ' ] .= "* Added {$ host }:0: {$ ip } to DNS cache \n" ;
316
316
} else {
@@ -368,10 +368,9 @@ private static function createRedirectResolver(array $options, string $host, ?ar
368
368
return null ;
369
369
}
370
370
371
- $ now = microtime (true );
372
371
$ info ['url ' ] = $ url ;
373
372
++$ info ['redirect_count ' ];
374
- $ info ['redirect_time ' ] = $ now - $ info ['start_time ' ];
373
+ $ info ['redirect_time ' ] = microtime ( true ) - $ info ['start_time ' ];
375
374
376
375
// Do like curl and browsers: turn POST to GET on 301, 302 and 303
377
376
if (\in_array ($ info ['http_code ' ], [301 , 302 , 303 ], true )) {
0 commit comments