Better username/password extraction from URLs

git-svn-id: svn://svn.berlios.de/gpodder/trunk@504 b0d088ad-0a06-0410-aad2-9ed5178a7e87
This commit is contained in:
Thomas Perl 2007-12-23 11:23:48 +00:00
parent c8c6ee4157
commit b5104b2c73
2 changed files with 15 additions and 3 deletions

View File

@ -1,3 +1,11 @@
Sun, 23 Dec 2007 12:20:25 +0100 <thp@perli.net>
Better username/password extraction from URLs
* src/gpodder/util.py: Improve username and password extraction for
authentication URLs; thanks to Nick <me@nikosapi.org> and Shane
Donohoe <priestoftime@googlemail.com> for reporting this bug and
sending in a patch; this should allow for e-mail address usernames
Sat, 22 Dec 2007 11:44:41 +0100 <thp@perli.net>
Also delete old episodes that have disappeared from the feed

View File

@ -114,9 +114,13 @@ def username_password_from_url( url):
(scheme, netloc, path, params, query, fragment) = urlparse.urlparse( url)
if '@' in netloc:
(username, password) = netloc.split( '@', 1)[0].split( ':', 1)
username = urllib.unquote( username)
password = urllib.unquote( password)
(authentication, netloc) = netloc.rsplit('@', 1)
if ':' in authentication:
(username, password) = authentication.split(':', 1)
username = urllib.unquote(username)
password = urllib.unquote(password)
else:
username = urllib.unquote(authentication)
return (username, password)