aboutsummaryrefslogtreecommitdiff
path: root/src/net/lua.c
diff options
context:
space:
mode:
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);