aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2023-01-08 13:51:30 +0100
committerKim Alvefur <zash@zash.se>2023-01-08 13:51:30 +0100
commitd36469316651e85219ae8a70ab73be55ba889d68 (patch)
treedd983100735529f65e1483f2fa22a03cdee720d2
parent2d7eb38bde16a4e3d55f267be8860433748c0a74 (diff)
downloadprosody-d36469316651e85219ae8a70ab73be55ba889d68.tar.gz
prosody-d36469316651e85219ae8a70ab73be55ba889d68.zip
net.http.server: Close file handle earlier
Frees unneeded resources earlier, so they're not held on to while potentially sending the chunk trailer.
-rw-r--r--net/http/server.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/http/server.lua b/net/http/server.lua
index 4ebf96a1..bc655ab1 100644
--- a/net/http/server.lua
+++ b/net/http/server.lua
@@ -378,11 +378,11 @@ function _M.send_file(response, f)
response.conn:write(chunk);
else
incomplete[response.conn] = nil;
+ if f.close then f:close(); end
if chunked then
response.conn:write("0\r\n\r\n");
end
-- io.write("\n");
- if f.close then f:close(); end
return response:done();
end
end