# HG changeset patch # User jbe # Date 1422546782 -3600 # Node ID 96b6c31d72e3f0825dcf83bbb6b304e1dc3b3c77 # Parent 44a13f4b706f9d99863484397e548d88872986a2 Emptied prepare method and use request:send_text_status_response(...) in example_application.lua diff -r 44a13f4b706f -r 96b6c31d72e3 example_application.lua --- a/example_application.lua Thu Jan 29 16:34:48 2015 +0100 +++ b/example_application.lua Thu Jan 29 16:53:02 2015 +0100 @@ -3,7 +3,12 @@ local http = require "moonbridge_http" -local documents = {"example_webpage.html", "example_webpage.css"} +local documents = {} +for i, document_name in ipairs{"example_webpage.html", "example_webpage.css"} do + local file = assert(io.open(document)) + documents[document_name] = file:read("*a") + file:close() +end listen{ -- listen to a tcp version 4 socket @@ -44,11 +49,6 @@ -- preparation of process (executed after fork) prepare = function() - for i, document in ipairs(documents) do - local file = assert(io.open(document)) - documents[document] = file:read("*a") - file:close() - end end, -- connection handler @@ -135,7 +135,7 @@ end else - request:send_status("405 Method not allowed") + request:send_text_status_response("405 Method not allowed") end