Mercurial > prosody-hg
comparison plugins/mod_bosh.lua @ 11125:5bcddab1659b
Merge 0.11->trunk
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 03 Oct 2020 15:07:48 +0200 |
| parents | 2764beb552cd 1aea75b63d0a |
| children | cc6b1dab01a2 |
comparison
equal
deleted
inserted
replaced
| 11122:d60094d9b458 | 11125:5bcddab1659b |
|---|---|
| 280 response:send(tostring(close_reply)); | 280 response:send(tostring(close_reply)); |
| 281 return; | 281 return; |
| 282 end | 282 end |
| 283 | 283 |
| 284 local to_host = nameprep(attr.to); | 284 local to_host = nameprep(attr.to); |
| 285 local wait = tonumber(attr.wait); | |
| 286 if not to_host then | 285 if not to_host then |
| 287 log("debug", "BOSH client tried to connect to invalid host: %s", attr.to); | 286 log("debug", "BOSH client tried to connect to invalid host: %s", attr.to); |
| 288 report_bad_host(); | 287 report_bad_host(); |
| 289 local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", | 288 local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", |
| 290 ["xmlns:stream"] = xmlns_streams, condition = "improper-addressing" }); | 289 ["xmlns:stream"] = xmlns_streams, condition = "improper-addressing" }); |
| 291 response:send(tostring(close_reply)); | 290 response:send(tostring(close_reply)); |
| 292 return; | 291 return; |
| 293 end | 292 end |
| 293 | |
| 294 if not prosody.hosts[to_host] then | |
| 295 log("debug", "BOSH client tried to connect to non-existant host: %s", attr.to); | |
| 296 local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", | |
| 297 ["xmlns:stream"] = xmlns_streams, condition = "improper-addressing" }); | |
| 298 response:send(tostring(close_reply)); | |
| 299 return; | |
| 300 end | |
| 301 | |
| 302 if prosody.hosts[to_host].type ~= "local" then | |
| 303 log("debug", "BOSH client tried to connect to %s host: %s", prosody.hosts[to_host].type, attr.to); | |
| 304 local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", | |
| 305 ["xmlns:stream"] = xmlns_streams, condition = "improper-addressing" }); | |
| 306 response:send(tostring(close_reply)); | |
| 307 return; | |
| 308 end | |
| 309 | |
| 310 local wait = tonumber(attr.wait); | |
| 294 if not rid or (not attr.wait or not wait or wait < 0 or wait % 1 ~= 0) then | 311 if not rid or (not attr.wait or not wait or wait < 0 or wait % 1 ~= 0) then |
| 295 log("debug", "BOSH client sent invalid rid or wait attributes: rid=%s, wait=%s", attr.rid, attr.wait); | 312 log("debug", "BOSH client sent invalid rid or wait attributes: rid=%s, wait=%s", attr.rid, attr.wait); |
| 296 local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", | 313 local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", |
| 297 ["xmlns:stream"] = xmlns_streams, condition = "bad-request" }); | 314 ["xmlns:stream"] = xmlns_streams, condition = "bad-request" }); |
| 298 response:send(tostring(close_reply)); | 315 response:send(tostring(close_reply)); |
