Skip to content
Myr

Merge pull request #2090 from ericfrederich/fix_308

Before adoption: this commit came in with the history the project adopted, so no landing records it.

handle 308 redirection the same as 301 and 302

authored by Kenneth Reitz · committed by Kenneth Reitz · parents b80ed77, da3178f · Browse files · 3 files+8 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+8 added−6 removed

  • other:+8 added−6 removed

3 files+8 added−6 removed

modified:requests/models.py+5 added-4 removed
33 unmodified lines
3435#: The set of HTTP status codes that indicate an automatically36#: processable redirect.37REDIRECT_STATI = (38 codes.moved, # 30139 codes.found, # 30240 codes.other, # 30341 codes.temporary_moved, # 30738 codes.moved, # 30139 codes.found, # 30240 codes.other, # 30341 codes.temporary_redirect, # 30742 codes.permanent_redirect, # 30843)44DEFAULT_REDIRECT_LIMIT = 3045CONTENT_CHUNK_SIZE = 10 * 102446ITER_CHUNK_SIZE = 512
762 unmodified lines
modified:requests/sessions.py+1 added-1 removed
144 unmodified lines
145146 prepared_request.method = method147148 # https://github.com/kennethreitz/requests/issues/1084149 if resp.status_code not in (codes.temporary, codes.resume):149 if resp.status_code not in (codes.temporary_redirect, codes.permanent_redirect):150 if 'Content-Length' in prepared_request.headers:151 del prepared_request.headers['Content-Length']152153 prepared_request.body = None
484 unmodified lines
modified:requests/status_codes.py+2 added-1 removed
28 unmodified lines
29 304: ('not_modified',),30 305: ('use_proxy',),31 306: ('switch_proxy',),32 307: ('temporary_redirect', 'temporary_moved', 'temporary'),33 308: ('resume_incomplete', 'resume'),33 308: ('permanent_redirect',34 'resume_incomplete', 'resume',), # These 2 to be removed in 3.03536 # Client Error.37 400: ('bad_request', 'bad'),38 401: ('unauthorized',),
51 unmodified lines