mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-25 23:39:04 +00:00
Rename MapContentType to ProgramContentType (#570)
This commit is contained in:
parent
d2cec808dc
commit
164e2ab27b
3 changed files with 13 additions and 13 deletions
|
@ -22,11 +22,11 @@ assert("\e" == "\x1b")
|
||||||
assert("hi" * 3 == "hihihi")
|
assert("hi" * 3 == "hihihi")
|
||||||
assert("hello %d" % {123} == "hello 123")
|
assert("hello %d" % {123} == "hello 123")
|
||||||
|
|
||||||
-- test MapContentType
|
-- test ProgramContentType
|
||||||
assert(MapContentType("txt") == "text/plain")
|
assert(ProgramContentType("txt") == "text/plain")
|
||||||
assert(MapContentType("htm") == "text/html")
|
assert(ProgramContentType("htm") == "text/html")
|
||||||
assert(MapContentType("abc.htm") == "text/html")
|
assert(ProgramContentType("abc.htm") == "text/html")
|
||||||
assert(MapContentType("1") == nil)
|
assert(ProgramContentType("1") == nil)
|
||||||
MapContentType("1", "text/x-foo")
|
ProgramContentType("1", "text/x-foo")
|
||||||
assert(MapContentType("1"), "text/x-foo")
|
assert(ProgramContentType("1"), "text/x-foo")
|
||||||
assert(MapContentType("file.1"), "text/x-foo")
|
assert(ProgramContentType("file.1"), "text/x-foo")
|
||||||
|
|
|
@ -1271,9 +1271,6 @@ FUNCTIONS
|
||||||
flag was used. If slurping large file into memory is a concern,
|
flag was used. If slurping large file into memory is a concern,
|
||||||
then consider using ServeAsset which can serve directly off disk.
|
then consider using ServeAsset which can serve directly off disk.
|
||||||
|
|
||||||
MapContentType(ext:str[, contenttype:str]) → str
|
|
||||||
Sets or returns content type associated with a file extension.
|
|
||||||
|
|
||||||
StoreAsset(path:str, data:str[, mode:int])
|
StoreAsset(path:str, data:str[, mode:int])
|
||||||
Stores asset to executable's ZIP central directory. This
|
Stores asset to executable's ZIP central directory. This
|
||||||
currently happens in an append-only fashion and is still
|
currently happens in an append-only fashion and is still
|
||||||
|
@ -1375,6 +1372,9 @@ FUNCTIONS
|
||||||
ProgramCertificate(Slurp("/etc/letsencrypt.lol/fullchain.pem")) for
|
ProgramCertificate(Slurp("/etc/letsencrypt.lol/fullchain.pem")) for
|
||||||
local file system only.
|
local file system only.
|
||||||
|
|
||||||
|
ProgramContentType(ext:str[, contenttype:str]) → str
|
||||||
|
Sets or returns content type associated with a file extension.
|
||||||
|
|
||||||
ProgramHeader(name:str,value:str)
|
ProgramHeader(name:str,value:str)
|
||||||
Appends HTTP header to the header buffer for all responses (whereas
|
Appends HTTP header to the header buffer for all responses (whereas
|
||||||
SetHeader only appends a header to the current response buffer).
|
SetHeader only appends a header to the current response buffer).
|
||||||
|
|
|
@ -4630,7 +4630,7 @@ static const char *GetContentTypeExt(const char *path, size_t n) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int LuaMapContentType(lua_State *L) {
|
static int LuaProgramContentType(lua_State *L) {
|
||||||
const char *ext = luaL_checkstring(L, 1);
|
const char *ext = luaL_checkstring(L, 1);
|
||||||
const char *ct;
|
const char *ct;
|
||||||
int n = lua_gettop(L);
|
int n = lua_gettop(L);
|
||||||
|
@ -4869,7 +4869,6 @@ static const luaL_Reg kLuaFuncs[] = {
|
||||||
{"Lemur64", LuaLemur64}, //
|
{"Lemur64", LuaLemur64}, //
|
||||||
{"LoadAsset", LuaLoadAsset}, //
|
{"LoadAsset", LuaLoadAsset}, //
|
||||||
{"Log", LuaLog}, //
|
{"Log", LuaLog}, //
|
||||||
{"MapContentType", LuaMapContentType}, //
|
|
||||||
{"Md5", LuaMd5}, //
|
{"Md5", LuaMd5}, //
|
||||||
{"MeasureEntropy", LuaMeasureEntropy}, //
|
{"MeasureEntropy", LuaMeasureEntropy}, //
|
||||||
{"ParseHost", LuaParseHost}, //
|
{"ParseHost", LuaParseHost}, //
|
||||||
|
@ -4881,6 +4880,7 @@ static const luaL_Reg kLuaFuncs[] = {
|
||||||
{"ProgramAddr", LuaProgramAddr}, //
|
{"ProgramAddr", LuaProgramAddr}, //
|
||||||
{"ProgramBrand", LuaProgramBrand}, //
|
{"ProgramBrand", LuaProgramBrand}, //
|
||||||
{"ProgramCache", LuaProgramCache}, //
|
{"ProgramCache", LuaProgramCache}, //
|
||||||
|
{"ProgramContentType", LuaProgramContentType}, //
|
||||||
{"ProgramDirectory", LuaProgramDirectory}, //
|
{"ProgramDirectory", LuaProgramDirectory}, //
|
||||||
{"ProgramGid", LuaProgramGid}, //
|
{"ProgramGid", LuaProgramGid}, //
|
||||||
{"ProgramHeader", LuaProgramHeader}, //
|
{"ProgramHeader", LuaProgramHeader}, //
|
||||||
|
|
Loading…
Add table
Reference in a new issue