mirror of
https://github.com/lxsang/antd-lua-plugin
synced 2025-02-20 17:52:47 +01:00
add cache control to file
This commit is contained in:
parent
21f55f1000
commit
ac99eedc71
@ -60,12 +60,20 @@ function std.sendFile(m)
|
||||
std.header("Content-Transfer-Encoding", "binary")
|
||||
std.header("Cache-Control", "no-cache, no-store")
|
||||
std.header("Connection", "Keep-Alive")
|
||||
std.header("Etag", "a404b-c3f-47c3a14937c80")
|
||||
std.header_flush()
|
||||
std.f(m)
|
||||
else
|
||||
std.status(200)
|
||||
std.header("Content-Type", mime)
|
||||
std.header("Content-Length", len)
|
||||
if HEADER['If-Modified-Since'] and HEADER['If-Modified-Since'] == finfo.ctime then
|
||||
std.status(304)
|
||||
std.header_flush()
|
||||
else
|
||||
std.status(200)
|
||||
std.header("Content-Type", mime)
|
||||
--std.header("Content-Length", len)
|
||||
std.header("Cache-Control", "no-cache")
|
||||
std.header("Last-Modified", finfo.ctime)
|
||||
std.header_flush()
|
||||
std.f(m)
|
||||
end
|
||||
end
|
||||
std.header_flush()
|
||||
std.f(m)
|
||||
end
|
||||
|
BIN
dist/lua-0.5.2b.tar.gz
vendored
BIN
dist/lua-0.5.2b.tar.gz
vendored
Binary file not shown.
@ -255,13 +255,13 @@ static int l_file_stat(lua_State* L, const char* path)
|
||||
|
||||
//ctime
|
||||
lua_pushstring(L,"ctime");
|
||||
strftime(date, sizeof(date), "%Y-%m-%dT%H:%M:%S", localtime(&(st.st_ctime)));
|
||||
timestr(st.st_ctime,date,sizeof(date),"%a, %d %b %Y %H:%M:%S GMT",1);
|
||||
lua_pushstring(L,date);
|
||||
lua_settable(L,-3);
|
||||
//mtime
|
||||
|
||||
lua_pushstring(L,"mtime");
|
||||
strftime(date, sizeof(date), "%Y-%m-%dT%H:%M:%S", localtime(&(st.st_mtime)));
|
||||
timestr(st.st_mtime,date,sizeof(date),"%a, %d %b %Y %H:%M:%S GMT",1);
|
||||
lua_pushstring(L,date);
|
||||
lua_settable(L,-3);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user