Close the connection on download_maxsize.

This commit is contained in:
Andrey Rakhmatullin 2026-06-20 17:28:27 +05:00
parent 9f90618533
commit 8e112e3735
1 changed files with 2 additions and 1 deletions

View File

@ -545,7 +545,8 @@ class _ScrapyAgent:
expected_size, maxsize, request, expected=True
)
logger.warning(warning_msg)
txresponse._transport.loseConnection()
# Abort connection immediately.
txresponse._transport._producer.abortConnection()
raise DownloadCancelledError(warning_msg)
if warnsize and expected_size > warnsize: