Closed
Description
Symfony version(s) affected: 4.3.0
Description
Curl http client try to parse Location
header even if no redirects allowed, which makes unable to get response/headers value from endpoint which returns invalid url in Location
header.
How to reproduce
use Symfony\Component\HttpClient\CurlHttpClient;
// uses the cURL PHP extension
$httpClient = new CurlHttpClient();
$response = $httpClient->request('HEAD', 'http://test.mleczko.waw.pl', ['max_redirects' => 0]);
Results in InvalidArgumentException Malformed URL ...
, no way to use value of this header.
Possible Solution
Simply check if we are gonna use Location
value as redirect target - https://github.com/mleczakm/symfony/commit/5c27013e6b1c8f710821019f1ec64fc29f034d3b