Skip to content
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

307 Temporary Redirect not followed for HEAD request #1348

Closed
pkgw opened this issue Oct 9, 2021 · 1 comment
Closed

307 Temporary Redirect not followed for HEAD request #1348

pkgw opened this issue Oct 9, 2021 · 1 comment

Comments

@pkgw
Copy link

pkgw commented Oct 9, 2021

The tectonic TeX engine uses reqwest to fetch information about TeX support files, starting with a HEAD request to https://archive.org/services/purl/net/pkgwpub/tectonic-default. The Internet Archive recently changed their service to reply to this service with a 307 HTTP code instead of 302, and that breaks Tectonic:

note: connecting to https://archive.org/services/purl/net/pkgwpub/tectonic-default
error: unexpected HTTP response code 307 Temporary Redirect for URL https://archive.org/services/purl/net/pkgwpub/tectonic-default

If I'm understanding the design of the standards and reqwest correctly, reqwest ought to follow this redirect. I think that the relevant logic is:

            let should_redirect = match res.status() {
                StatusCode::MOVED_PERMANENTLY | StatusCode::FOUND | StatusCode::SEE_OTHER => { ... }
                StatusCode::TEMPORARY_REDIRECT | StatusCode::PERMANENT_REDIRECT => {
                    match self.body {
                        Some(Some(_)) | None => true,
                        Some(None) => false,
                    }
                }
                _ => false,
            };

Unfortunately I don't know what the double-option structure of self.body means so it's hard for me to understand what's going on here.

I need to stop using archive.org anyway because it's blocked in China, so this issue is getting me to finally do that —which means that even though this breaks Tectonic in a mission-critical way it's not urgent. But I do think there's a misbehavior in reqwest here.

@pkgw
Copy link
Author

pkgw commented Oct 9, 2021

Sorry, this was my mistake. reqwest is doing the right thing here. Our redirection logic just doesn't properly follow the attempt due to a limitation in our logic.

@pkgw pkgw closed this as completed Oct 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant