Mercurial > prosody-hg
comparison plugins/mod_bosh.lua @ 5031:28d56268a72d
mod_bosh: Backout revision bc0a68cae236 (experimental bosh_auto_cork option) as I don't believe it works
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sat, 28 Jul 2012 18:50:04 +0100 |
| parents | ab693eea0869 |
| children | 16c7b510694b |
comparison
equal
deleted
inserted
replaced
| 5030:9962fc19f9e9 | 5031:28d56268a72d |
|---|---|
| 30 local BOSH_DEFAULT_INACTIVITY = module:get_option_number("bosh_max_inactivity", 60); | 30 local BOSH_DEFAULT_INACTIVITY = module:get_option_number("bosh_max_inactivity", 60); |
| 31 local BOSH_DEFAULT_POLLING = module:get_option_number("bosh_max_polling", 5); | 31 local BOSH_DEFAULT_POLLING = module:get_option_number("bosh_max_polling", 5); |
| 32 local BOSH_DEFAULT_REQUESTS = module:get_option_number("bosh_max_requests", 2); | 32 local BOSH_DEFAULT_REQUESTS = module:get_option_number("bosh_max_requests", 2); |
| 33 | 33 |
| 34 local consider_bosh_secure = module:get_option_boolean("consider_bosh_secure"); | 34 local consider_bosh_secure = module:get_option_boolean("consider_bosh_secure"); |
| 35 local auto_cork = module:get_option_boolean("bosh_auto_cork", false); | |
| 36 | 35 |
| 37 local default_headers = { ["Content-Type"] = "text/xml; charset=utf-8" }; | 36 local default_headers = { ["Content-Type"] = "text/xml; charset=utf-8" }; |
| 38 | 37 |
| 39 local cross_domain = module:get_option("cross_domain_bosh", false); | 38 local cross_domain = module:get_option("cross_domain_bosh", false); |
| 40 if cross_domain then | 39 if cross_domain then |
| 262 s = st.clone(s); | 261 s = st.clone(s); |
| 263 s.attr.xmlns = "jabber:client"; | 262 s.attr.xmlns = "jabber:client"; |
| 264 end | 263 end |
| 265 --log("debug", "Sending BOSH data: %s", tostring(s)); | 264 --log("debug", "Sending BOSH data: %s", tostring(s)); |
| 266 local oldest_request = r[1]; | 265 local oldest_request = r[1]; |
| 267 if oldest_request and (not(auto_cork) or waiting_requests[oldest_request]) then | 266 if oldest_request then |
| 268 log("debug", "We have an open request, so sending on that"); | 267 log("debug", "We have an open request, so sending on that"); |
| 269 oldest_request.headers = default_headers; | 268 oldest_request.headers = default_headers; |
| 270 oldest_request:send(t_concat({ | 269 oldest_request:send(t_concat({ |
| 271 "<body xmlns='http://jabber.org/protocol/httpbind' ", | 270 "<body xmlns='http://jabber.org/protocol/httpbind' ", |
| 272 session.bosh_terminate and "type='terminate' " or "", | 271 session.bosh_terminate and "type='terminate' " or "", |
