@@ -89,10 +89,7 @@ public function request(string $method, string $url, array $options = []): Respo
89
89
$ authority = $ url ['authority ' ];
90
90
$ host = parse_url ($ authority , \PHP_URL_HOST );
91
91
$ port = parse_url ($ authority , \PHP_URL_PORT ) ?: ('http: ' === $ scheme ? 80 : 443 );
92
- $ proxy = $ options ['proxy ' ]
93
- ?? ('https: ' === $ url ['scheme ' ] ? $ _SERVER ['https_proxy ' ] ?? $ _SERVER ['HTTPS_PROXY ' ] ?? null : null )
94
- // Ignore HTTP_PROXY except on the CLI to work around httpoxy set of vulnerabilities
95
- ?? $ _SERVER ['http_proxy ' ] ?? (\in_array (\PHP_SAPI , ['cli ' , 'phpdbg ' ], true ) ? $ _SERVER ['HTTP_PROXY ' ] ?? null : null ) ?? $ _SERVER ['all_proxy ' ] ?? $ _SERVER ['ALL_PROXY ' ] ?? null ;
92
+ $ proxy = self ::getProxyUrl ($ options ['proxy ' ], $ url );
96
93
$ url = implode ('' , $ url );
97
94
98
95
if (!isset ($ options ['normalized_headers ' ]['user-agent ' ])) {
@@ -400,7 +397,7 @@ private static function createRedirectResolver(array $options, string $host, int
400
397
}
401
398
}
402
399
403
- return static function ($ ch , string $ location , bool $ noContent ) use (&$ redirectHeaders ) {
400
+ return static function ($ ch , string $ location , bool $ noContent ) use (&$ redirectHeaders, $ options ) {
404
401
try {
405
402
$ location = self ::parseUrl ($ location );
406
403
} catch (InvalidArgumentException ) {
@@ -426,11 +423,7 @@ private static function createRedirectResolver(array $options, string $host, int
426
423
$ url = self ::parseUrl (curl_getinfo ($ ch , \CURLINFO_EFFECTIVE_URL ));
427
424
$ url = self ::resolveUrl ($ location , $ url );
428
425
429
- curl_setopt ($ ch , \CURLOPT_PROXY , $ options ['proxy ' ]
430
- ?? ('https: ' === $ url ['scheme ' ] ? $ _SERVER ['https_proxy ' ] ?? $ _SERVER ['HTTPS_PROXY ' ] ?? null : null )
431
- // Ignore HTTP_PROXY except on the CLI to work around httpoxy set of vulnerabilities
432
- ?? $ _SERVER ['http_proxy ' ] ?? (\in_array (\PHP_SAPI , ['cli ' , 'phpdbg ' ], true ) ? $ _SERVER ['HTTP_PROXY ' ] ?? null : null ) ?? $ _SERVER ['all_proxy ' ] ?? $ _SERVER ['ALL_PROXY ' ] ?? null
433
- );
426
+ curl_setopt ($ ch , \CURLOPT_PROXY , self ::getProxyUrl ($ options ['proxy ' ], $ url ));
434
427
435
428
return implode ('' , $ url );
436
429
};
0 commit comments