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


Commits:
eec01dea by Philipp Hörist at 2023-07-04T21:42:31+02:00
fix: HTTP: Add set_accept_certificate()

- - - - -


1 changed file:

- nbxmpp/http.py


Changes:

=====================================
nbxmpp/http.py
=====================================
@@ -112,6 +112,7 @@ class HTTPRequest(GObject.GObject):
         self._is_complete = False
         self._timeout_reached = False
         self._timeout_id = None
+        self._accept_certificate_func = None
 
         self._response_body_file: Optional[Gio.File] = None
         self._response_body_data = b''
@@ -183,6 +184,9 @@ class HTTPRequest(GObject.GObject):
         self._log.info('Cancel requested')
         self._cancellable.cancel()
 
+    def set_accept_certificate_func(self, func: Any) -> None:
+        self._accept_certificate_func = func
+
     def set_request_body_from_path(self, content_type: str, path: Path) -> 
None:
         if not path.exists():
             raise ValueError('%s does not exist' % path)
@@ -285,6 +289,8 @@ class HTTPRequest(GObject.GObject):
         self._message.connect('restarted', self._on_restarted)
         self._message.connect('finished', self._on_finished)
         self._message.connect('got-headers', self._on_got_headers)
+        if self._accept_certificate_func is not None:
+            self._message.connect('accept-certificate', 
self._accept_certificate_func)
 
         soup_session = self._session.get_soup_session()
         soup_session.send_async(self._message,



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

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

Reply via email to