Skip to content
Browse files

Fix SSL3 error on Ubuntu 12.04

  • Loading branch information...
1 parent b130b98 commit c19650b00f0c169cdf6372a093425830e11a8771 @joequery joequery committed Aug 19, 2012
Showing with 11 additions and 3 deletions.
  1. +11 −3 requests/packages/urllib3/connectionpool.py
View
14 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 c19650b

Please sign in to comment.
Something went wrong with that request. Please try again.