Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
1dbc2ed4 by Philipp Hörist at 2023-01-01T22:12:01+01:00
cfix: HTTP: Handle case where sniffer omits content-type
- - - - -
c3b9bd4e by Philipp Hörist at 2023-01-01T22:21:38+01:00
cfix: HTTP: Store lost content-length again
- - - - -
1 changed file:
- nbxmpp/http.py
Changes:
=====================================
nbxmpp/http.py
=====================================
@@ -403,7 +403,7 @@ class HTTPRequest(GObject.GObject):
def _on_content_sniffed(self,
message: Soup.Message,
- content_type: str,
+ content_type: Optional[str],
_params: GLib.HashTable,
) -> None:
@@ -419,7 +419,14 @@ class HTTPRequest(GObject.GObject):
self.cancel()
return
- self._response_content_type = content_type
+ self._response_content_length = headers.get_content_length()
+
+ if content_type is None:
+ # According to the docs, content_type is None when the sniffer
+ # decides to trust the content-type sent by the server.
+ self._response_content_type = headers.get_content_type()
+ else:
+ self._response_content_type = content_type
self._log.info('Sniffed: content-type: %s, content-length: %s',
self._response_content_type,
View it on GitLab:
https://dev.gajim.org/gajim/python-nbxmpp/-/compare/156a365a688f7e5071c2d1a6fa36d3d5227dc4f4...c3b9bd4e7ed989ed1bfe78620748fbe97aebb129
--
View it on GitLab:
https://dev.gajim.org/gajim/python-nbxmpp/-/compare/156a365a688f7e5071c2d1a6fa36d3d5227dc4f4...c3b9bd4e7ed989ed1bfe78620748fbe97aebb129
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits