# HG changeset patch # User jbe # Date 1422571238 -3600 # Node ID 6889aa20b19f77df519d948bc69ae1d134922d42 # Parent 891ceefb0876652354ef9c334f73a3cd4a090829 Code cleanup in example_application.lua; Removed memory limit in example_application.lua diff -r 891ceefb0876 -r 6889aa20b19f example_application.lua --- a/example_application.lua Thu Jan 29 22:07:58 2015 +0100 +++ b/example_application.lua Thu Jan 29 23:40:38 2015 +0100 @@ -45,7 +45,7 @@ idle_timeout = 0, -- seconds (0 for no timeout) -- maximum memory consumption before process gets terminated - memory_limit = 1024*1024, -- bytes + --memory_limit = 1024*1024, -- bytes -- preparation of process (executed after fork) prepare = function() @@ -59,6 +59,15 @@ }, function(request) + local function file_not_found() + request:send_status("404 Not Found") + request:send_header("Content-Type", "text/html; chatset=UTF-8") + request:send_data("\n") + request:send_data("404 Not Found\n") + request:send_data("

404 Not Found

\n") + request:send_data("\n") + end + if request.method == "GET" or request.method == "HEAD" then if request.path == "" then @@ -79,9 +88,7 @@ end request:send_data(document) else - request:send_status("404 Not Found") - request:send_header("Content-Type", "text/html; chatset=UTF-8") - request:send_data("404 Not Found

404 Not Found

") + file_not_found() end end @@ -129,10 +136,9 @@ request:send_data("\n\n") else - request:send_status("404 Not Found") - request:send_data("404 Not Found

404 Not Found

") + file_not_found() - end + end else request:send_text_status_response("405 Method not allowed")