Mercurial > prosody-hg
comparison core/sessionmanager.lua @ 2751:1d7746c3a8c6
sessionmanager: Return stream error when incoming stream header is missing 'to' attribute
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sun, 14 Mar 2010 02:59:16 +0000 |
| parents | 4a6f32e6a8e5 |
| children | 18d8009f06cb |
comparison
equal
deleted
inserted
replaced
| 2750:4a6f32e6a8e5 | 2751:1d7746c3a8c6 |
|---|---|
| 179 return true; | 179 return true; |
| 180 end | 180 end |
| 181 | 181 |
| 182 function streamopened(session, attr) | 182 function streamopened(session, attr) |
| 183 local send = session.send; | 183 local send = session.send; |
| 184 session.host = attr.to or error("Client failed to specify destination hostname"); | 184 session.host = attr.to; |
| 185 if not session.host then | |
| 186 session:close{ condition = "improper-addressing", | |
| 187 text = "A 'to' attribute is required on stream headers" }; | |
| 188 return; | |
| 189 end | |
| 185 session.host = nameprep(session.host); | 190 session.host = nameprep(session.host); |
| 186 session.version = tonumber(attr.version) or 0; | 191 session.version = tonumber(attr.version) or 0; |
| 187 session.streamid = uuid_generate(); | 192 session.streamid = uuid_generate(); |
| 188 (session.log or session)("debug", "Client sent opening <stream:stream> to %s", session.host); | 193 (session.log or session)("debug", "Client sent opening <stream:stream> to %s", session.host); |
| 189 | 194 |
