mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #43956 from terminalmage/fix-get_url-redirects
Fix fileclient's get_url when redirecting to a redirect
This commit is contained in:
commit
39893a1dab
1 changed files with 10 additions and 6 deletions
|
@ -623,10 +623,11 @@ class Client(object):
|
|||
if write_body[1] is not False and write_body[2] is None:
|
||||
if not hdr.strip() and 'Content-Type' not in write_body[1]:
|
||||
# We've reached the end of the headers and not yet
|
||||
# found the Content-Type. Reset the values we're
|
||||
# tracking so that we properly follow the redirect.
|
||||
write_body[0] = None
|
||||
write_body[1] = False
|
||||
# found the Content-Type. Reset write_body[0] so that
|
||||
# we properly follow the redirect. Note that slicing is
|
||||
# used below to ensure that we re-use the same list
|
||||
# rather than creating a new one.
|
||||
write_body[0:2] = (None, False)
|
||||
return
|
||||
# Try to find out what content type encoding is used if
|
||||
# this is a text file
|
||||
|
@ -648,9 +649,12 @@ class Client(object):
|
|||
# If write_body[0] is False, this means that this
|
||||
# header is a 30x redirect, so we need to reset
|
||||
# write_body[0] to None so that we parse the HTTP
|
||||
# status code from the redirect target.
|
||||
# status code from the redirect target. Additionally,
|
||||
# we need to reset write_body[2] so that we inspect the
|
||||
# headers for the Content-Type of the URL we're
|
||||
# following.
|
||||
if write_body[0] is write_body[1] is False:
|
||||
write_body[0] = None
|
||||
write_body[0] = write_body[2] = None
|
||||
|
||||
# Check the status line of the HTTP request
|
||||
if write_body[0] is None:
|
||||
|
|
Loading…
Add table
Reference in a new issue