Changeset

12833:8cbb109ff7ec

net.http.server: Close file handle earlier Frees unneeded resources earlier, so they're not held on to while potentially sending the chunk trailer.
author Kim Alvefur <zash@zash.se>
date Sun, 08 Jan 2023 13:51:30 +0100
parents 12832:19365e0c0ddd
children 12835:6a97d448cb1e
files net/http/server.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/net/http/server.lua	Sun Jan 08 13:39:24 2023 +0100
+++ b/net/http/server.lua	Sun Jan 08 13:51:30 2023 +0100
@@ -378,11 +378,11 @@
 			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