Message290063
urllib.request.Request allows the user to create a request object like:
req = Request(url, headers={b'Content-Type': b'application/json'})
When calling urlopen(req, data), urllib will check if a 'Content-Type' header is present and fail to recognize b'Content-Type' because it's bytes.
urrlib will therefore add the default Content-Type 'application/x-www-form-urlencoded', and the request will then be sent with both Content-Types. This will result in difficult-to-debug errors because the server will sometimes pick one and sometimes the other, depending on the order.
urllib should either reject bytes headers, or check for both bytes and strings. The docs also don't seem to specify that the headers should be strings. |
|
Date |
User |
Action |
Args |
2017-03-23 22:03:56 | ezio.melotti | set | recipients:
+ ezio.melotti, orsenthil |
2017-03-23 22:03:56 | ezio.melotti | set | messageid: <1490306636.78.0.894703905259.issue29891@psf.upfronthosting.co.za> |
2017-03-23 22:03:56 | ezio.melotti | link | issue29891 messages |
2017-03-23 22:03:56 | ezio.melotti | create | |
|