mirror of https://github.com/scrapy/scrapy.git
utils: revert canonicalize_url implementation, it wasnt intended to be changed
--HG-- extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40961
This commit is contained in:
parent
8724ee1674
commit
0d47fdf6e8
|
|
@ -145,11 +145,10 @@ def canonicalize_url(url, keep_blank_values=True, keep_fragments=False):
|
|||
"""
|
||||
|
||||
url = unicode_to_str(url)
|
||||
parts = list(urlparse.urlparse(url))
|
||||
keyvals = cgi.parse_qsl(parts[4], keep_blank_values)
|
||||
scheme, netloc, path, params, query, fragment = urlparse.urlparse(url)
|
||||
keyvals = cgi.parse_qsl(query, keep_blank_values)
|
||||
keyvals.sort()
|
||||
parts[2] = urllib.quote(urllib.unquote(parts[2]))
|
||||
parts[4] = urllib.urlencode(keyvals)
|
||||
if not keep_fragments:
|
||||
parts[5] = ''
|
||||
return urlparse.urlunparse(parts)
|
||||
query = urllib.urlencode(keyvals)
|
||||
path = urllib.quote(urllib.unquote(path))
|
||||
fragment = '' if not keep_fragments else fragment
|
||||
return urlparse.urlunparse((scheme, netloc, path, params, query, fragment))
|
||||
|
|
|
|||
Loading…
Reference in New Issue