You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
absolute URIs always begin with a scheme name followed by a colon
…and hence recursing back into _download would work (if we ignore endless loops for a second) but HTTP was changed in 2014 to allow URI references e.g. Location: /People.html#tim and then to be able to recurse back into _download we would now either (1) need to do URI resolution to always end up with a scheme and a domain name — an absolute URI — or (2) make urlopen follow redirects or (3) use something else that does.
It turns out that urlopen already handles redirects for us:
Hi @peterbe,
the code at …
hashin/hashin.py
Lines 67 to 72 in a64f778
…caught my attention with regard to two things:
The first is that
return _download(location)
should probably bereturn _download(location, binary=binary)
or that choice will just be lost.The second is that while in the past the location of the redirect URI was defined and guaranteed to be absolute, in the sense that…
…and hence recursing back into
_download
would work (if we ignore endless loops for a second) but HTTP was changed in 2014 to allow URI references e.g.Location: /People.html#tim
and then to be able to recurse back into_download
we would now either (1) need to do URI resolution to always end up with a scheme and a domain name — an absolute URI — or (2) makeurlopen
follow redirects or (3) use something else that does.It turns out that
urlopen
already handles redirects for us:So maybe that's dead code then and we can just rip the broken redirect handling out. @peterbe what do you think? Should I make a pull request?
PS: This started out at #195 (review) .
The text was updated successfully, but these errors were encountered: