From 8ca3b888ad91a40757c4b9cc00aea1a2ccf6a36d Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Sat, 28 Jun 2008 17:03:47 +0000 Subject: [PATCH] * libs/httpd: Fixed a problem with empty sources in filehandler --- libs/httpd/luasrc/httpd/handler/file.lua | 12 ++++-------- libs/web/luasrc/dispatcher.lua | 1 + 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/libs/httpd/luasrc/httpd/handler/file.lua b/libs/httpd/luasrc/httpd/handler/file.lua index 790ebdd66..2ca3786ee 100644 --- a/libs/httpd/luasrc/httpd/handler/file.lua +++ b/libs/httpd/luasrc/httpd/handler/file.lua @@ -72,20 +72,16 @@ function Simple.handle_get(self, request, sourcein, sinkerr) } ), ltn12.source.file(io.open(file)) else - return Response( code, hdrs or { } ), - ltn12.source.empty() + return Response( code, hdrs or { } ) end else - return Response( code, hdrs or { } ), - ltn12.source.empty() + return Response( code, hdrs or { } ) end else - return Response( code, hdrs or { } ), - ltn12.source.empty() + return Response( code, hdrs or { } ) end else - return Response( code, hdrs or { } ), - ltn12.source.empty() + return Response( code, hdrs or { } ) end else return self:failure(403, "Unable to transmit " .. stat.type .. " " .. file) diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua index 989eb4402..426dd66bd 100644 --- a/libs/web/luasrc/dispatcher.lua +++ b/libs/web/luasrc/dispatcher.lua @@ -283,6 +283,7 @@ function createtree() local stat, err = luci.util.copcall(v) if not stat then error500("createtree failed: " .. k .. ": " .. err) + luci.http.close() os.exit(1) end end -- 2.11.0