summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Gregorio <jcgregorio@google.com>2011-05-03 09:09:13 -0400
committerJoe Gregorio <jcgregorio@google.com>2011-05-03 09:09:13 -0400
commit84e332565e452f987c976501c27613c18694f5a0 (patch)
treee4d8e305376662711b22bcf4c5e28bc2b1cb90c5
parent1ed2035686903f1c7b342ddc174e81ac588da535 (diff)
downloadhttplib2-84e332565e452f987c976501c27613c18694f5a0.tar.gz
Fix problem with ssl import in some situations.
-rw-r--r--python2/httplib2/__init__.py2
-rwxr-xr-xpython2/httplib2test.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/python2/httplib2/__init__.py b/python2/httplib2/__init__.py
index 1e979d6..64f2e17 100644
--- a/python2/httplib2/__init__.py
+++ b/python2/httplib2/__init__.py
@@ -63,7 +63,7 @@ except ImportError:
try:
import ssl # python 2.6
_ssl_wrap_socket = ssl.wrap_socket
-except ImportError:
+except (AttributeError, ImportError):
def _ssl_wrap_socket(sock, key_file, cert_file):
ssl_sock = socket.ssl(sock, key_file, cert_file)
return httplib.FakeSocket(sock, ssl_sock)
diff --git a/python2/httplib2test.py b/python2/httplib2test.py
index 1eb474e..d4c46cc 100755
--- a/python2/httplib2test.py
+++ b/python2/httplib2test.py
@@ -430,10 +430,10 @@ class HttpTest(unittest.TestCase):
self.assertTrue(response.reason.startswith("Redirected but"))
self.assertEqual("302", response['status'])
self.assertTrue(content.startswith("This is content"))
-
+
def testGet302ViaHttps(self):
# Google always redirects to http://google.com
- (response, content) = self.http.request("https://google.com", "GET")
+ (response, content) = self.http.request("https://www.google.com", "GET")
self.assertEqual(200, response.status)
self.assertEqual(302, response.previous.status)