Merge pull request #1117 from sigmavirus24/issue1106

Fix #1106
This commit is contained in:
Kenneth Reitz
2013-01-22 18:48:31 -08:00
2 changed files with 5 additions and 4 deletions
-3
View File
@@ -13,7 +13,6 @@ import socket
from .models import Response
from .packages.urllib3.poolmanager import PoolManager, ProxyManager
from .packages.urllib3.response import HTTPResponse
from .hooks import dispatch_hook
from .compat import urlparse, basestring, urldefrag
from .utils import (DEFAULT_CA_BUNDLE_PATH, get_encoding_from_headers,
prepend_scheme_if_needed)
@@ -109,8 +108,6 @@ class HTTPAdapter(BaseAdapter):
response.request = req
response.connection = self
# Run the Response hook.
response = dispatch_hook('response', req.hooks, response)
return response
def get_connection(self, url, proxies=None):
+5 -1
View File
@@ -275,6 +275,10 @@ class Session(SessionRedirectMixin):
# Prepare the Request.
prep = req.prepare()
# If auth hooks are present, they aren't passed to `dispatch_hook`
# As such, we need to update the original hooks dictionary with them
hooks.update(prep.hooks)
# Send the request.
resp = self.send(prep, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies)
@@ -295,7 +299,7 @@ class Session(SessionRedirectMixin):
resp.history = tuple(history)
# Response manipulation hook.
self.response = dispatch_hook('response', hooks, resp)
resp = dispatch_hook('response', hooks, resp)
return resp