Skip to content
Myr

header and cookie fixes for redirects

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Kenneth Reitz · committed by Kenneth Reitz · parent 0c4b973 · Browse files · 1 file+22 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+22 added−5 removed

  • other:+22 added−5 removed

1 file+22 added−5 removed

modified:requests/models.py+22 added-5 removed
182 unmodified lines
183184 history = []185186 r = build(resp)187 cookies = self.cookies188 self.cookies.update(r.cookies)189190 if r.status_code in REDIRECT_STATI and not self.redirect:191192 while (
23 unmodified lines
216 method = 'GET'217 else:218 method = self.method219220 # Remove the cookie headers that were sent.221 headers = self.headers222 try:223 del headers['Cookie']224 except KeyError:225 pass226227 request = Request(228 url=url,220 headers=self.headers,229 headers=headers,230 files=self.files,231 method=method,223 # data=self.data,232 # params=self.params,233 auth=self._auth,226 cookies=self.cookies,234 cookies=cookies,235 redirect=True,236 config=self.config,237 _poolmanager=self._poolmanager238 )239240 request.send()241 cookies.update(request.response.cookies)242 r = request.response243 self.cookies.update(r.cookies)244245 r.history = history246247 self.response = r248 self.response.request = self249 # print locals()250 self.response.cookies.update(self.cookies)251 # print cookies252 # print self.response.cookies253 # print '!!!'254255256 @staticmethod257 def _encode_params(data):
105 unmodified lines
363364 if self.auth:365 auth_func, auth_args = self.auth366367 # Allow auth to make its changes.368 r = auth_func(self, *auth_args)369370 # Update self to reflect the auth changes.371 self.__dict__.update(r.__dict__)372355373 # Check to see if keep_alive is allowed.374 if self.config.get('keep_alive'):375 conn = self._poolmanager.connection_from_url(url)376 else:377 conn = connectionpool.connection_from_url(url)360 print 'NO CONNECTION FOR YOU1'378379 if not self.sent or anyway:380381 if self.cookies:
191 unmodified lines