Software / code / prosody
Comparison
plugins/mod_bosh.lua @ 7380:d24d88feed76
mod_bosh: Return a proper BOSH error response from XML parse error callback (see #343)
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 19 Apr 2016 12:19:15 +0200 |
| parent | 7379:250855633092 |
| child | 7381:a05bf94646ba |
comparison
equal
deleted
inserted
replaced
| 7379:250855633092 | 7380:d24d88feed76 |
|---|---|
| 410 | 410 |
| 411 function stream_callbacks.error(context, error) | 411 function stream_callbacks.error(context, error) |
| 412 log("debug", "Error parsing BOSH request payload; %s", error); | 412 log("debug", "Error parsing BOSH request payload; %s", error); |
| 413 if not context.sid then | 413 if not context.sid then |
| 414 local response = context.response; | 414 local response = context.response; |
| 415 response.status_code = 400; | 415 local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", |
| 416 response:send(); | 416 ["xmlns:stream"] = xmlns_streams, condition = "bad-request" }); |
| 417 response:send(tostring(close_reply)); | |
| 417 return; | 418 return; |
| 418 end | 419 end |
| 419 | 420 |
| 420 local session = sessions[context.sid]; | 421 local session = sessions[context.sid]; |
| 421 if error == "stream-error" then -- Remote stream error, we close normally | 422 if error == "stream-error" then -- Remote stream error, we close normally |