@@ -55,7 +55,7 @@ public function __construct(array $defaultOptions = [], int $maxHostConnections
55
55
}
56
56
57
57
$ this ->multi = new NativeClientState ();
58
- $ this ->multi ->maxHostConnections = 0 < $ maxHostConnections ? $ maxHostConnections : PHP_INT_MAX ;
58
+ $ this ->multi ->maxHostConnections = 0 < $ maxHostConnections ? $ maxHostConnections : \ PHP_INT_MAX ;
59
59
}
60
60
61
61
/**
@@ -116,7 +116,7 @@ public function request(string $method, string $url, array $options = []): Respo
116
116
if ($ onProgress = $ options ['on_progress ' ]) {
117
117
// Memoize the last progress to ease calling the callback periodically when no network transfer happens
118
118
$ lastProgress = [0 , 0 ];
119
- $ maxDuration = 0 < $ options ['max_duration ' ] ? $ options ['max_duration ' ] : INF ;
119
+ $ maxDuration = 0 < $ options ['max_duration ' ] ? $ options ['max_duration ' ] : \ INF ;
120
120
$ onProgress = static function (...$ progress ) use ($ onProgress , &$ lastProgress , &$ info , $ maxDuration ) {
121
121
if ($ info ['total_time ' ] >= $ maxDuration ) {
122
122
throw new TransportException (sprintf ('Max duration was reached for "%s". ' , implode ('' , $ info ['url ' ])));
@@ -148,11 +148,11 @@ public function request(string $method, string $url, array $options = []): Respo
148
148
$ notification = static function (int $ code , int $ severity , ?string $ msg , int $ msgCode , int $ dlNow , int $ dlSize ) use ($ onProgress , &$ info ) {
149
149
$ info ['total_time ' ] = microtime (true ) - $ info ['start_time ' ];
150
150
151
- if (STREAM_NOTIFY_PROGRESS === $ code ) {
151
+ if (\ STREAM_NOTIFY_PROGRESS === $ code ) {
152
152
$ info ['starttransfer_time ' ] = $ info ['starttransfer_time ' ] ?: $ info ['total_time ' ];
153
153
$ info ['size_upload ' ] += $ dlNow ? 0 : $ info ['size_body ' ];
154
154
$ info ['size_download ' ] = $ dlNow ;
155
- } elseif (STREAM_NOTIFY_CONNECT === $ code ) {
155
+ } elseif (\ STREAM_NOTIFY_CONNECT === $ code ) {
156
156
$ info ['connect_time ' ] = $ info ['total_time ' ];
157
157
$ info ['debug ' ] .= $ info ['request_header ' ];
158
158
unset($ info ['request_header ' ]);
@@ -310,14 +310,14 @@ private static function getProxy(?string $proxy, array $url): ?array
310
310
*/
311
311
private static function dnsResolve (array $ url , NativeClientState $ multi , array &$ info , ?\Closure $ onProgress ): array
312
312
{
313
- if ($ port = parse_url ($ url ['authority ' ], PHP_URL_PORT ) ?: '' ) {
313
+ if ($ port = parse_url ($ url ['authority ' ], \ PHP_URL_PORT ) ?: '' ) {
314
314
$ info ['primary_port ' ] = $ port ;
315
315
$ port = ': ' .$ port ;
316
316
} else {
317
317
$ info ['primary_port ' ] = 'http: ' === $ url ['scheme ' ] ? 80 : 443 ;
318
318
}
319
319
320
- $ host = parse_url ($ url ['authority ' ], PHP_URL_HOST );
320
+ $ host = parse_url ($ url ['authority ' ], \ PHP_URL_HOST );
321
321
322
322
if (null === $ ip = $ multi ->dnsCache [$ host ] ?? null ) {
323
323
$ info ['debug ' ] .= "* Hostname was NOT found in DNS cache \n" ;
@@ -407,7 +407,7 @@ private static function createRedirectResolver(array $options, string $host, ?ar
407
407
[$ host , $ port , $ url ['authority ' ]] = self ::dnsResolve ($ url , $ multi , $ info , $ onProgress );
408
408
stream_context_set_option ($ context , 'ssl ' , 'peer_name ' , $ host );
409
409
410
- if (false !== (parse_url ($ location , PHP_URL_HOST ) ?? false )) {
410
+ if (false !== (parse_url ($ location , \ PHP_URL_HOST ) ?? false )) {
411
411
// Authorization and Cookie headers MUST NOT follow except for the initial host name
412
412
$ requestHeaders = $ redirectHeaders ['host ' ] === $ host ? $ redirectHeaders ['with_auth ' ] : $ redirectHeaders ['no_auth ' ];
413
413
$ requestHeaders [] = 'Host: ' .$ host .$ port ;
0 commit comments