Skip to content
Myr

Fix case-insensitive comparison in get_adapter()

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

While trying to get the prefix for an url, the url was lowered before comparing but the prefix not, so if it contains non-lowercase characters (eg. https://api.example.com/sOmE_WeiRD_pReFIX/), it won't match.

authored by Alvaro Gutierrez Perez · committed by GitHub · parent 54ad3d6 · Browse files · 1 file+1 added−1 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−1 removed

  • other:+1 added−1 removed

1 file+1 added−1 removed

modified:requests/sessions.py+1 added-1 removed
694 unmodified lines
695 :rtype: requests.adapters.BaseAdapter696 """697 for (prefix, adapter) in self.adapters.items():698699 if url.lower().startswith(prefix):699 if url.lower().startswith(prefix.lower()):700 return adapter701702 # Nothing matches :-/703 raise InvalidSchema("No connection adapters were found for '%s'" % url)
34 unmodified lines