From dde882a440d450fb381a61c931e1284cbd044bac Mon Sep 17 00:00:00 2001 From: Felipe Daragon Date: Fri, 9 Oct 2015 15:28:24 -0300 Subject: [PATCH 1/2] Move LightTPD os.tmpname() bug workaround to index file --- src/sailor.lua | 8 -------- src/sailor/blank-app/index-magnet.lua | 9 ++++++++- test/dev-app/index-magnet.lua | 9 ++++++++- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/sailor.lua b/src/sailor.lua index 02379c9..e331055 100755 --- a/src/sailor.lua +++ b/src/sailor.lua @@ -37,14 +37,6 @@ function sailor.launch(native_request) -- Apache with CGILua or mod_pLua httpd = remy.httpd sailor.remy_mode = remy.init(sailor.remy_mode, native_request) - if sailor.remy_mode == remy.MODE_LIGHTTPD then - -- FIXME: os.tmpname(), used by web_utils\utils.lua not - -- working in LightTPD (affects Windows build only?) - -- This breaks every script using "session" - function os.tmpname() - return 'tmp' - end - end remy.contentheader('text/html') remy.run(sailor.handle_request) end diff --git a/src/sailor/blank-app/index-magnet.lua b/src/sailor/blank-app/index-magnet.lua index e45e62a..bead683 100644 --- a/src/sailor/blank-app/index-magnet.lua +++ b/src/sailor/blank-app/index-magnet.lua @@ -1,4 +1,4 @@ --- Alternative index for LightTPD's mod_magnet +-- Alternative index and launcher for LightTPD's mod_magnet if lighty ~= nil then -- Note: package.loaded.lighty ~= nil will not work because lighty is a -- local variable and not a package @@ -7,6 +7,13 @@ if lighty ~= nil then package.cpath = package.cpath..";"..docroot.."/../lib/clibs/?.dll" package.path = package.path..";"..docroot.."/sailor/?.lua" + -- FIXME: os.tmpname(), used by web_utils\utils.lua not + -- working in LightTPD (affects Windows build only?) + -- This breaks every script using "session" + function os.tmpname() + return 'tmp' + end + -- Makes lighty global so it can be accessed by Remy or controllers _G["lighty"] = lighty local sailor = require "sailor" diff --git a/test/dev-app/index-magnet.lua b/test/dev-app/index-magnet.lua index e45e62a..bead683 100644 --- a/test/dev-app/index-magnet.lua +++ b/test/dev-app/index-magnet.lua @@ -1,4 +1,4 @@ --- Alternative index for LightTPD's mod_magnet +-- Alternative index and launcher for LightTPD's mod_magnet if lighty ~= nil then -- Note: package.loaded.lighty ~= nil will not work because lighty is a -- local variable and not a package @@ -7,6 +7,13 @@ if lighty ~= nil then package.cpath = package.cpath..";"..docroot.."/../lib/clibs/?.dll" package.path = package.path..";"..docroot.."/sailor/?.lua" + -- FIXME: os.tmpname(), used by web_utils\utils.lua not + -- working in LightTPD (affects Windows build only?) + -- This breaks every script using "session" + function os.tmpname() + return 'tmp' + end + -- Makes lighty global so it can be accessed by Remy or controllers _G["lighty"] = lighty local sailor = require "sailor" From 495e16e7e5c2aacd38f5da02f1caa9e547ef251c Mon Sep 17 00:00:00 2001 From: Felipe Daragon Date: Fri, 9 Oct 2015 16:56:15 -0300 Subject: [PATCH 2/2] Get path from r in all Remy modes --- src/sailor.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sailor.lua b/src/sailor.lua index e331055..33c1f7a 100755 --- a/src/sailor.lua +++ b/src/sailor.lua @@ -55,8 +55,7 @@ end -- Stores the path of the application in sailor.path function sailor.set_application_path(r) - if sailor.remy_mode == remy.MODE_LIGHTTPD then - -- Ideally, this should not be needed (needs improvement/removal) + if sailor.remy_mode ~= nil then sailor.path = sailor.get_filename_path(r) else local dir = lfs.currentdir()