Software /
code /
prosody
Changeset
12831:1cdaf21584da 0.12
net.http.server: Fix #1789
Unregistering the response before sending the trailer of the chunked
transfer encoding prevents opportunistic writes from being invoked and
running this code again when, which may cause an error when closing the
file handle a second time.
Normally the file size is known, so no chuck headers are sent.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 08 Jan 2023 13:35:04 +0100 |
parents | 12829:fba795dd99c8 |
children | 12832:19365e0c0ddd 12834:dcbff9f038a0 |
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 01 16:20:58 2023 +0100 +++ b/net/http/server.lua Sun Jan 08 13:35:04 2023 +0100 @@ -377,12 +377,12 @@ -- io.write("."); io.flush(); response.conn:write(chunk); else + incomplete[response.conn] = nil; if chunked then response.conn:write("0\r\n\r\n"); end -- io.write("\n"); if f.close then f:close(); end - incomplete[response.conn] = nil; return response:done(); end end