Rename GetLastModified to GetAssetLastModified and IsCompressed to IsAssetCompressed

This commit is contained in:
Paul Kulchenko 2022-06-22 22:13:24 -07:00
parent 36b271cbc2
commit 83f094bb5a
3 changed files with 20 additions and 10 deletions

View file

@ -317,7 +317,7 @@ local function main()
if not IsAcceptablePath(paths[i]) then
Write(' <small>[BLOCKED]</small>')
end
if not IsCompressed(paths[i]) then
if not IsAssetCompressed(paths[i]) then
Write(' <small>[UNCOMPRESSED]</small>')
end
if (GetAssetMode(paths[i]) & 0xF000) == 0x4000 then
@ -325,7 +325,7 @@ local function main()
end
Write('<br>\r\n')
Write('Modified: ')
Write(FormatHttpDateTime(GetLastModifiedTime(paths[i])))
Write(FormatHttpDateTime(GetAssetLastModifiedTime(paths[i])))
Write('<br>\r\n')
Write('Mode: ')
Write("0%o" % {GetAssetMode(paths[i])})

View file

@ -769,13 +769,21 @@ FUNCTIONS
directory.
Also available as GetComment (deprecated).
GetAssetLastModifiedTime(path:str) → seconds:number
Returns UNIX timestamp for modification time of a ZIP asset (or
local file if the -D flag is used).
If both a file and a ZIP asset are present, then the file is used.
Also available as GetLastModifiedTime (deprecated).
GetAssetMode(path:str) → int
Returns UNIX-style octal mode for ZIP asset (or local file if the
-D flag is used)
-D flag is used).
If both a file and a ZIP asset are present, then the file is used.
GetAssetSize(path:str) → int
Returns byte size of uncompressed contents of ZIP asset (or local
file if the -D flag is used)
file if the -D flag is used).
If both a file and a ZIP asset are present, then the file is used.
GetBody() → str
Returns the request message body if present or an empty string.
@ -971,9 +979,10 @@ v See khttprepeatable.c. Those headers will not be folded. Standard
Returns true if IP address is part of the localhost network
(127.0.0.0/8).
IsCompressed(path:str) → bool
IsAssetCompressed(path:str) → bool
Returns true if ZIP artifact at path is stored on disk using
DEFLATE compression.
Also available as IsCompressed (deprecated).
IndentLines(str[,int]) → str
Adds spaces to beginnings of multiline string. If the int

View file

@ -4841,7 +4841,7 @@ static int LuaGetAssetMode(lua_State *L) {
return 1;
}
static int LuaGetLastModifiedTime(lua_State *L) {
static int LuaGetAssetLastModifiedTime(lua_State *L) {
size_t pathlen;
struct Asset *a;
const char *path;
@ -4879,7 +4879,7 @@ static int LuaGetAssetSize(lua_State *L) {
return 1;
}
static int LuaIsCompressed(lua_State *L) {
static int LuaIsAssetCompressed(lua_State *L) {
size_t pathlen;
struct Asset *a;
const char *path;
@ -5033,6 +5033,7 @@ static const luaL_Reg kLuaFuncs[] = {
{"FormatHttpDateTime", LuaFormatHttpDateTime}, //
{"FormatIp", LuaFormatIp}, //
{"GetAssetComment", LuaGetAssetComment}, //
{"GetAssetLastModifiedTime", LuaGetAssetLastModifiedTime}, //
{"GetAssetMode", LuaGetAssetMode}, //
{"GetAssetSize", LuaGetAssetSize}, //
{"GetBody", LuaGetBody}, //
@ -5052,7 +5053,6 @@ static const luaL_Reg kLuaFuncs[] = {
{"GetHostOs", LuaGetHostOs}, //
{"GetHttpReason", LuaGetHttpReason}, //
{"GetHttpVersion", LuaGetHttpVersion}, //
{"GetLastModifiedTime", LuaGetLastModifiedTime}, //
{"GetLogLevel", LuaGetLogLevel}, //
{"GetMethod", LuaGetMethod}, //
{"GetMonospaceWidth", LuaGetMonospaceWidth}, //
@ -5079,7 +5079,7 @@ static const luaL_Reg kLuaFuncs[] = {
{"IsAcceptablePath", LuaIsAcceptablePath}, //
{"IsAcceptablePort", LuaIsAcceptablePort}, //
{"IsClientUsingSsl", LuaIsClientUsingSsl}, //
{"IsCompressed", LuaIsCompressed}, //
{"IsAssetCompressed", LuaIsAssetCompressed}, //
{"IsDaemon", LuaIsDaemon}, //
{"IsHeaderRepeatable", LuaIsHeaderRepeatable}, //
{"IsHiddenPath", LuaIsHiddenPath}, //
@ -5166,7 +5166,8 @@ static const luaL_Reg kLuaFuncs[] = {
{"GetPayload", LuaGetBody}, //
{"GetComment", LuaGetAssetComment}, //
{"GetVersion", LuaGetHttpVersion}, //
{"IsCompressed", LuaIsAssetCompressed}, //
{"GetLastModifiedTime", LuaGetAssetLastModifiedTime}, //
};
static const luaL_Reg kLuaLibs[] = {