aboutsummaryrefslogtreecommitdiff
path: root/src/net/lua.c
diff options
context:
space:
mode:
authoramelia squires <[email protected]>2024-09-29 02:49:05 -0500
committeramelia squires <[email protected]>2024-09-29 02:49:05 -0500
commitfe33c0e979ebfc41c3eb9f561589f0d5d8810aaf (patch)
tree526d2f71581e2584c9de2b958fd89b6ce0fb0ac1 /src/net/lua.c
parent602818b895fec710b0534b0b8fa7f5e1f57203c2 (diff)
docs n stuff
Diffstat (limited to 'src/net/lua.c')
-rw-r--r--src/net/lua.c8
1 files changed, 8 insertions, 0 deletions
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);