Compare commits
1 Commits
master
...
use_file_e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
363c7a8dd5 |
@ -3,8 +3,7 @@
|
||||
-- Author: Marcos Kirsch
|
||||
|
||||
local compileAndRemoveIfNeeded = function(f)
|
||||
if file.open(f) then
|
||||
file.close()
|
||||
if file.exists(f) then
|
||||
print('Compiling:', f)
|
||||
node.compile(f)
|
||||
file.remove(f)
|
||||
|
||||
@ -61,19 +61,19 @@ return function (port)
|
||||
uri.args = {code = 400, errorString = "Bad Request", logFunction = log}
|
||||
fileServeFunction = dofile("httpserver-error.lc")
|
||||
else
|
||||
local fileExists = file.open(uri.file, "r")
|
||||
file.close()
|
||||
local fileExists = false
|
||||
|
||||
if not fileExists then
|
||||
if not file.exists(uri.file) then
|
||||
-- print(uri.file .. " not found, checking gz version...")
|
||||
-- gzip check
|
||||
fileExists = file.open(uri.file .. ".gz", "r")
|
||||
file.close()
|
||||
|
||||
if fileExists then
|
||||
if file.exists(uri.file .. ".gz") then
|
||||
-- print("gzip variant exists, serving that one")
|
||||
uri.file = uri.file .. ".gz"
|
||||
uri.isGzipped = true
|
||||
fileExists = true
|
||||
end
|
||||
else
|
||||
fileExists = true
|
||||
end
|
||||
|
||||
if not fileExists then
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user