pwsm / httplib2

Automatically exported from code.google.com/p/httplib2
0 stars 0 forks source link

poor exception for connection timeout #105

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create a Http client with low timeout parameter
2. attempt to send a request to a non-existent or non-responsive server

What is the expected output? What do you see instead?

The library raises a AttributeError exception. I'd like to see an the 
underlying socket exception:  socket.timeout

What version of the product are you using? On what operating system?

python-httplib2 v0.6 on solaris 10

Please provide any additional information below.

Here is an example of the poor exception:

>>> import httplib2
>>> conn = httplib2.Http(timeout=5)
>>> conn.request('http://1.1.1.1/')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/oanda/system/lib/python2.6/site-packages/httplib2/__init__.py", line 1151, in request
    (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
  File "/oanda/system/lib/python2.6/site-packages/httplib2/__init__.py", line 909, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, headers)
  File "/oanda/system/lib/python2.6/site-packages/httplib2/__init__.py", line 878, in _conn_request
    response = conn.getresponse()
  File "/oanda/system/lib/python2.6/httplib.py", line 972, in getresponse
    method=self._method)
  File "/oanda/system/lib/python2.6/httplib.py", line 330, in __init__
    self.fp = sock.makefile('rb', 0)
AttributeError: 'NoneType' object has no attribute 'makefile'

Original issue reported on code.google.com by miah.n...@gmail.com on 23 Jul 2010 at 6:56

GoogleCodeExporter commented 8 years ago
opps. This appears to be a dup of #102. sorry.

Original comment by miah.n...@gmail.com on 23 Jul 2010 at 7:38

GoogleCodeExporter commented 8 years ago
Or a duplicate of 102 or 131.

Original comment by joe.gregorio@gmail.com on 13 Feb 2011 at 3:46