Permalink
Browse files

Merge pull request #799 from joequery/ubuntu_ssl_error

Fix SSL3 error on Ubuntu 12.04
  • Loading branch information...
2 parents b130b98 + c19650b commit 2e71497e10dd372040b5b44c75b99a07159e7ce4 @kennethreitz committed Aug 20, 2012
Showing with 11 additions and 3 deletions.
  1. +11 −3 requests/packages/urllib3/connectionpool.py
@@ -96,9 +96,17 @@ 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)
+ 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 2e71497

Please sign in to comment.