A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/python/cpython/commit/f61599b050c621386a3fc6bc480359e2d3bb93de below:

Corrects fix to handle decomposition in usernames (GH-13812) · python/cpython@f61599b · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+13

-12

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+13

-12

lines changed Original file line number Diff line number Diff line change

@@ -648,12 +648,13 @@ def test_urlsplit_normalization(self):

648 648

urlparse.urlsplit(u'http://\u30d5\u309a\ufe1380')

649 649 650 650

for scheme in [u"http", u"https", u"ftp"]:

651 -

for c in denorm_chars:

652 -

url = u"{}://netloc{}false.netloc/path".format(scheme, c)

653 -

if test_support.verbose:

654 -

print "Checking %r" % url

655 -

with self.assertRaises(ValueError):

656 -

urlparse.urlsplit(url)

651 +

for netloc in [u"netloc{}false.netloc", u"n{}user@netloc"]:

652 +

for c in denorm_chars:

653 +

url = u"{}://{}/path".format(scheme, netloc.format(c))

654 +

if test_support.verbose:

655 +

print "Checking %r" % url

656 +

with self.assertRaises(ValueError):

657 +

urlparse.urlsplit(url)

657 658 658 659

def test_main():

659 660

test_support.run_unittest(UrlParseTestCase)

Original file line number Diff line number Diff line change

@@ -171,17 +171,17 @@ def _checknetloc(netloc):

171 171

# looking for characters like \u2100 that expand to 'a/c'

172 172

# IDNA uses NFKC equivalence, so normalize for this check

173 173

import unicodedata

174 -

n = netloc.rpartition('@')[2] # ignore anything to the left of '@'

175 -

n = n.replace(':', '') # ignore characters already included

176 -

n = n.replace('#', '') # but not the surrounding text

177 -

n = n.replace('?', '')

174 +

n = netloc.replace(u'@', u'') # ignore characters already included

175 +

n = n.replace(u':', u'') # but not the surrounding text

176 +

n = n.replace(u'#', u'')

177 +

n = n.replace(u'?', u'')

178 178

netloc2 = unicodedata.normalize('NFKC', n)

179 179

if n == netloc2:

180 180

return

181 181

for c in '/?#@:':

182 182

if c in netloc2:

183 -

raise ValueError("netloc '" + netloc + "' contains invalid " +

184 -

"characters under NFKC normalization")

183 +

raise ValueError(u"netloc '" + netloc + u"' contains invalid " +

184 +

u"characters under NFKC normalization")

185 185 186 186

def urlsplit(url, scheme='', allow_fragments=True):

187 187

"""Parse a URL into 5 components:

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4