Philipp Hörist pushed to branch master at gajim / python-nbxmpp


Commits:
89ab7675 by Philipp Hörist at 2023-05-21T14:03:05+02:00
feat: Add option to force http1

- - - - -


1 changed file:

- nbxmpp/http.py


Changes:

=====================================
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)



View it on GitLab: 
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/89ab76757035ad6251c2113a595829fa93e4efb9

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/89ab76757035ad6251c2113a595829fa93e4efb9
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

Reply via email to