diff options
author | Philipp Hörist <philipp@hoerist.com> | 2023-05-21 15:03:05 +0300 |
---|---|---|
committer | Philipp Hörist <philipp@hoerist.com> | 2023-05-21 15:03:05 +0300 |
commit | 89ab76757035ad6251c2113a595829fa93e4efb9 (patch) | |
tree | 3f4335b4b26444e015efa8ac5491ae116c31a08f | |
parent | 618834af677a2011b4cc626cb5610fc944a16103 (diff) |
feat: Add option to force http1
-rw-r--r-- | nbxmpp/http.py | 12 |
1 files 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) |