mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #44016 from terminalmage/issue44013
Fix on_header callback when not redirecting and no Content-Type present
This commit is contained in:
commit
82b92d54b3
1 changed files with 9 additions and 6 deletions
|
@ -622,12 +622,15 @@ class Client(object):
|
|||
def on_header(hdr):
|
||||
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 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)
|
||||
# If write_body[0] is True, then we are not following a
|
||||
# redirect (initial response was a 200 OK). So there is
|
||||
# no need to reset write_body[0].
|
||||
if write_body[0] is not True:
|
||||
# We are following a redirect, so we need to reset
|
||||
# write_body[0] so that we properly follow it.
|
||||
write_body[0] = None
|
||||
# We don't need the HTTPHeaders object anymore
|
||||
write_body[1] = False
|
||||
return
|
||||
# Try to find out what content type encoding is used if
|
||||
# this is a text file
|
||||
|
|
Loading…
Add table
Reference in a new issue