summaryrefslogtreecommitdiffstats
path: root/Lib/urllib2.py
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2012-07-08 00:37:53 (GMT)
committerSenthil Kumaran <senthil@uthcode.com>2012-07-08 00:37:53 (GMT)
commit01fe5fa8ea52ba49063d20a5044fb84efdbabe48 (patch)
treefcca35aacbafd582deff4c5c019abb3c931d3ff0 /Lib/urllib2.py
parent5356af8c489d6760f4ad7d88f1178d3820d09999 (diff)
downloadcpython-01fe5fa8ea52ba49063d20a5044fb84efdbabe48.zip
cpython-01fe5fa8ea52ba49063d20a5044fb84efdbabe48.tar.gz
cpython-01fe5fa8ea52ba49063d20a5044fb84efdbabe48.tar.bz2
Fix issue14826 - make urllib.request.Request quoted url consistent with URLOpener open method.
Patch contributed by Stephen Thorne.
Diffstat (limited to 'Lib/urllib2.py')
-rw-r--r--Lib/urllib2.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/urllib2.py b/Lib/urllib2.py
index d4596cd..944f622 100644
--- a/Lib/urllib2.py
+++ b/Lib/urllib2.py
@@ -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