Software /
code /
prosody
Comparison
net/httpserver.lua @ 2130:828e161cdfc7
net.httpserver, net.http: Update for new net.server API (untested)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 22 Nov 2009 04:44:26 +0000 |
parent | 2066:b3a640892549 |
child | 2274:6241da17f48d |
comparison
equal
deleted
inserted
replaced
2129:fcdcdf00787c | 2130:828e161cdfc7 |
---|---|
207 end | 207 end |
208 | 208 |
209 | 209 |
210 function new_request(handler) | 210 function new_request(handler) |
211 return { handler = handler, conn = handler.socket, | 211 return { handler = handler, conn = handler.socket, |
212 write = handler.write, state = "request", | 212 write = function (...) return handler:write(...); end, state = "request", |
213 server = http_servers[handler.serverport()], | 213 server = http_servers[handler.serverport()], |
214 send = send_response, | 214 send = send_response, |
215 destroy = destroy_request, | 215 destroy = destroy_request, |
216 id = tostring{}:match("%x+$") | 216 id = tostring{}:match("%x+$") |
217 }; | 217 }; |
228 else | 228 else |
229 log("debug", "Request has no destroy callback"); | 229 log("debug", "Request has no destroy callback"); |
230 end | 230 end |
231 request.handler.close() | 231 request.handler.close() |
232 if request.conn then | 232 if request.conn then |
233 listener.disconnect(request.handler, "closed"); | 233 listener.ondisconnect(request.handler, "closed"); |
234 end | 234 end |
235 end | 235 end |
236 end | 236 end |
237 | 237 |
238 function new(params) | 238 function new(params) |