Software /
code /
prosody
Diff
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 |
line wrap: on
line diff
--- a/plugins/mod_c2s.lua Wed May 30 21:40:00 2018 +0100 +++ b/plugins/mod_c2s.lua Wed May 30 22:43:45 2018 +0100 @@ -56,12 +56,19 @@ function stream_callbacks.streamopened(session, attr) local send = session.send; - session.host = nameprep(attr.to); - if not session.host then + local host = nameprep(attr.to); + if not host then session:close{ condition = "improper-addressing", text = "A valid 'to' attribute is required on stream headers" }; return; end + if not session.host then + session.host = host; + elseif session.host ~= host then + session:close{ condition = "not-authorized", + text = "The 'to' attribute must remain the same across stream restarts" }; + return; + end session.version = tonumber(attr.version) or 0; session.streamid = uuid_generate(); (session.log or session)("debug", "Client sent opening <stream:stream> to %s", session.host);