Take advantage of the new copy method

This commit is contained in:
Ian Cordasco
2013-07-27 23:08:46 -04:00
parent 972089826e
commit 286ddb672d
2 changed files with 2 additions and 11 deletions
+1 -7
View File
@@ -145,7 +145,6 @@ class HTTPDigestAuth(AuthBase):
def handle_401(self, r, **kwargs):
"""Takes the given response and tries digest-auth, if needed."""
from .models import PreparedRequest
num_401_calls = getattr(self, 'num_401_calls', 1)
s_auth = r.headers.get('www-authenticate', '')
@@ -159,12 +158,7 @@ class HTTPDigestAuth(AuthBase):
# to allow our new request to reuse the same one.
r.content
r.raw.release_conn()
prep = PreparedRequest()
prep.method = r.request.method
prep.url = r.request.url
prep.body = r.request.body
prep.headers = r.request.headers.copy()
prep.hooks = r.request.hooks
prep = r.request.copy()
prep.prepare_cookies(r.cookies)
prep.headers['Authorization'] = self.build_digest_header(
+1 -4
View File
@@ -74,10 +74,7 @@ class SessionRedirectMixin(object):
# ((resp.status_code is codes.see_other))
while (('location' in resp.headers and resp.status_code in REDIRECT_STATI)):
prepared_request = PreparedRequest()
prepared_request.body = req.body
prepared_request.headers = req.headers.copy()
prepared_request.hooks = req.hooks
prepared_request = req.copy()
resp.content # Consume socket so it can be released