Merge pull request #42967 from terminalmage/issue42941

Fix bug in on_header callback when no Content-Type is found in headers
This commit is contained in:
garethgreenaway 2017-08-17 11:48:52 -07:00 committed by GitHub
commit 9009a971b1

View file

@ -621,6 +621,13 @@ 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 the values we're
# tracking so that we properly follow the redirect.
write_body[0] = None
write_body[1] = False
return
# Try to find out what content type encoding is used if
# this is a text file
write_body[1].parse_line(hdr) # pylint: disable=no-member