Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix coverage and style cleanup.

  • Loading branch information...
commit 3e4efe2880ad2c3b0c69a8fb09cb1143922b7d6a 1 parent 73a77a8
@shazow authored
Showing with 11 additions and 10 deletions.
  1. +1 −0  .coveragerc
  2. +10 −10 urllib3/util.py
View
1  .coveragerc
@@ -8,3 +8,4 @@ exclude_lines =
.*:.* # Python \d.*
pass
.* # Abstract
+ import
View
20 urllib3/util.py
@@ -11,20 +11,20 @@
try:
from select import poll, POLLIN
-except ImportError: # `poll` doesn't exist on OSX and other platforms
+except ImportError: # `poll` doesn't exist on OSX and other platforms
poll = False
try:
from select import select
- except ImportError: # `select` doesn't exist on AppEngine.
+ except ImportError: # `select` doesn't exist on AppEngine.
select = False
-SSLContext = None
-HAS_SNI = False
-try:
- # any ssl at all?
+try: # Test for SSL features
+ SSLContext = None
+ HAS_SNI = False
+
from ssl import wrap_socket, CERT_NONE, SSLError, PROTOCOL_SSLv23
- from ssl import SSLContext # modern SSL?
- from ssl import HAS_SNI # and SNI enabled?
+ from ssl import SSLContext # Modern SSL?
+ from ssl import HAS_SNI # Has SNI?
except ImportError:
pass
@@ -261,7 +261,7 @@ def is_connection_dropped(conn):
# Either data is buffered (bad), or the connection is dropped.
return True
-if SSLContext is not None: # Platform-specific: Python >= 3.2
+if SSLContext is not None: # Python 3.2+
def ssl_wrap_socket(sock, keyfile=None, certfile=None, cert_reqs=CERT_NONE,
ca_certs=None, server_hostname=None,
ssl_version=PROTOCOL_SSLv23):
@@ -286,7 +286,7 @@ def ssl_wrap_socket(sock, keyfile=None, certfile=None, cert_reqs=CERT_NONE,
server_hostname=server_hostname)
return context.wrap_socket(sock)
-else: # Platform-specific: Python < 3.2
+else:
def ssl_wrap_socket(sock, keyfile=None, certfile=None, cert_reqs=CERT_NONE,
ca_certs=None, server_hostname=None,
ssl_version=PROTOCOL_SSLv23):
Please sign in to comment.
Something went wrong with that request. Please try again.