Mercurial > prosody-modules
annotate mod_http_prebind/mod_http_prebind.lua @ 5476:575f52b15f5a
mod_http_oauth2: Return OAuth error for authz code store error
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 18 May 2023 14:07:37 +0200 |
parents | 495a23d61418 |
children |
rev | line source |
---|---|
4229
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
1 module:depends("http"); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
2 |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
3 local http = require "net.http"; |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
4 local format = require "util.format".format; |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
5 local json_encode = require "util.json".encode; |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
6 local promise = require "util.promise"; |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
7 local xml = require "util.xml"; |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
8 local t_insert = table.insert; |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
9 |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
10 local function new_options(host) |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
11 return { |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
12 headers = { |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
13 ["Content-Type"] = "text/xml; charset=utf-8", |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
14 ["Host"] = host, |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
15 }, |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
16 method = "POST", |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
17 }; |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
18 end |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
19 |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
20 local function connect_to_bosh(url, hostname) |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
21 local rid = math.random(100000, 100000000) |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
22 local options = new_options(hostname); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
23 options.body = format([[<body content='text/xml; charset=utf-8' |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
24 hold='1' |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
25 rid='%d' |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
26 to='%s' |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
27 wait='60' |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
28 xml:lang='en' |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
29 xmpp:version='1.0' |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
30 xmlns='http://jabber.org/protocol/httpbind' |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
31 xmlns:xmpp='urn:xmpp:xbosh'/>]], rid, hostname); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
32 local rid = rid + 1; |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
33 return promise.new(function (on_fulfilled, on_error) |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
34 assert(http.request(url, options, function (body, code) |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
35 if code ~= 200 then |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
36 on_error("Failed to fetch, HTTP error code "..code); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
37 return; |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
38 end |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
39 local body = xml.parse(body); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
40 local sid = body.attr.sid; |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
41 local mechanisms = {}; |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
42 for mechanism in body:get_child("features", "http://etherx.jabber.org/streams") |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
43 :get_child("mechanisms", "urn:ietf:params:xml:ns:xmpp-sasl") |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
44 :childtags("mechanism", "urn:ietf:params:xml:ns:xmpp-sasl") do |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
45 mechanisms[mechanism:get_text()] = true; |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
46 end |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
47 on_fulfilled({ url = url, sid = sid, rid = rid, mechanisms = mechanisms }); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
48 end)); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
49 end); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
50 end |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
51 |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
52 local function authenticate(data) |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
53 local options = new_options(); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
54 options.body = format([[<body sid='%s' |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
55 rid='%d' |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
56 xmlns='http://jabber.org/protocol/httpbind'> |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
57 <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
58 mechanism='ANONYMOUS'/> |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
59 </body>]], data.sid, data.rid); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
60 data.rid = data.rid + 1; |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
61 return promise.new(function (on_fulfilled, on_error) |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
62 if data.mechanisms["ANONYMOUS"] == nil then |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
63 on_error("No SASL ANONYMOUS mechanism supported on this host."); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
64 return; |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
65 end |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
66 assert(http.request(data.url, options, function (body, code) |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
67 if code ~= 200 then |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
68 on_error("Failed to fetch, HTTP error code "..code); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
69 return; |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
70 end |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
71 local body = xml.parse(body); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
72 local success = body:get_child("success", "urn:ietf:params:xml:ns:xmpp-sasl"); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
73 if success then |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
74 data.mechanisms = nil; |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
75 on_fulfilled(data); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
76 else |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
77 on_error("Authentication failed."); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
78 end |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
79 end)); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
80 end); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
81 end; |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
82 |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
83 local function restart_stream(data) |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
84 local options = new_options(); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
85 options.body = format([[ |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
86 <body sid='%s' |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
87 rid='%d' |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
88 xml:lang='en' |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
89 xmlns='http://jabber.org/protocol/httpbind' |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
90 xmlns:xmpp='urn:xmpp:xbosh' |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
91 xmpp:restart='true'/>]], data.sid, data.rid); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
92 data.rid = data.rid + 1; |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
93 return promise.new(function (on_fulfilled, on_error) |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
94 assert(http.request(data.url, options, function (body, code) |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
95 if code ~= 200 then |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
96 on_error("Failed to fetch, HTTP error code "..code); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
97 return; |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
98 end |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
99 local body = xml.parse(body); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
100 on_fulfilled(data); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
101 end)); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
102 end); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
103 end; |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
104 |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
105 local function bind(data) |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
106 local options = new_options(); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
107 options.body = format([[ |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
108 <body sid='%s' |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
109 rid='%d' |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
110 xmlns='http://jabber.org/protocol/httpbind'> |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
111 <iq xmlns='jabber:client' |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
112 type='set'> |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
113 <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/> |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
114 </iq> |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
115 </body>]], data.sid, data.rid); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
116 data.rid = data.rid + 1; |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
117 return promise.new(function (on_fulfilled, on_error) |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
118 assert(http.request(data.url, options, function (body, code) |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
119 if code ~= 200 then |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
120 on_error("Failed to fetch, HTTP error code "..code); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
121 return; |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
122 end |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
123 local body = xml.parse(body); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
124 local jid = body:get_child("iq", "jabber:client") |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
125 :get_child("bind", "urn:ietf:params:xml:ns:xmpp-bind") |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
126 :get_child_text("jid", "urn:ietf:params:xml:ns:xmpp-bind"); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
127 on_fulfilled(json_encode({rid = data.rid, sid = data.sid, jid = jid})); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
128 end)); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
129 end); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
130 end; |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
131 |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
132 module:provides("http", { |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
133 route = { |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
134 ["GET"] = function (event) |
4230
495a23d61418
mod_http_prebind: Stop hardcoding test domain
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4229
diff
changeset
|
135 return connect_to_bosh("http://[::1]:5280/http-bind", module.host) |
4229
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
136 :next(authenticate) |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
137 :next(restart_stream) |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
138 :next(bind); |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
139 end; |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
140 }; |
3943032533a7
mod_http_prebind: New module
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
141 }); |