Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/python-nbxmpp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/nbxmpp
diff options
context:
space:
mode:
authorPhilipp Hörist <philipp@hoerist.com>2023-05-28 15:47:44 +0300
committerPhilipp Hörist <philipp@hoerist.com>2023-05-28 15:47:44 +0300
commit84742678227a6153120393366bca6af67f09ac25 (patch)
tree7f4ee43a114f0dcdbf58d88c81356f58fefbd253 /nbxmpp
parent13e0e3b68135d7af25de12cf6e8f472db030542d (diff)
fix: HTTP: Abort correctly on content overflow
Diffstat (limited to 'nbxmpp')
-rw-r--r--nbxmpp/http.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/nbxmpp/http.py b/nbxmpp/http.py
index 27cf4fa..9875651 100644
--- a/nbxmpp/http.py
+++ b/nbxmpp/http.py
@@ -373,7 +373,8 @@ class HTTPRequest(GObject.GObject):
return
self._received_size += len(bytes_)
- self._check_content_overflow()
+ if self._check_content_overflow():
+ return
if self._output_stream is None:
self._response_body_data += bytes_
@@ -447,9 +448,11 @@ class HTTPRequest(GObject.GObject):
self.emit('response-progress',
self._received_size / self._response_content_length)
- def _check_content_overflow(self) -> None:
+ def _check_content_overflow(self) -> bool:
if self._received_size > self._response_content_length:
self._finish_read(HTTPRequestError.CONTENT_OVERFLOW)
+ return True
+ return False
def _on_restarted(self, _message: Soup.Message) -> None:
self._log.info('Restarted')