Skip to content

Commit

Permalink
Release redirected connections.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenneth Reitz committed Jan 29, 2012
1 parent e695941 commit 4516bd4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion requests/models.py
Expand Up @@ -216,6 +216,9 @@ def build(resp):
if not len(history) < self.config.get('max_redirects'):
raise TooManyRedirects()

# Release the connection back into the pool.
r.raw.release_conn()

history.append(r)

url = r.headers['location']
Expand Down Expand Up @@ -504,7 +507,7 @@ def send(self, anyway=False, prefetch=False):

# Attach Cookie header to request.
self.headers['Cookie'] = cookie_header

# Pre-request hook.
r = dispatch_hook('pre_request', self.hooks, self)
self.__dict__.update(r.__dict__)
Expand Down

1 comment on commit 4516bd4

@kennethreitz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.