Software /
code /
prosody
Comparison
net/httpserver.lua @ 4658:de04897cb8fe
net.httpserver: Comment dependency on connlisteners. Further cleanup to follow.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Sun, 22 Apr 2012 23:43:34 +0500 |
parent | 4446:d1d4d8c8a2a9 |
comparison
equal
deleted
inserted
replaced
4657:281596cc53d3 | 4658:de04897cb8fe |
---|---|
8 | 8 |
9 | 9 |
10 local url_parse = require "socket.url".parse; | 10 local url_parse = require "socket.url".parse; |
11 local httpstream_new = require "util.httpstream".new; | 11 local httpstream_new = require "util.httpstream".new; |
12 | 12 |
13 local connlisteners_start = require "net.connlisteners".start; | 13 --local connlisteners_start = require "net.connlisteners".start; |
14 local connlisteners_get = require "net.connlisteners".get; | 14 --local connlisteners_get = require "net.connlisteners".get; |
15 local listener; | 15 local listener; |
16 | 16 |
17 local t_insert, t_concat = table.insert, table.concat; | 17 local t_insert, t_concat = table.insert, table.concat; |
18 local tonumber, tostring, pairs, ipairs, type = tonumber, tostring, pairs, ipairs, type; | 18 local tonumber, tostring, pairs, ipairs, type = tonumber, tostring, pairs, ipairs, type; |
19 local xpcall = xpcall; | 19 local xpcall = xpcall; |
162 }; | 162 }; |
163 end | 163 end |
164 | 164 |
165 function destroy_request(request) | 165 function destroy_request(request) |
166 log("debug", "Destroying request %s", request.id); | 166 log("debug", "Destroying request %s", request.id); |
167 listener = listener or connlisteners_get("httpserver"); | 167 --listener = listener or connlisteners_get("httpserver"); |
168 if not request.destroyed then | 168 if not request.destroyed then |
169 request.destroyed = true; | 169 request.destroyed = true; |
170 if request.on_destroy then | 170 if request.on_destroy then |
171 log("debug", "Request has destroy callback"); | 171 log("debug", "Request has destroy callback"); |
172 request.on_destroy(request); | 172 request.on_destroy(request); |
184 local http_server = http_servers[params.port]; | 184 local http_server = http_servers[params.port]; |
185 if not http_server then | 185 if not http_server then |
186 http_server = { handlers = {} }; | 186 http_server = { handlers = {} }; |
187 http_servers[params.port] = http_server; | 187 http_servers[params.port] = http_server; |
188 -- We weren't already listening on this port, so start now | 188 -- We weren't already listening on this port, so start now |
189 connlisteners_start("httpserver", params); | 189 --connlisteners_start("httpserver", params); |
190 end | 190 end |
191 if params.base then | 191 if params.base then |
192 http_server.handlers[params.base] = params.handler; | 192 http_server.handlers[params.base] = params.handler; |
193 end | 193 end |
194 end | 194 end |