What steps will reproduce the problem?
import httplib2
h = httplib2.Http()
h.request('http://localhost:4000', 'GET')
on the py2.6 version of httplib2 the above will report a stack trace:
Traceback (most recent call last):
File "stuff.py", line 13, in <module>
h.request('http://localhost:4000', 'GET')
File "/usr/lib/pymodules/python2.6/httplib2/__init__.py", line 1129, in request
(response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File "/usr/lib/pymodules/python2.6/httplib2/__init__.py", line 901, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "/usr/lib/pymodules/python2.6/httplib2/__init__.py", line 871, in _conn_request
response = conn.getresponse()
File "/usr/lib/python2.6/httplib.py", line 984, in getresponse
method=self._method)
File "/usr/lib/python2.6/httplib.py", line 330, in __init__
self.fp = sock.makefile('rb', 0)
AttributeError: 'NoneType' object has no attribute 'makefile'
What is the expected output? What do you see instead?
I have nothing running on localhost:4000, so the connection is simply refused,
but httplib2 tries to call conn.getresponse and sock is still NULL. This
happens around
except (socket.error, httplib.HTTPException):
# Just because the server closed the connection doesn't apparently mean
# that the server didn't send a response.
pass
try:
response = conn.getresponse()
If you call conn.connect() before this you can see that you'll get
socket.error: [Errno 111] Connection refused
What version of the product are you using? On what operating system?
Ubuntu 10.04.3 LTS \n \l
2.6.32-gg508-generic
python 2.6 and the 2.6 httplib2
Original issue reported on code.google.com by fe...@google.com on 21 Oct 2011 at 2:21
Original issue reported on code.google.com by
fe...@google.com
on 21 Oct 2011 at 2:21