mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Fix issue14826 - make urllib.request.Request quoted url consistent with URLOpener open method.
Patch contributed by Stephen Thorne.
This commit is contained in:
parent
5356af8c48
commit
01fe5fa8ea
3 changed files with 14 additions and 2 deletions
|
@ -110,7 +110,7 @@ except ImportError:
|
|||
from StringIO import StringIO
|
||||
|
||||
from urllib import (unwrap, unquote, splittype, splithost, quote,
|
||||
addinfourl, splitport, splittag,
|
||||
addinfourl, splitport, splittag, toBytes,
|
||||
splitattr, ftpwrapper, splituser, splitpasswd, splitvalue)
|
||||
|
||||
# support for FileHandler, proxies via environment variables
|
||||
|
@ -196,7 +196,8 @@ class Request:
|
|||
def __init__(self, url, data=None, headers={},
|
||||
origin_req_host=None, unverifiable=False):
|
||||
# unwrap('<URL:type://host/path>') --> 'type://host/path'
|
||||
self.__original = unwrap(url)
|
||||
self.__original = unwrap(toBytes(url))
|
||||
self.__original = quote(self.__original, safe="%/:=&?~#+!$,;'@()*[]|")
|
||||
self.__original, self.__fragment = splittag(self.__original)
|
||||
self.type = None
|
||||
# self.__r_type is what's left after doing the splittype
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue