Skip to content

AmpHttpClient resets body size limit on redirect #62314

@villermen

Description

@villermen

Symfony version(s) affected

7.3.4

Description

AMP's default body size limit of 10 MiB is disabled when making a request: https://github.com/symfony/http-client/blob/439032bdff3a5bd07f4e68ef6a93b51bb477400f/AmpHttpClient.php#L128

However, when a redirect happens a new request is created that does not disable this limit: https://github.com/symfony/http-client/blob/439032bdff3a5bd07f4e68ef6a93b51bb477400f/Response/AmpResponseV5.php#L325

This means that a > 10 MiB page/file that requires a redirect will not finish downloading.

How to reproduce

A real life example of a file that will not download with a fresh client is https://github.com/sapics/ip-location-db/raw/main/geolite2-city/geolite2-city-ipv4-num.csv.gz. Code to reproduce:

$client = new AmpHttpClient();
$response = $client->request('https://github.com/sapics/ip-location-db/raw/main/geolite2-city/geolite2-city-ipv4-num.csv.gz');
$response->getContent(); // warning/exception

Possible Solution

#62315

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions