New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
urllib2 passes fragment identifier to server #52527
Comments
>>> urllib2.urlopen("http://wave-robot-python-client.googlecode.com/svn/trunk/pydocs/index.html#module-wavelet")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\usr\Python2.6\lib\urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "C:\usr\Python2.6\lib\urllib2.py", line 398, in open
response = meth(req, response)
File "C:\usr\Python2.6\lib\urllib2.py", line 511, in http_response
'http', request, response, code, msg, hdrs)
File "C:\usr\Python2.6\lib\urllib2.py", line 436, in error
return self._call_chain(*args)
File "C:\usr\Python2.6\lib\urllib2.py", line 370, in _call_chain
result = func(*args)
File "C:\usr\Python2.6\lib\urllib2.py", line 519, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 400: Bad Request This happens when redirected URL contains fragment. >>> urllib2.urlopen("http://goo.gl/z1d5")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\usr\Python2.6\lib\urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "C:\usr\Python2.6\lib\urllib2.py", line 398, in open
response = meth(req, response)
File "C:\usr\Python2.6\lib\urllib2.py", line 511, in http_response
'http', request, response, code, msg, hdrs)
File "C:\usr\Python2.6\lib\urllib2.py", line 430, in error
result = self._call_chain(*args)
File "C:\usr\Python2.6\lib\urllib2.py", line 370, in _call_chain
result = func(*args)
File "C:\usr\Python2.6\lib\urllib2.py", line 606, in http_error_302
return self.parent.open(new, timeout=req.timeout)
File "C:\usr\Python2.6\lib\urllib2.py", line 398, in open
response = meth(req, response)
File "C:\usr\Python2.6\lib\urllib2.py", line 511, in http_response
'http', request, response, code, msg, hdrs)
File "C:\usr\Python2.6\lib\urllib2.py", line 436, in error
return self._call_chain(*args)
File "C:\usr\Python2.6\lib\urllib2.py", line 370, in _call_chain
result = func(*args)
File "C:\usr\Python2.6\lib\urllib2.py", line 519, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 400: Bad Request urllib2.Request.get_selector() should be: def get_selector(self):
return self.__r_host.split('#')[0] |
Added a patch to fix this behavior. |
I have also uploaded my patch to http://codereview.appspot.com/1918042 so easier viewing. |
Fixed in revision 83818(py3k), 83819 (release31-maint) and 83820 (release27-maint). David, a couple of comments on your patch.
You might check the svn diffs to see the changes made. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: