Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #154 from schlamar/issue-153

Prevent passing SSL keywoards to HTTP connection.
  • Loading branch information...
commit cccae49de03897dcf83b6a35a2e6a995801813ca 2 parents 2e30158 + 9570cd2
@shazow authored
View
4 test/with_dummyserver/test_poolmanager.py
@@ -84,7 +84,11 @@ def test_headers(self):
self.assertEqual(returned_headers.get('Foo'), None)
self.assertEqual(returned_headers.get('Baz'), 'quux')
+ def test_http_with_ssl_keywords(self):
+ http = PoolManager(ca_certs='REQUIRED')
+ r = http.request('GET', 'http://%s:%s/' % (self.host, self.port))
+ self.assertEqual(r.status, 200)
if __name__ == '__main__':
View
11 urllib3/poolmanager.py
@@ -23,6 +23,9 @@
log = logging.getLogger(__name__)
+SSL_KEYWORDS = ('key_file', 'cert_file', 'cert_reqs', 'ca_certs',
+ 'ssl_version')
+
class PoolManager(RequestMethods):
"""
@@ -67,7 +70,13 @@ def _new_pool(self, scheme, host, port):
to be overridden for customization.
"""
pool_cls = pool_classes_by_scheme[scheme]
- return pool_cls(host, port, **self.connection_pool_kw)
+ kwargs = self.connection_pool_kw
+ if scheme == 'http':
+ kwargs = self.connection_pool_kw.copy()
+ for kw in SSL_KEYWORDS:
+ kwargs.pop(kw, None)
+
+ return pool_cls(host, port, **kwargs)
def clear(self):
"""
Please sign in to comment.
Something went wrong with that request. Please try again.