-
Notifications
You must be signed in to change notification settings - Fork 228
httplib connections no longer support unicode #211
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
We have recently updated from 2.7.1 to 2.7.3 and have found a regression in how httplib handles unicode
import httplib
def post(data):
try:
conn = httplib.HTTPSConnection('httpbin.org')
conn.request('POST', '/post', data)
resp = conn.getresponse()
print(resp.read())
finally:
conn.close()
post('this is a string')
post(u'this is unicode')
Running this with jython 2.7.1 gives the response for both calls. For 2.7.3, the first is successful but the second fails with
Traceback (most recent call last):
File "/tmp/http_demo.py", line 14, in <module>
post(u'this is unicode')
File "/tmp/http_demo.py", line 6, in post
conn.request('POST', '/post', data)
File "/tmp/jython-standalone-2.7.3.jar/Lib/httplib$py.class", line 1082, in request
File "/tmp/jython-standalone-2.7.3.jar/Lib/httplib$py.class", line 1122, in _send_request
File "/tmp/jython-standalone-2.7.3.jar/Lib/httplib$py.class", line 1078, in endheaders
File "/tmp/jython-standalone-2.7.3.jar/Lib/httplib$py.class", line 898, in _send_output
File "/tmp/jython-standalone-2.7.3.jar/Lib/httplib$py.class", line 870, in send
File "/tmp/jython-standalone-2.7.3.jar/Lib/ssl$py.class", line 740, in sendall
File "/tmp/jython-standalone-2.7.3.jar/Lib/_socket$py.class", line 1459, in meth
File "/tmp/jython-standalone-2.7.3.jar/Lib/_socket$py.class", line 0, in sendall
TypeError: cannot make memory view because object does not have the buffer interface
This appears to be a consequence of #185 and PyUnicode only superficially implementing BufferProtocol.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working