Philipp Hörist pushed to branch master at gajim / gajim
Commits:
63cf6b24 by Philipp Hörist at 2025-11-16T23:01:53+01:00
cfix: HTTP: Return result also for empty response bodys
- - - - -
1 changed file:
- gajim/common/multiprocess/http.py
Changes:
=====================================
gajim/common/multiprocess/http.py
=====================================
@@ -225,14 +225,14 @@ def _read_file_generator() -> Iterable[bytes]:
if event.is_set():
raise CancelledError
- content_length, content_type = get_header_values(resp.headers)
-
try:
resp.raise_for_status()
except httpx.HTTPStatusError:
# https://github.com/encode/httpx/issues/1990
raise HTTPStatusError(f"{resp.status_code} {resp.reason_phrase}")
+ content_length, content_type = get_header_values(resp.headers)
+
queue.put(
TransferMetadata(
id=ft_id, content_length=content_length, content_type=content_type
@@ -240,7 +240,14 @@ def _read_file_generator() -> Iterable[bytes]:
)
if content_length == 0:
- raise OverflowError("No content length available")
+ return HTTPResult(
+ hash_algo=hash_algo,
+ req_hash_value=req_hash_obj.hexdigest(),
+ resp_hash_value="",
+ content_length=content_length,
+ content_type=content_type,
+ content=b"",
+ )
if max_content_length >= 0 and content_length > max_content_length:
raise MaxContentLengthExceeded(content_length)
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/63cf6b24b774e2cc6f293c11cc1958b4f3ecbdf8
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/63cf6b24b774e2cc6f293c11cc1958b4f3ecbdf8
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]