summaryrefslogtreecommitdiffstats
path: root/Lib/urllib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/urllib')
-rw-r--r--Lib/urllib/parse.py7
-rw-r--r--Lib/urllib/request.py2
2 files changed, 7 insertions, 2 deletions
diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py
index b437d6f..cfd47f9 100644
--- a/Lib/urllib/parse.py
+++ b/Lib/urllib/parse.py
@@ -688,7 +688,12 @@ def splithost(url):
_hostprog = re.compile('^//([^/?]*)(.*)$')
match = _hostprog.match(url)
- if match: return match.group(1, 2)
+ if match:
+ host_port = match.group(1)
+ path = match.group(2)
+ if path and not path.startswith('/'):
+ path = '/' + path
+ return host_port, path
return None, url
_userprog = None
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index 5a67c0b..7edfa1b 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -105,7 +105,7 @@ from urllib.response import addinfourl, addclosehook
# check for SSL
try:
import ssl
-except:
+except ImportError:
_have_ssl = False
else:
_have_ssl = True