Skip to content

Commit

Permalink
gpodder.util: Don't force password to be lowercase (bug 1942)
Browse files Browse the repository at this point in the history
  • Loading branch information
thp committed Aug 25, 2014
1 parent e7da3ce commit ca75861
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/gpodder/util.py
Expand Up @@ -198,6 +198,12 @@ def normalize_feed_url(url):
>>> normalize_feed_url('http://example.org/test?')
'http://example.org/test'
Username and password in the URL must not be affected
by URL normalization (see gPodder bug 1942):
>>> normalize_feed_url('http://UserName:PassWord@Example.com/')
'http://UserName:PassWord@example.com/'
"""
if not url or len(url) < 8:
return None
Expand Down Expand Up @@ -225,8 +231,15 @@ def normalize_feed_url(url):

scheme, netloc, path, query, fragment = urlparse.urlsplit(url)

# Domain name is case insensitive, but username/password is not (bug 1942)
if '@' in netloc:
authentication, netloc = netloc.rsplit('@', 1)
netloc = '@'.join((authentication, netloc.lower()))
else:
netloc = netloc.lower()

# Schemes and domain names are case insensitive
scheme, netloc = scheme.lower(), netloc.lower()
scheme = scheme.lower()

# Normalize empty paths to "/"
if path == '':
Expand Down

0 comments on commit ca75861

Please sign in to comment.