downloads: Bump up maximum redirects

TODO: Cherry-pick to master?
TODO: Changelog
This commit is contained in:
Florian Bruhin 2022-05-03 19:05:50 +02:00
parent 59922dfe4e
commit 473f048041
3 changed files with 7 additions and 3 deletions

View File

@ -396,7 +396,11 @@ class DownloadManager(downloads.AbstractDownloadManager):
_MAX_REDIRECTS: The maximum redirection count.
"""
_MAX_REDIRECTS = 10
# Same as many browsers
# https://fetch.spec.whatwg.org/#http-redirect-fetch
# https://source.chromium.org/chromium/chromium/src/+/main:net/url_request/url_request.h;l=97;drc=3c19a2edb96d3d5b56a7481349a357fdbdf8ecf0
# https://stackoverflow.com/questions/9384474/in-chrome-how-many-redirects-are-too-many
_MAX_REDIRECTS = 20
def __init__(self, parent=None):
super().__init__(parent)

View File

@ -576,7 +576,7 @@ Feature: Downloading things from a website.
Scenario: Downloading with infinite redirect
When I set downloads.location.prompt to false
And I run :download http://localhost:(port)/redirect/12 --dest redirection
And I run :download http://localhost:(port)/redirect/21 --dest redirection
Then the error "Download error: Too many redirects" should be shown
And the downloaded file redirection should not exist

View File

@ -85,7 +85,7 @@ class Request(testprocess.Line):
'/500-inline': [HTTPStatus.INTERNAL_SERVER_ERROR],
'/500': [HTTPStatus.INTERNAL_SERVER_ERROR],
}
for i in range(15):
for i in range(25):
path_to_statuses['/redirect/{}'.format(i)] = [HTTPStatus.FOUND]
for suffix in ['', '1', '2', '3', '4', '5', '6']:
key = ('/basic-auth/user{suffix}/password{suffix}'