Software /
code /
prosody
Comparison
net/httpserver.lua @ 2371:7ddb8ce0cd0b
net.httpserver: Fix usage of old connection API syntax
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 17 Dec 2009 20:10:11 +0000 |
parent | 2360:f1832bf27f84 |
child | 2399:0325f241a26c |
comparison
equal
deleted
inserted
replaced
2370:d783c8de379d | 2371:7ddb8ce0cd0b |
---|---|
181 | 181 |
182 request.method, request.path, request.httpversion = method, path, http; | 182 request.method, request.path, request.httpversion = method, path, http; |
183 | 183 |
184 request.url = url_parse(request.path); | 184 request.url = url_parse(request.path); |
185 | 185 |
186 log("debug", method.." request for "..tostring(request.path) .. " on port "..request.handler.serverport()); | 186 log("debug", method.." request for "..tostring(request.path) .. " on port "..request.handler:serverport()); |
187 | 187 |
188 if request.onlystatus then | 188 if request.onlystatus then |
189 if not call_callback(request) then | 189 if not call_callback(request) then |
190 return; | 190 return; |
191 end | 191 end |
199 end | 199 end |
200 end | 200 end |
201 | 201 |
202 -- The default handler for requests | 202 -- The default handler for requests |
203 default_handler = function (method, body, request) | 203 default_handler = function (method, body, request) |
204 log("debug", method.." request for "..tostring(request.path) .. " on port "..request.handler.serverport()); | 204 log("debug", method.." request for "..tostring(request.path) .. " on port "..request.handler:serverport()); |
205 return { status = "404 Not Found", | 205 return { status = "404 Not Found", |
206 headers = { ["Content-Type"] = "text/html" }, | 206 headers = { ["Content-Type"] = "text/html" }, |
207 body = "<html><head><title>Page Not Found</title></head><body>Not here :(</body></html>" }; | 207 body = "<html><head><title>Page Not Found</title></head><body>Not here :(</body></html>" }; |
208 end | 208 end |
209 | 209 |
227 log("debug", "Request has destroy callback"); | 227 log("debug", "Request has destroy callback"); |
228 request.on_destroy(request); | 228 request.on_destroy(request); |
229 else | 229 else |
230 log("debug", "Request has no destroy callback"); | 230 log("debug", "Request has no destroy callback"); |
231 end | 231 end |
232 request.handler.close() | 232 request.handler:close() |
233 if request.conn then | 233 if request.conn then |
234 listener.ondisconnect(request.handler, "closed"); | 234 listener.ondisconnect(request.handler, "closed"); |
235 end | 235 end |
236 end | 236 end |
237 end | 237 end |