plugins/mod_bosh.lua

changeset 2473
3f4cfa375bd6
parent 2467
8098310d0dfd
child 2484
cf924f587410
equal deleted inserted replaced
2472:cde876604bb7 2473:3f4cfa375bd6
61 61
62 function handle_request(method, body, request) 62 function handle_request(method, body, request)
63 if (not body) or request.method ~= "POST" then 63 if (not body) or request.method ~= "POST" then
64 return "<html><body>You really don't look like a BOSH client to me... what do you want?</body></html>"; 64 return "<html><body>You really don't look like a BOSH client to me... what do you want?</body></html>";
65 end 65 end
66 if not method then 66 if not method then
67 log("debug", "Request %s suffered error %s", tostring(request.id), body); 67 log("debug", "Request %s suffered error %s", tostring(request.id), body);
68 return; 68 return;
69 end 69 end
70 --log("debug", "Handling new request %s: %s\n----------", request.id, tostring(body)); 70 --log("debug", "Handling new request %s: %s\n----------", request.id, tostring(body));
71 request.notopen = true; 71 request.notopen = true;
186 -- Send creation response 186 -- Send creation response
187 187
188 local features = st.stanza("stream:features"); 188 local features = st.stanza("stream:features");
189 fire_event("stream-features", session, features); 189 fire_event("stream-features", session, features);
190 --xmpp:version='1.0' xmlns:xmpp='urn:xmpp:xbosh' 190 --xmpp:version='1.0' xmlns:xmpp='urn:xmpp:xbosh'
191 local response = st.stanza("body", { xmlns = xmlns_bosh, 191 local response = st.stanza("body", { xmlns = xmlns_bosh,
192 inactivity = tostring(BOSH_DEFAULT_INACTIVITY), polling = tostring(BOSH_DEFAULT_POLLING), requests = tostring(BOSH_DEFAULT_REQUESTS), hold = tostring(session.bosh_hold), maxpause = "120", 192 inactivity = tostring(BOSH_DEFAULT_INACTIVITY), polling = tostring(BOSH_DEFAULT_POLLING), requests = tostring(BOSH_DEFAULT_REQUESTS), hold = tostring(session.bosh_hold), maxpause = "120",
193 sid = sid, authid = sid, ver = '1.6', from = session.host, secure = 'true', ["xmpp:version"] = "1.0", 193 sid = sid, authid = sid, ver = '1.6', from = session.host, secure = 'true', ["xmpp:version"] = "1.0",
194 ["xmlns:xmpp"] = "urn:xmpp:xbosh", ["xmlns:stream"] = "http://etherx.jabber.org/streams" }):add_child(features); 194 ["xmlns:xmpp"] = "urn:xmpp:xbosh", ["xmlns:stream"] = "http://etherx.jabber.org/streams" }):add_child(features);
195 request:send{ headers = default_headers, body = tostring(response) }; 195 request:send{ headers = default_headers, body = tostring(response) };
196 196
197 request.sid = sid; 197 request.sid = sid;
198 return; 198 return;
199 end 199 end
200 200
201 local session = sessions[sid]; 201 local session = sessions[sid];

mercurial