Comparison

plugins/mod_c2s.lua @ 8847:74526c425dec

Merge 0.10->trunk
author Matthew Wild <mwild1@gmail.com>
date Wed, 30 May 2018 22:43:45 +0100
parent 8820:1348a931528a
parent 8846:7ec098b68042
child 9490:6e4fbd12c11c
comparison
equal deleted inserted replaced
8843:041ddc670934 8847:74526c425dec
54 --- Stream events handlers 54 --- Stream events handlers
55 local stream_xmlns_attr = {xmlns='urn:ietf:params:xml:ns:xmpp-streams'}; 55 local stream_xmlns_attr = {xmlns='urn:ietf:params:xml:ns:xmpp-streams'};
56 56
57 function stream_callbacks.streamopened(session, attr) 57 function stream_callbacks.streamopened(session, attr)
58 local send = session.send; 58 local send = session.send;
59 session.host = nameprep(attr.to); 59 local host = nameprep(attr.to);
60 if not session.host then 60 if not host then
61 session:close{ condition = "improper-addressing", 61 session:close{ condition = "improper-addressing",
62 text = "A valid 'to' attribute is required on stream headers" }; 62 text = "A valid 'to' attribute is required on stream headers" };
63 return;
64 end
65 if not session.host then
66 session.host = host;
67 elseif session.host ~= host then
68 session:close{ condition = "not-authorized",
69 text = "The 'to' attribute must remain the same across stream restarts" };
63 return; 70 return;
64 end 71 end
65 session.version = tonumber(attr.version) or 0; 72 session.version = tonumber(attr.version) or 0;
66 session.streamid = uuid_generate(); 73 session.streamid = uuid_generate();
67 (session.log or session)("debug", "Client sent opening <stream:stream> to %s", session.host); 74 (session.log or session)("debug", "Client sent opening <stream:stream> to %s", session.host);