@@ -95,10 +95,7 @@ public function request(string $method, string $url, array $options = []): Respo
95
95
$ scheme = $ url ['scheme ' ];
96
96
$ authority = $ url ['authority ' ];
97
97
$ host = parse_url ($ authority , \PHP_URL_HOST );
98
- $ proxy = $ options ['proxy ' ]
99
- ?? ('https: ' === $ url ['scheme ' ] ? $ _SERVER ['https_proxy ' ] ?? $ _SERVER ['HTTPS_PROXY ' ] ?? null : null )
100
- // Ignore HTTP_PROXY except on the CLI to work around httpoxy set of vulnerabilities
101
- ?? $ _SERVER ['http_proxy ' ] ?? (\in_array (\PHP_SAPI , ['cli ' , 'phpdbg ' ], true ) ? $ _SERVER ['HTTP_PROXY ' ] ?? null : null ) ?? $ _SERVER ['all_proxy ' ] ?? $ _SERVER ['ALL_PROXY ' ] ?? null ;
98
+ $ proxy = self ::getProxyUrl ($ options ['proxy ' ], $ url );
102
99
$ url = implode ('' , $ url );
103
100
104
101
if (!isset ($ options ['normalized_headers ' ]['user-agent ' ])) {
@@ -411,7 +408,7 @@ private static function createRedirectResolver(array $options, string $host): \C
411
408
}
412
409
}
413
410
414
- return static function ($ ch , string $ location , bool $ noContent ) use (&$ redirectHeaders ) {
411
+ return static function ($ ch , string $ location , bool $ noContent ) use (&$ redirectHeaders, $ options ) {
415
412
try {
416
413
$ location = self ::parseUrl ($ location );
417
414
} catch (InvalidArgumentException $ e ) {
@@ -436,11 +433,7 @@ private static function createRedirectResolver(array $options, string $host): \C
436
433
$ url = self ::parseUrl (curl_getinfo ($ ch , \CURLINFO_EFFECTIVE_URL ));
437
434
$ url = self ::resolveUrl ($ location , $ url );
438
435
439
- curl_setopt ($ ch , \CURLOPT_PROXY , $ options ['proxy ' ]
440
- ?? ('https: ' === $ url ['scheme ' ] ? $ _SERVER ['https_proxy ' ] ?? $ _SERVER ['HTTPS_PROXY ' ] ?? null : null )
441
- // Ignore HTTP_PROXY except on the CLI to work around httpoxy set of vulnerabilities
442
- ?? $ _SERVER ['http_proxy ' ] ?? (\in_array (\PHP_SAPI , ['cli ' , 'phpdbg ' ], true ) ? $ _SERVER ['HTTP_PROXY ' ] ?? null : null ) ?? $ _SERVER ['all_proxy ' ] ?? $ _SERVER ['ALL_PROXY ' ] ?? null
443
- );
436
+ curl_setopt ($ ch , \CURLOPT_PROXY , self ::getProxyUrl ($ options ['proxy ' ], $ url ));
444
437
445
438
return implode ('' , $ url );
446
439
};
0 commit comments