-
Notifications
You must be signed in to change notification settings - Fork 6
Description
My server is set to redirect all HTTP requests from http://scott.mn to https://scott.mn, and the latter is my entity URI. So if I put in http://scott.mn, python-tent-client should follow the redirect, find the Link: header at https://scott.mn, and successfully discover the profile URL (and from that, the API root).
What happens instead is that it fails to find any profile URLs.
Interestingly, http://graue.tent.is does work even though Tent.is redirects http to https in the same manner. But Tent.is uses both a Link: HTTP header and an HTML <link> tag, while my site uses only the HTTP header.
So I suspect what's happening is that Requests doesn't follow a redirect when you do a HEAD request, but does for a GET request. It's doing a HEAD against the http site and not finding any Link: headers. Then it's retrying as a GET but this time against the https site, but it's not noticing that the https site has Link: headers because you only check for the <link> tag in this case.
If that guess is correct, making Requests follow redirects during the initial HEAD request would fix this bug.