diff libervia/pages/chat/page_meta.py @ 1203:251eba911d4d

server (websockets): fixed websocket handling on HTTPS connections: Original request used to retrieve a page was stored on dynamic pages, but after the end of it, the channel was deleted, resulting in a isSecure() always returning False, and troubles in chain leading to the the use of the wrong session object. This patch fixes this by reworking the way original request is used, and creating a new wrapping class allowing to keep an API similar to iweb.IRequest, with data coming from both the original request and the websocket request. fix 327
author Goffi <goffi@goffi.org>
date Sun, 14 Jul 2019 14:45:51 +0200
parents 29eb15062416
children b2d067339de3
line wrap: on
line diff
--- a/libervia/pages/chat/page_meta.py	Fri Jul 12 14:58:11 2019 +0200
+++ b/libervia/pages/chat/page_meta.py	Sun Jul 14 14:45:51 2019 +0200
@@ -55,7 +55,7 @@
         join_ret = yield self.host.bridgeCall(
             u"mucJoin", target_jid.userhost(), "", "", profile
         )
-        already_joined, room_jid_s, occupants, user_nick, room_subject, dummy = join_ret
+        already_joined, room_jid_s, occupants, user_nick, room_subject, __ = join_ret
         template_data[u"subject"] = room_subject
         own_jid = jid.JID(room_jid_s)
         own_jid.resource = user_nick
@@ -81,7 +81,7 @@
         identities[author] = yield self.host.bridgeCall(u"identityGet", author, profile)
 
     template_data[u"messages"] = data_objects.Messages(history)
-    template_data[u"identities"] = identities
+    rdata[u'identities'] = template_data[u"identities"] = identities
     template_data[u"target_jid"] = target_jid
     template_data[u"chat_type"] = chat_type
 
@@ -116,11 +116,10 @@
 def on_signal(self, request, signal, *args):
     if signal == "messageNew":
         rdata = self.getRData(request)
-        template_data = request.template_data
         template_data_update = {u"msg": data_objects.Message((args))}
         target_jid = rdata["target"]
-        identities = template_data["identities"]
-        uid, timestamp, from_jid_s, to_jid_s, message, subject, mess_type, extra, dummy = (
+        identities = rdata["identities"]
+        uid, timestamp, from_jid_s, to_jid_s, message, subject, mess_type, extra, __ = (
             args
         )
         from_jid = jid.JID(from_jid_s)