sergot / http-useragent

Web user agent class for Perl 6.
MIT License
36 stars 39 forks source link

Save memory by not storing full request history #170

Closed moritz closed 7 years ago

moritz commented 7 years ago

See #169.

We used to store the full history of the response, just to count redirects. This used up lots of RAM for very little gain.

This commit replaces it by a simple integer that stores the count of redirects in a row.

Since @.history was a public attribute, this changes the public API, and as such is subject to discussion.

jonathanstowe commented 7 years ago

I'm pretty relaxed about the public API part as history is nether documented nor explicitly tested for (only the re-direct loop detection behaviour is tested,) If, for some reason, there was a need to find the re-direct chain that led to a specific response then this would be better placed in the response (and as the request is already saved in the response, this may be trivial.)

So as long as @ugexe is happy (for it is he who put the redirect limit in originally,) and @sergot doesn't explicitly object, I'll merge this.

jonathanstowe commented 7 years ago

As no-one has raised any objections and in lieu of a better suggestion I am going with this :)