:param proxies: (optional) A Requests-style dictionary of proxies used on this request.
"""
proxies = proxies or {}
- proxy = proxies.get(urlparse(url).scheme)
+ proxy = proxies.get(urlparse(url.lower()).scheme)
if proxy:
- proxy = prepend_scheme_if_needed(proxy, urlparse(url).scheme)
+ proxy = prepend_scheme_if_needed(proxy, urlparse(url.lower()).scheme)
conn = ProxyManager(self.poolmanager.connection_from_url(proxy))
else:
- conn = self.poolmanager.connection_from_url(url)
+ conn = self.poolmanager.connection_from_url(url.lower())
return conn
def test_mixed_case_scheme_acceptable(self):
s = requests.Session()
- r = requests.Request('GET', 'HTTP://httbin.org/get')
+ r = requests.Request('GET', 'http://httpbin.org/get')
r = s.send(r.prepare())
self.assertEqual(r.status_code,200)
- r = requests.Request('GET', 'hTTp://httbin.org/get')
+ s = requests.Session()
+ r = requests.Request('GET', 'HTTP://httpbin.org/get')
+ r = s.send(r.prepare())
+ self.assertEqual(r.status_code,200)
+ r = requests.Request('GET', 'hTTp://httpbin.org/get')
+ r = s.send(r.prepare())
+ self.assertEqual(r.status_code,200)
+ r = requests.Request('GET', 'HttP://httpbin.org/get')
r = s.send(r.prepare())
self.assertEqual(r.status_code,200)
- r = requests.Request('GET', 'HttP://httbin.org/get')
+ r = requests.Request('GET', 'https://httpbin.org/get')
r = s.send(r.prepare())
self.assertEqual(r.status_code,200)
- r = requests.Request('GET', 'HTTPS://httbin.org/get')
+ r = requests.Request('GET', 'HTTPS://httpbin.org/get')
r = s.send(r.prepare())
self.assertEqual(r.status_code,200)
- r = requests.Request('GET', 'hTTps://httbin.org/get')
+ r = requests.Request('GET', 'hTTps://httpbin.org/get')
r = s.send(r.prepare())
self.assertEqual(r.status_code,200)
- r = requests.Request('GET', 'HttPs://httbin.org/get')
+ r = requests.Request('GET', 'HttPs://httpbin.org/get')
r = s.send(r.prepare())
self.assertEqual(r.status_code,200)