mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
This commit is contained in:
parent
3b83549ea0
commit
ced4eb06e4
3 changed files with 24 additions and 4 deletions
|
@ -82,7 +82,7 @@ class BaseResult(tuple):
|
|||
def username(self):
|
||||
netloc = self.netloc
|
||||
if "@" in netloc:
|
||||
userinfo = netloc.split("@", 1)[0]
|
||||
userinfo = netloc.rsplit("@", 1)[0]
|
||||
if ":" in userinfo:
|
||||
userinfo = userinfo.split(":", 1)[0]
|
||||
return userinfo
|
||||
|
@ -92,7 +92,7 @@ class BaseResult(tuple):
|
|||
def password(self):
|
||||
netloc = self.netloc
|
||||
if "@" in netloc:
|
||||
userinfo = netloc.split("@", 1)[0]
|
||||
userinfo = netloc.rsplit("@", 1)[0]
|
||||
if ":" in userinfo:
|
||||
return userinfo.split(":", 1)[1]
|
||||
return None
|
||||
|
@ -101,7 +101,7 @@ class BaseResult(tuple):
|
|||
def hostname(self):
|
||||
netloc = self.netloc
|
||||
if "@" in netloc:
|
||||
netloc = netloc.split("@", 1)[1]
|
||||
netloc = netloc.rsplit("@", 1)[1]
|
||||
if ":" in netloc:
|
||||
netloc = netloc.split(":", 1)[0]
|
||||
return netloc.lower() or None
|
||||
|
@ -110,7 +110,7 @@ class BaseResult(tuple):
|
|||
def port(self):
|
||||
netloc = self.netloc
|
||||
if "@" in netloc:
|
||||
netloc = netloc.split("@", 1)[1]
|
||||
netloc = netloc.rsplit("@", 1)[1]
|
||||
if ":" in netloc:
|
||||
port = netloc.split(":", 1)[1]
|
||||
return int(port, 10)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue