aboutsummaryrefslogtreecommitdiff
path: root/urllib3/util/url.py
diff options
context:
space:
mode:
Diffstat (limited to 'urllib3/util/url.py')
-rw-r--r--urllib3/util/url.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/urllib3/util/url.py b/urllib3/util/url.py
index 122108b..487d456 100644
--- a/urllib3/util/url.py
+++ b/urllib3/util/url.py
@@ -2,6 +2,7 @@ from collections import namedtuple
from ..exceptions import LocationParseError
+
url_attrs = ['scheme', 'auth', 'host', 'port', 'path', 'query', 'fragment']
@@ -47,7 +48,7 @@ def split_first(s, delims):
If not found, then the first part is the full input string.
- Example: ::
+ Example::
>>> split_first('foo/bar?baz', '?/=')
('foo', 'bar?baz', '/')
@@ -80,7 +81,7 @@ def parse_url(url):
Partly backwards-compatible with :mod:`urlparse`.
- Example: ::
+ Example::
>>> parse_url('http://google.com/mail/')
Url(scheme='http', host='google.com', port=None, path='/', ...)
@@ -95,6 +96,10 @@ def parse_url(url):
# Additionally, this implementations does silly things to be optimal
# on CPython.
+ if not url:
+ # Empty
+ return Url()
+
scheme = None
auth = None
host = None