-
-
Notifications
You must be signed in to change notification settings - Fork 29.2k
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
urllib.py https redirect-302 bug #34141
Comments
Using urllib.urlopen("https://...") seems >>> import urllib
>>> params = ...
>>> f = urllib.urlopen("https://...", params)
connect: (securesite.com, 80)
#a printout from httplib, line 354
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local/lib/python2.0/urllib.py", line 63, in
urlopen
return _urlopener.open(url, data)
File "/usr/local/lib/python2.0/urllib.py", line 168, in
open
return getattr(self, name)(url, data)
File "/usr/local/lib/python2.0/urllib.py", line 367, in
open_https
data)
File "/usr/local/lib/python2.0/urllib.py", line 301, in
http_error
result = method(url, fp, errcode, errmsg, headers,
data)
File "/usr/local/lib/python2.0/urllib.py", line 537, in
http_error_302
return self.open(newurl, data)
File "/usr/local/lib/python2.0/urllib.py", line 168, in
open
return getattr(self, name)(url, data)
File "/usr/local/lib/python2.0/urllib.py", line 269, in
open_http
h.putrequest('POST', selector)
File "/usr/local/lib/python2.0/httplib.py", line 428,
in putrequest
self.send(str)
File "/usr/local/lib/python2.0/httplib.py", line 370,
in send
self.connect()
File "/usr/local/lib/python2.0/httplib.py", line 354,
in connect
self.sock.connect((self.host, self.port))
KeyboardInterrupt
>>> |
Logged In: YES Errr....I'm not sure I see the bug. Perhaps the "Location" In testing (sadly, against a server inside a firewall, so I One thing, that may or may not have to do with your problem: |
Logged In: YES The server is https://trading.etrade.com Unless you have an account there to try it yourself, I know for sure that the redirection is to another def open_https(self, url, data=None):
if errcode == 200:
return addinfourl(fp, headers, url)
else:
if data is None:
return self.http_error(url, fp, errcode, errmsg,
headers)
else:
return self.http_error(url, fp, errcode, errmsg,
headers, data) ... and here's the function called after the error is def http_error_302(self, url, fp, errcode, errmsg,
headers, data=None):
"""Error 302 -- relocated (temporarily)."""
######Here's the problem#############
# In case the server sent a relative URL, join with
original:
newurl = basejoin("http:" + url, newurl)
#uh, what if it isn't http? we seem to have lost that
information...
if data is None:
return self.open(newurl)
else:
return self.open(newurl, data) I originally was developing my project in JAVA and Am I making any sense? |
Logged In: NO the location header must be an absolute uri |
Logged In: YES Fixed in urllib.py v 1.125 |
Logged In: YES Forgot to actually close the bug report. |
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: