kennethreitz/requests — pull request #399 by acdha (2012-01-29 23:58:02+00:00)
Title: Fix for #239: “Too many open files” 

The underlying problem appears to have been consuming async replies too late in two places:

1. async.send(prefetch=True) did not pass prefetch=True to the request.send() call but instead consumed the responses *after* all of them had been processed, leading to an error any time the total number of requests exceeded the number of available file descriptors. acdha@495646bb6a89802a60208c2ab09749edba1f8e51 changes async.send to call request.send with the prefetch value.

2. Following redirects would result in only the last request in the chain being consumed, leading at least one file descriptor. acdha@67f50a0fe53765987e5a6a1c02daabe6400322af consumes each redirect response before following it.