-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connection timeout doesn't work for chunked-encoded request #1422
Comments
Thanks for opening this issue! Looking at the Requests code, I suspect you might be right. I'm at work at the moment and won't have internet at home until the 18th, but when I can get time I'll investigate this. To begin with, I think the problem is around here. For chunked uploads, we do this: low_conn = conn._get_conn(timeout=timeout)
low_conn.putrequest(request.method, url, skip_accept_encoding=True)
for header, value in request.headers.items():
low_conn.putheader(header, value)
low_conn.endheaders()
for i in request.body:
low_conn.send(hex(len(i))[2:].encode('utf-8'))
low_conn.send(b'\r\n')
low_conn.send(i)
low_conn.send(b'\r\n')
low_conn.send(b'0\r\n\r\n')
r = low_conn.getresponse()
resp = HTTPResponse.from_httplib(r,
pool=conn,
connection=low_conn,
preload_content=False,
decode_content=False
) The only place we set the timeout is in the call to I need to think about what's best to do here, but I think the answer is to set |
I wonder if our new Timeout system will fix this. |
Seems this is still happening with 2.18.4. I was able to fix it using |
Raise a new issue, link this one, and include your test case that can reproduce the problem consistently. Then you can submit a PR and link to your new issue if you have time :) Thanks @isobit! |
Sample code:
gives the following output
The first request blocked for more than a minute, before a timeout has been thrown, while the second one is ok.
Requests 1.2.3
Python 2.7.3
The text was updated successfully, but these errors were encountered: