Software / code / prosody
Comparison
plugins/mod_bosh.lua @ 10377:4c36bc28b99e
mod_bosh: Abort early if request is missing hostname
Prevents traceback from passing nil to nameprep()
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 02 Nov 2019 15:29:13 +0100 |
| parent | 10111:0f335815244f |
| child | 10728:2764beb552cd |
comparison
equal
deleted
inserted
replaced
| 10376:b337df192a10 | 10377:4c36bc28b99e |
|---|---|
| 269 log("debug", "BOSH body open (sid: %s)", sid or "<none>"); | 269 log("debug", "BOSH body open (sid: %s)", sid or "<none>"); |
| 270 context.rid = rid; | 270 context.rid = rid; |
| 271 if not sid then | 271 if not sid then |
| 272 -- New session request | 272 -- New session request |
| 273 context.notopen = nil; -- Signals that we accept this opening tag | 273 context.notopen = nil; -- Signals that we accept this opening tag |
| 274 | |
| 275 if not attr.to then | |
| 276 log("debug", "BOSH client tried to connect without specifying a host"); | |
| 277 report_bad_host(); | |
| 278 local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", | |
| 279 ["xmlns:stream"] = xmlns_streams, condition = "improper-addressing" }); | |
| 280 response:send(tostring(close_reply)); | |
| 281 return; | |
| 282 end | |
| 274 | 283 |
| 275 local to_host = nameprep(attr.to); | 284 local to_host = nameprep(attr.to); |
| 276 local wait = tonumber(attr.wait); | 285 local wait = tonumber(attr.wait); |
| 277 if not to_host then | 286 if not to_host then |
| 278 log("debug", "BOSH client tried to connect to invalid host: %s", attr.to); | 287 log("debug", "BOSH client tried to connect to invalid host: %s", attr.to); |