connect --follow argument to limit redirections count; set 5 by default (protocol specification)

This commit is contained in:
yggverse 2025-11-11 13:14:36 +02:00
parent 3395d4fa17
commit d9db0ad7e9
2 changed files with 4 additions and 3 deletions

View file

@ -181,7 +181,7 @@ class Cli
// Crawl next address...
if ($this->option->crawl)
{
if ($this->redirects <= 5) // @TODO optional (currently protocol spec)
if ($this->redirects <= $this->option->follow)
{
// Validate redirection target location
if (filter_var($response->getMeta(), FILTER_VALIDATE_URL)) // @TODO resolve relative locations
@ -216,7 +216,8 @@ class Cli
print(
Message::red(
sprintf(
_("\tredirection count reached, continue next address in queue"),
_("\tredirection limit (%d) reached, continue next address in queue"),
$this->option->follow
)
)
);