Software / code / prosody
Comparison
plugins/mod_c2s.lua @ 8846:7ec098b68042 0.10.2
Merge 0.9->0.10
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Wed, 30 May 2018 21:55:09 +0100 |
| parent | 8819:780d728f969f |
| parent | 8844:29c6d2681bad |
| child | 8847:74526c425dec |
comparison
equal
deleted
inserted
replaced
| 8842:463505cc75d5 | 8846:7ec098b68042 |
|---|---|
| 47 --- Stream events handlers | 47 --- Stream events handlers |
| 48 local stream_xmlns_attr = {xmlns='urn:ietf:params:xml:ns:xmpp-streams'}; | 48 local stream_xmlns_attr = {xmlns='urn:ietf:params:xml:ns:xmpp-streams'}; |
| 49 | 49 |
| 50 function stream_callbacks.streamopened(session, attr) | 50 function stream_callbacks.streamopened(session, attr) |
| 51 local send = session.send; | 51 local send = session.send; |
| 52 session.host = nameprep(attr.to); | 52 local host = nameprep(attr.to); |
| 53 if not session.host then | 53 if not host then |
| 54 session:close{ condition = "improper-addressing", | 54 session:close{ condition = "improper-addressing", |
| 55 text = "A valid 'to' attribute is required on stream headers" }; | 55 text = "A valid 'to' attribute is required on stream headers" }; |
| 56 return; | |
| 57 end | |
| 58 if not session.host then | |
| 59 session.host = host; | |
| 60 elseif session.host ~= host then | |
| 61 session:close{ condition = "not-authorized", | |
| 62 text = "The 'to' attribute must remain the same across stream restarts" }; | |
| 56 return; | 63 return; |
| 57 end | 64 end |
| 58 session.version = tonumber(attr.version) or 0; | 65 session.version = tonumber(attr.version) or 0; |
| 59 session.streamid = uuid_generate(); | 66 session.streamid = uuid_generate(); |
| 60 (session.log or session)("debug", "Client sent opening <stream:stream> to %s", session.host); | 67 (session.log or session)("debug", "Client sent opening <stream:stream> to %s", session.host); |