summaryrefslogtreecommitdiffstats
path: root/Lib/urllib2.py
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2011-04-12 23:31:45 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2011-04-12 23:31:45 (GMT)
commit49c440877e2d13bb545243ad2cb427272f530cab (patch)
treead9044709bb2d2a0eb0520bbef6f1fcd8e026530 /Lib/urllib2.py
parent7c9d34722db06cac1042c7a3ae0deb92c2b41dfb (diff)
downloadcpython-49c440877e2d13bb545243ad2cb427272f530cab.zip
cpython-49c440877e2d13bb545243ad2cb427272f530cab.tar.gz
cpython-49c440877e2d13bb545243ad2cb427272f530cab.tar.bz2
Fix Issue11703 - urllib2.get_url does not handle fragment in url properly.
Diffstat (limited to 'Lib/urllib2.py')
-rw-r--r--Lib/urllib2.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/urllib2.py b/Lib/urllib2.py
index 3be7c8b..abc84b1 100644
--- a/Lib/urllib2.py
+++ b/Lib/urllib2.py
@@ -190,7 +190,7 @@ class Request:
origin_req_host=None, unverifiable=False):
# unwrap('<URL:type://host/path>') --> 'type://host/path'
self.__original = unwrap(url)
- self.__original, fragment = splittag(self.__original)
+ self.__original, self.__fragment = splittag(self.__original)
self.type = None
# self.__r_type is what's left after doing the splittype
self.host = None
@@ -236,7 +236,10 @@ class Request:
return self.data
def get_full_url(self):
- return self.__original
+ if self.__fragment:
+ return '%s#%s' % (self.__original, self.__fragment)
+ else:
+ return self.__original
def get_type(self):
if self.type is None: