Skip to content

Profile URLs not found for entities that redirect #45

@graue

Description

@graue

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions