Skip to content

Connection timeout doesn't work for chunked-encoded request  #1422

@psushin

Description

@psushin

Sample code:

def gen():
    for i in xrange(1, 1000):
        yield 'x'
import requests, datetime

print datetime.datetime.now()

try: requests.post(url='http://1.1.1.1', timeout=5, data=gen())
except Exception as e: print e

print datetime.datetime.now()

try: requests.post(url='http://1.1.1.1', timeout=5, data='a')
except Exception as e: print e

print datetime.datetime.now()

gives the following output

2013-06-14 00:33:03.079389
[Errno 110] Connection timed out
2013-06-14 00:34:06.236742
HTTPConnectionPool(host='1.1.1.1', port=80): Request timed out. (timeout=5)
2013-06-14 00:34:11.242869

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions