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

fix: handle servers not answering to HEAD requests #2

Merged
merged 1 commit into from
Aug 6, 2024

Conversation

Yannick-Dayer
Copy link
Collaborator

@Yannick-Dayer Yannick-Dayer commented Jul 22, 2024

Some servers will close the connection with requests.head on some pages.
Set the requests.head accepted encoding to support those failing links.


📚 Documentation preview 📚: https://auto-intersphinx--2.org.readthedocs.build/en/2/

Copy link

github-actions bot commented Jul 22, 2024

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  src/auto_intersphinx
  catalog.py
Project Total  

This report was generated by python-coverage-comment-action

@Yannick-Dayer
Copy link
Collaborator Author

I noticed the issue with https://www.idiap.ch/software/bob/docs/bob/bob.pipelines/master/sphinx/.

The HEAD request for the file https://www.idiap.ch/software/bob/docs/bob/bob.pipelines/master/sphinx/objects.inv` works.
However, requests throws when executing a HEAD request on https://www.idiap.ch/software/bob/docs/bob/bob.pipelines/master/sphinx/ directly.

`requests.head` fails on some links due to an encoding issue. This
forces the accepted encoding to be simple to accomodate most servers.
@Yannick-Dayer
Copy link
Collaborator Author

This new version directly fixes the problem instead of circumventing it with a try-except.

Thanks to @PuckCh for finding out what the underlying problem was: the default supported encoding set by requests somehow broke the connection with some links during a HEAD request.

@Yannick-Dayer Yannick-Dayer requested a review from anjos August 6, 2024 09:11
Copy link
Member

@anjos anjos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@anjos anjos merged commit 489621b into main Aug 6, 2024
10 checks passed
@anjos anjos deleted the fix/head-fallback branch August 6, 2024 17:44
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

Successfully merging this pull request may close these issues.

2 participants