From f776ebf34442e0ac6dfc46afd5ac47793db82ac3 Mon Sep 17 00:00:00 2001 From: amelia squires Date: Wed, 11 Sep 2024 00:02:08 -0500 Subject: add res:stop --- src/net/lua.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/net/lua.c') diff --git a/src/net/lua.c b/src/net/lua.c index 2995326..dd73db2 100644 --- a/src/net/lua.c +++ b/src/net/lua.c @@ -104,6 +104,16 @@ int l_close(lua_State* L){ return 0; } +int l_stop(lua_State* L){ + int res_idx = 1; + + lua_pushstring(L, "_stop"); + lua_pushboolean(L, 1); + lua_settable(L, res_idx); + + return 0; +} + int l_roll(lua_State* L){ int alen; if(lua_gettop(L) > 2) { -- cgit v1.2.3 From e29d3ea86551380ace8e2c86c9f1f63e901941e1 Mon Sep 17 00:00:00 2001 From: amelia squires Date: Sun, 29 Sep 2024 02:49:05 -0500 Subject: docs n stuff --- src/net/lua.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/net/lua.c') diff --git a/src/net/lua.c b/src/net/lua.c index dd73db2..df2213b 100644 --- a/src/net/lua.c +++ b/src/net/lua.c @@ -216,6 +216,14 @@ int l_sendfile(lua_State* L){ p_fatal("missing permissions"); } + char* ext = strrchr(path, '.'); + if(ext){ + char* content_type = map_get(mime_type, ext + 1); + + if(content_type) + {luaI_tsets(L, header, "Content-Type", content_type);} + } + str* r; i_write_header(L, header, &r, "", 0); send(client_fd, r->c, r->len, 0); -- cgit v1.2.3