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
Handle ConnectionError on HTTP HEAD Requests #9309
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the nice report and patch! 👍
I agree Sphinx could be more tolerant here.
Please add a note to the CHANGES.
tests/roots/test-linkcheck-connection-error-on-http-head/index.rst
Outdated
Show resolved
Hide resolved
…ager instead of relying on an external website.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! A few minor changes and this should be good to go.
tests/roots/test-linkcheck-connection-error-on-http-head/index.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: François Freitag <mail@franek.fr>
Co-authored-by: François Freitag <mail@franek.fr>
Co-authored-by: François Freitag <mail@franek.fr>
Co-authored-by: François Freitag <mail@franek.fr>
Co-authored-by: François Freitag <mail@franek.fr>
Co-authored-by: François Freitag <mail@franek.fr>
Co-authored-by: François Freitag <mail@franek.fr>
Co-authored-by: François Freitag <mail@franek.fr>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good to me, thanks!
Co-authored-by: François Freitag <mail@franek.fr>
Thank you for your contribution. +1 for merging this into 4.x branch instead of 4.0.x. Usually, we use 4.0.x branch only for severe or critical bug fixes. So this is better to merge this into 4.x branch. |
Merged. Thank you for your contribution! @francoisfreitag Thank you for reviewing :-) |
Subject: Resolves #9306
Feature or Bugfix
Purpose
make linkcheck
to fail on URLs that will open and render properly in a web browser. Prior to this fix, the link checker would incorrectly call these links broken.Detail
HTTP HEAD
requests, but will return the requested document forHTTP GET
requests. Thelinkcheck.py
code wasn't catching theConnectionError
exception, and as a result the code would skip therequests.get()
attempt. With this fix, ifrequests.head()
raises aConnectionError
, it will attempt arequests.get()
which, for the UT Patent website, succeeds. If the website truly is rejecting all connections, an exception on therequests.get()
call will still send control to theexcept Exception as err
block as before.Relates