Skip to content

Commit

Permalink
Fixup: do not close the response before anchor-checking has been perf…
Browse files Browse the repository at this point in the history
…ormed
  • Loading branch information
jayaddison committed Apr 16, 2023
1 parent 692fdef commit 6fd82b3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sphinx/builders/linkcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,9 @@ def check_uri() -> tuple[str, str, int]:
# Read the whole document and see if #anchor exists
response = requests.get(req_url, stream=True, config=self.config,
auth=auth_info, **kwargs)
response.close() # no HTTP body reads required; close the response
response.raise_for_status()
found = check_anchor(response, unquote(anchor))
response.close() # HTTP body reads complete; close the response

if not found:
raise Exception(__("Anchor '%s' not found") % anchor)
Expand Down

0 comments on commit 6fd82b3

Please sign in to comment.