Skip to content
Myr

Fixed issue with empty proxies being passed

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

authored by Eric Hansen · committed by Eric Hansen · parent 64fd0ba · Browse files · 2 files+31 added−0 removed
This commit

State

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

Diff stats

2 files+31 added−0 removed

  • tests:+27 added−0 removed
  • other:+4 added−0 removed

2 files+31 added−0 removed

modified:requests/models.py+4 added
109 unmodified lines
110111 # Dictionary mapping protocol to the URL of the proxy (e.g. {'http': 'foo.bar:3128'})112 self.proxies = dict(proxies or [])113114 for proxy_type,uri_ref in self.proxies.items():115 if not uri_ref:116 del self.proxies[proxy_type]117118 # If no proxies are given, allow configuration by environment variables119 # HTTP_PROXY and HTTPS_PROXY.120 if not self.proxies and self.config.get('trust_env'):121 self.proxies = get_environ_proxies()
767 unmodified lines
added:tests/test_proxies.py+27 added
1#!/usr/bin/env python2# -*- coding: utf-8 -*-34import sys, os, unittest56# Path hack.7sys.path.insert(0, os.path.abspath('..'))8import requests91011class HTTPSProxyTest(unittest.TestCase):12 """Smoke test for https functionality."""1314 smoke_url = "https://github.com"1516 def test_empty_https_proxy(self):17 proxy = {"https" : "" }18 result = requests.get(self.smoke_url, verify=False, proxies = proxy)19 self.assertEqual(result.status_code, 200)2021 def test_empty_http_proxy(self):22 proxy = {"http" : "" }23 result = requests.get(self.smoke_url, proxies = proxy)24 self.assertEqual(result.status_code, 200)2526if __name__ == '__main__':27 unittest.main()