mirror of
https://github.com/lxsang/antd-lua-plugin
synced 2025-02-13 15:02:48 +01:00
fix
This commit is contained in:
parent
fe5fe09754
commit
9c233ce3f1
@ -6,6 +6,7 @@ package.cpath = __api__.apiroot..'/?.so'
|
||||
require("std")
|
||||
require("utils")
|
||||
require("extra_mime")
|
||||
ulib = require("ulib")
|
||||
-- set session
|
||||
SESSION = {}
|
||||
|
||||
|
@ -41,3 +41,35 @@ function std.isBinary(name)
|
||||
return bin
|
||||
end
|
||||
end
|
||||
|
||||
function std.sendFile(m)
|
||||
local mime = std.mimeOf(m)
|
||||
local finfo = ulib.file_stat(m)
|
||||
local len = tostring(math.floor(finfo.size))
|
||||
local len1 = tostring(math.floor(finfo.size - 1))
|
||||
if mime == "audio/mpeg" then
|
||||
std.status(200, "OK")
|
||||
std.custom_header("Pragma", "public")
|
||||
std.custom_header("Expires", "0")
|
||||
std.custom_header("Content-Type", mime)
|
||||
std.custom_header("Content-Length", len)
|
||||
std.custom_header("Content-Disposition", "inline; filename=" .. std.basename(m))
|
||||
std.custom_header("Content-Range:", "bytes 0-" .. len1 .. "/" .. len)
|
||||
std.custom_header("Accept-Ranges", "bytes")
|
||||
std.custom_header("X-Pad", "avoid browser bug")
|
||||
std.custom_header("Content-Transfer-Encoding", "binary")
|
||||
std.custom_header("Cache-Control", "no-cache, no-store")
|
||||
std.custom_header("Connection", "Keep-Alive")
|
||||
std.custom_header("Etag", "a404b-c3f-47c3a14937c80")
|
||||
else
|
||||
std.status(200, "OK")
|
||||
std.custom_header("Content-Type", mime)
|
||||
std.custom_header("Content-Length", len)
|
||||
end
|
||||
std.header_flush()
|
||||
if std.is_bin(m) then
|
||||
std.fb(m)
|
||||
else
|
||||
std.f(m)
|
||||
end
|
||||
end
|
||||
|
@ -117,6 +117,7 @@ end
|
||||
function std.is_file(f)
|
||||
return std.is_dir(f) == false
|
||||
end
|
||||
|
||||
std.ws.TEXT = 1
|
||||
std.ws.BIN = 2
|
||||
std.ws.CLOSE = 8
|
||||
|
BIN
dist/lua-0.5.2b.tar.gz
vendored
BIN
dist/lua-0.5.2b.tar.gz
vendored
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user