From 89ab76757035ad6251c2113a595829fa93e4efb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Sun, 21 May 2023 14:03:05 +0200 Subject: feat: Add option to force http1 --- nbxmpp/http.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/nbxmpp/http.py b/nbxmpp/http.py index 25e3c10..455fb30 100644 --- a/nbxmpp/http.py +++ b/nbxmpp/http.py @@ -73,8 +73,8 @@ class HTTPSession: self._session.set_proxy_resolver(resolver) - def create_request(self) -> HTTPRequest: - return HTTPRequest(self) + def create_request(self, force_http1: bool = False) -> HTTPRequest: + return HTTPRequest(self, force_http1=force_http1) class HTTPRequest(GObject.GObject): @@ -90,7 +90,10 @@ class HTTPRequest(GObject.GObject): 'destroy': (SIGNAL_ACTIONS, None, ()), } - def __init__(self, session: HTTPSession) -> None: + def __init__(self, + session: HTTPSession, + force_http1: bool = False + ) -> None: GObject.GObject.__init__(self) self._log = HTTPLogAdapter(log, extra={'request': self}) @@ -126,6 +129,7 @@ class HTTPRequest(GObject.GObject): self._emit_response_progress = False self._message = Soup.Message() + self._message.set_force_http1(force_http1) self._user_data = None self._log.info('Created') @@ -311,6 +315,8 @@ class HTTPRequest(GObject.GObject): result: Gio.AsyncResult ) -> None: + self._log.info('HTTP version: %s', + self._message.get_http_version().value_name) self._log.info('Request response received') try: self._input_stream = session.send_finish(result) -- cgit v1.2.3