Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Handle multiple Content-Type headers correctly #31238
Avoids situations where mulitple Content-Type headers including charset information can result in errors like
https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 states that duplicate headers are ok.
... can result in...
... if the http response returns multiple Content-Type headers like this ...
The combined content-type is currently sendt comma-seperated to cgi.parse_header, which isn't able to handle multiple values, so it returns "charset=UTF8, text/html", which then is used for decoding and results in the unknown encoding error message.
The pull request simply sends one content_header value at a time to cgi.parse_header to get the right encoding.