Skip to content
Myr

Revert "Add trusted domains"

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

This reverts commit fbe48fbb7c5b96cde3a16453311e45f723516afd.

authored by Nate Prewitt · committed by Nate Prewitt · parent 1462917 · Browse files · 1 file+1 added−8 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+1 added−8 removed

  • other:+1 added−8 removed

1 file+1 added−8 removed

modified:requests/sessions.py+1 added-8 removed
93 unmodified lines
949596class SessionRedirectMixin(object):9798 def __init__(self):99 #: A list of domains that will be excluded from auth stripping100 self.trusted_domains = []10198 def get_redirect_target(self, resp):99 """Receives a Response. Returns a redirect URI or ``None``"""100 # Due to the nature of how requests processes redirects this method will101 # be called at least once upon the original response and at least twice
17 unmodified lines
119 def should_strip_auth(self, old_url, new_url):120 """Decide whether Authorization header should be removed when redirecting"""121 old_parsed = urlparse(old_url)122 new_parsed = urlparse(new_url)127 if (old_parsed.hostname != new_parsed.hostname128 and new_parsed.hostname not in self.trusted_domains):123 if old_parsed.hostname != new_parsed.hostname:124 return True125 # Special case: allow http -> https redirect when using the standard126 # ports. This isn't specified by RFC 7235, but is kept to avoid127 # breaking backwards compatibility with older versions of requests
285 unmodified lines
413 self.adapters = OrderedDict()414 self.mount('https://', HTTPAdapter())415 self.mount('http://', HTTPAdapter())416422 super().__init__()423417 def __enter__(self):418 return self419420 def __exit__(self, *args):
347 unmodified lines