Comparison

net/httpserver.lua @ 2570:9e69aecad25e

net.httpserver: Trailing whitespace
author Matthew Wild <mwild1@gmail.com>
date Mon, 08 Feb 2010 11:20:19 +0000
parent 2483:2f235c57d713
child 2571:8a16c5e92bcb
comparison
equal deleted inserted replaced
2569:8474ea768c89 2570:9e69aecad25e
205 end 205 end
206 206
207 -- The default handler for requests 207 -- The default handler for requests
208 default_handler = function (method, body, request) 208 default_handler = function (method, body, request)
209 log("debug", method.." request for "..tostring(request.path) .. " on port "..request.handler:serverport()); 209 log("debug", method.." request for "..tostring(request.path) .. " on port "..request.handler:serverport());
210 return { status = "404 Not Found", 210 return { status = "404 Not Found",
211 headers = { ["Content-Type"] = "text/html" }, 211 headers = { ["Content-Type"] = "text/html" },
212 body = "<html><head><title>Page Not Found</title></head><body>Not here :(</body></html>" }; 212 body = "<html><head><title>Page Not Found</title></head><body>Not here :(</body></html>" };
213 end 213 end
214 214
215 215
216 function new_request(handler) 216 function new_request(handler)
217 return { handler = handler, conn = handler.socket, 217 return { handler = handler, conn = handler.socket,
218 write = function (...) return handler:write(...); end, state = "request", 218 write = function (...) return handler:write(...); end, state = "request",
219 server = http_servers[handler:serverport()], 219 server = http_servers[handler:serverport()],
220 send = send_response, 220 send = send_response,
221 destroy = destroy_request, 221 destroy = destroy_request,
222 id = tostring{}:match("%x+$") 222 id = tostring{}:match("%x+$")
223 }; 223 };