Permalink
Browse files

integrate ken schwenke's patch to urllib3

  • Loading branch information...
1 parent 3491761 commit f325b77e51e0c4db94d1f33ec54fa536c49d9bcd @eads eads committed Jan 14, 2013
Showing with 10 additions and 5 deletions.
  1. +10 −5 requests/packages/urllib3/connectionpool.py
View
15 requests/packages/urllib3/connectionpool.py
@@ -98,11 +98,16 @@ def connect(self):
# Wrap socket using verification with the root certs in
# trusted_root_certs
- self.sock = ssl_wrap_socket(sock, self.key_file, self.cert_file,
- cert_reqs=self.cert_reqs,
- ca_certs=self.ca_certs,
- server_hostname=self.host,
- ssl_version=self.ssl_version)
+ try:
+ self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file,
+ cert_reqs=self.cert_reqs,
+ ca_certs=self.ca_certs,
+ ssl_version=ssl.PROTOCOL_SSLv3)
+ except ssl.SSLError:
+ self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file,
+ cert_reqs=self.cert_reqs,
+ ca_certs=self.ca_certs,
+ ssl_version=ssl.PROTOCOL_SSLv23)
if self.ca_certs:
match_hostname(self.sock.getpeercert(), self.host)

0 comments on commit f325b77

Please sign in to comment.