@@ -225,7 +225,7 @@ public function request(string $method, string $url, array $options = []): Respo
225225
226226 $ resolveRedirect = self ::createRedirectResolver ($ options , $ host , $ proxy , $ noProxy , $ info , $ onProgress );
227227 $ context = stream_context_create ($ context , ['notification ' => $ notification ]);
228- self ::configureHeadersAndProxy ($ context , $ host , $ options ['headers ' ], $ proxy , $ noProxy );
228+ self ::configureHeadersAndProxy ($ context , $ host , $ options ['headers ' ], $ proxy , $ noProxy, ' https: ' === $ url [ ' scheme ' ] );
229229
230230 return new NativeResponse ($ this ->multi , $ context , implode ('' , $ url ), $ options , $ info , $ resolveRedirect , $ onProgress , $ this ->logger );
231231 }
@@ -411,14 +411,14 @@ private static function createRedirectResolver(array $options, string $host, ?ar
411411 // Authorization and Cookie headers MUST NOT follow except for the initial host name
412412 $ requestHeaders = $ redirectHeaders ['host ' ] === $ host ? $ redirectHeaders ['with_auth ' ] : $ redirectHeaders ['no_auth ' ];
413413 $ requestHeaders [] = 'Host: ' .$ host .$ port ;
414- self ::configureHeadersAndProxy ($ context , $ host , $ requestHeaders , $ proxy , $ noProxy );
414+ self ::configureHeadersAndProxy ($ context , $ host , $ requestHeaders , $ proxy , $ noProxy, ' https: ' === $ url [ ' scheme ' ] );
415415 }
416416
417417 return implode ('' , $ url );
418418 };
419419 }
420420
421- private static function configureHeadersAndProxy ($ context , string $ host , array $ requestHeaders , ?array $ proxy , array $ noProxy )
421+ private static function configureHeadersAndProxy ($ context , string $ host , array $ requestHeaders , ?array $ proxy , array $ noProxy, bool $ isSsl )
422422 {
423423 if (null === $ proxy ) {
424424 return stream_context_set_option ($ context , 'http ' , 'header ' , $ requestHeaders );
@@ -435,7 +435,7 @@ private static function configureHeadersAndProxy($context, string $host, array $
435435 }
436436
437437 stream_context_set_option ($ context , 'http ' , 'proxy ' , $ proxy ['url ' ]);
438- stream_context_set_option ($ context , 'http ' , 'request_fulluri ' , true );
438+ stream_context_set_option ($ context , 'http ' , 'request_fulluri ' , ! $ isSsl );
439439
440440 if (null !== $ proxy ['auth ' ]) {
441441 $ requestHeaders [] = 'Proxy-Authorization: ' .$ proxy ['auth ' ];
0 commit comments