gesomax / httplib2

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

Using a timeout in the constructor always makes the socket fail #42

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. using python 2.5.2 from python.org
2. http = httplib2.Http(timeout=N) where N is any value 
3. http.add_credentials(user, pass)
4. http.request(resource_uri,"PUT", body=resource_data)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.macosx-10.3-i386/egg/httplib2/__init__.py", line 1050,
in request
  File "build/bdist.macosx-10.3-i386/egg/httplib2/__init__.py", line 854,
in _request
  File "build/bdist.macosx-10.3-i386/egg/httplib2/__init__.py", line 823,
in _conn_request
  File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/httplib.py",
line 866, in request
    self._send_request(method, url, body, headers)
  File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/httplib.py",
line 892, in _send_request
    self.send(body)
  File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/httplib.py",
line 711, in send
    self.sock.sendall(str)
  File "<string>", line 1, in sendall
socket.error: (35, 'Resource temporarily unavailable')

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

A response :)

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

On MacOS Tiger 10.4.11 / Intel

Please provide any additional information below.

Removing the timeout makes everything work, but the ability to make a hung
connection fail is critical.

Original issue reported on code.google.com by spida...@gmail.com on 18 Nov 2008 at 9:58

GoogleCodeExporter commented 8 years ago
In python 2.6.1:
Traceback (most recent call last):
  File "C:\Work\PORO\PythonPoro\PythonPoro.py", line 11, in <module>
    resp, content = h.request("https://www.op.fi")
  File "C:\Python26\lib\site-packages\httplib2\__init__.py", line 1028, in request
    (response, new_content) = self._request(conn, authority, uri, request_uri, 
method, body, headers, redirections, cachekey)
  File "C:\Python26\lib\site-packages\httplib2\__init__.py", line 856, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, 
headers)
  File "C:\Python26\lib\site-packages\httplib2\__init__.py", line 825, in 
_conn_request
    conn.request(method, request_uri, body, headers)
  File "C:\python26\lib\httplib.py", line 874, in request
    self._send_request(method, url, body, headers)
  File "C:\python26\lib\httplib.py", line 911, in _send_request
    self.endheaders()
  File "C:\python26\lib\httplib.py", line 868, in endheaders
    self._send_output()
  File "C:\python26\lib\httplib.py", line 740, in _send_output
    self.send(msg)
  File "C:\python26\lib\httplib.py", line 699, in send
    self.connect()
  File "C:\Python26\lib\site-packages\httplib2\__init__.py", line 738, in connect
    sock.settimeout(self.timeout)
  File "<string>", line 1, in settimeout
TypeError: a float is required

Original comment by eino.mak...@gmail.com on 19 Dec 2008 at 5:19

GoogleCodeExporter commented 8 years ago
Correction: I get this error when going to SSL site only.
when connecting to http://www.op.fi it sends redirection to https://www.op.fi 
and 
then I got this float is required error. When connecting SSL directly same 
issue.

Original comment by eino.mak...@gmail.com on 19 Dec 2008 at 5:34

GoogleCodeExporter commented 8 years ago
this patch fix this issue :
http://code.google.com/p/httplib2/issues/detail?id=39

Original comment by bchesn...@gmail.com on 23 Dec 2008 at 10:37

GoogleCodeExporter commented 8 years ago

Original comment by joe.gregorio@gmail.com on 17 Jul 2009 at 12:17