Skip to content

Commit 6fd82b3

Browse files
committed
Fixup: do not close the response before anchor-checking has been performed
1 parent 692fdef commit 6fd82b3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sphinx/builders/linkcheck.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,9 @@ def check_uri() -> tuple[str, str, int]:
318318
# Read the whole document and see if #anchor exists
319319
response = requests.get(req_url, stream=True, config=self.config,
320320
auth=auth_info, **kwargs)
321-
response.close() # no HTTP body reads required; close the response
322321
response.raise_for_status()
323322
found = check_anchor(response, unquote(anchor))
323+
response.close() # HTTP body reads complete; close the response
324324

325325
if not found:
326326
raise Exception(__("Anchor '%s' not found") % anchor)

0 commit comments

Comments
 (0)