@@ -225,7 +225,7 @@ public function request(string $method, string $url, array $options = []): Respo
225
225
226
226
$ resolveRedirect = self ::createRedirectResolver ($ options , $ host , $ proxy , $ noProxy , $ info , $ onProgress );
227
227
$ 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 ' ] );
229
229
230
230
return new NativeResponse ($ this ->multi , $ context , implode ('' , $ url ), $ options , $ info , $ resolveRedirect , $ onProgress , $ this ->logger );
231
231
}
@@ -411,14 +411,14 @@ private static function createRedirectResolver(array $options, string $host, ?ar
411
411
// Authorization and Cookie headers MUST NOT follow except for the initial host name
412
412
$ requestHeaders = $ redirectHeaders ['host ' ] === $ host ? $ redirectHeaders ['with_auth ' ] : $ redirectHeaders ['no_auth ' ];
413
413
$ requestHeaders [] = 'Host: ' .$ host .$ port ;
414
- self ::configureHeadersAndProxy ($ context , $ host , $ requestHeaders , $ proxy , $ noProxy );
414
+ self ::configureHeadersAndProxy ($ context , $ host , $ requestHeaders , $ proxy , $ noProxy, ' https: ' === $ url [ ' scheme ' ] );
415
415
}
416
416
417
417
return implode ('' , $ url );
418
418
};
419
419
}
420
420
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 )
422
422
{
423
423
if (null === $ proxy ) {
424
424
return stream_context_set_option ($ context , 'http ' , 'header ' , $ requestHeaders );
@@ -435,7 +435,7 @@ private static function configureHeadersAndProxy($context, string $host, array $
435
435
}
436
436
437
437
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 );
439
439
440
440
if (null !== $ proxy ['auth ' ]) {
441
441
$ requestHeaders [] = 'Proxy-Authorization: ' .$ proxy ['auth ' ];
0 commit comments