@@ -95,10 +95,7 @@ public function request(string $method, string $url, array $options = []): Respo
9595 $ scheme = $ url ['scheme ' ];
9696 $ authority = $ url ['authority ' ];
9797 $ 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 );
10299 $ url = implode ('' , $ url );
103100
104101 if (!isset ($ options ['normalized_headers ' ]['user-agent ' ])) {
@@ -411,7 +408,7 @@ private static function createRedirectResolver(array $options, string $host): \C
411408 }
412409 }
413410
414- return static function ($ ch , string $ location , bool $ noContent ) use (&$ redirectHeaders ) {
411+ return static function ($ ch , string $ location , bool $ noContent ) use (&$ redirectHeaders, $ options ) {
415412 try {
416413 $ location = self ::parseUrl ($ location );
417414 } catch (InvalidArgumentException $ e ) {
@@ -436,11 +433,7 @@ private static function createRedirectResolver(array $options, string $host): \C
436433 $ url = self ::parseUrl (curl_getinfo ($ ch , \CURLINFO_EFFECTIVE_URL ));
437434 $ url = self ::resolveUrl ($ location , $ url );
438435
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 ));
444437
445438 return implode ('' , $ url );
446439 };
0 commit comments