@@ -89,10 +89,7 @@ public function request(string $method, string $url, array $options = []): Respo
8989 $ authority = $ url ['authority ' ];
9090 $ host = parse_url ($ authority , \PHP_URL_HOST );
9191 $ 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 );
9693 $ url = implode ('' , $ url );
9794
9895 if (!isset ($ options ['normalized_headers ' ]['user-agent ' ])) {
@@ -400,7 +397,7 @@ private static function createRedirectResolver(array $options, string $host, int
400397 }
401398 }
402399
403- return static function ($ ch , string $ location , bool $ noContent ) use (&$ redirectHeaders ) {
400+ return static function ($ ch , string $ location , bool $ noContent ) use (&$ redirectHeaders, $ options ) {
404401 try {
405402 $ location = self ::parseUrl ($ location );
406403 } catch (InvalidArgumentException ) {
@@ -426,11 +423,7 @@ private static function createRedirectResolver(array $options, string $host, int
426423 $ url = self ::parseUrl (curl_getinfo ($ ch , \CURLINFO_EFFECTIVE_URL ));
427424 $ url = self ::resolveUrl ($ location , $ url );
428425
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 ));
434427
435428 return implode ('' , $ url );
436429 };
0 commit comments