Message134211
Sending e.g. a JPEG file with a httplib POST request (e.g. through mechanize) can result in an error like this:
File "/usr/lib64/python2.7/httplib.py", line 947, in request
self._send_request(method, url, body, headers)
File "/usr/lib64/python2.7/httplib.py", line 988, in _send_request
self.endheaders(body)
File "/usr/lib64/python2.7/httplib.py", line 941, in endheaders
self._send_output(message_body)
File "/usr/lib64/python2.7/httplib.py", line 802, in _send_output
msg += message_body
UnicodeDecodeError: 'ascii' codec can't decode byte 0xff in position 2566: invalid start byte
The code triggering this is the attempt to merge the msg and message_body into a single request in httplib.py lines 791+
The patch I'm attaching treats an invalid string of unknown encoding (e.g. binary data wrapped as string) like something that isn't a string.
Works for me with the patch. |
|
Date |
User |
Action |
Args |
2011-04-21 13:42:34 | bero | set | recipients:
+ bero |
2011-04-21 13:42:34 | bero | set | messageid: <1303393354.57.0.483160590848.issue11898@psf.upfronthosting.co.za> |
2011-04-21 13:42:33 | bero | link | issue11898 messages |
2011-04-21 13:42:33 | bero | create | |
|