# HG changeset patch # User jbe # Date 1434847763 -7200 # Node ID 7d1cda1ed530de86cec4a3b795a35da1b01ae0cd # Parent a1907691f740b402aebae72150c16bd39deb2c35 Adjusted error message sent by request_error function in HTTP module diff -r a1907691f740 -r 7d1cda1ed530 moonbridge_http.lua --- a/moonbridge_http.lua Sun Jun 21 02:42:27 2015 +0200 +++ b/moonbridge_http.lua Sun Jun 21 02:49:23 2015 +0200 @@ -362,6 +362,7 @@ local streamed_post_param_patterns = {} -- list of POST field pattern and stream function pairs -- function to report an error: local function request_error(throw_error, status, text) + local response_sent = false if state == "init" or state == "no_status_sent" or @@ -384,9 +385,16 @@ error("Error while sending error response (" .. status .. "): " .. errmsg) end end + response_sent = true end if throw_error then - local errmsg = "Error while reading request from client. Error response: " .. status + local errmsg + if response_sent then + errmsg = "Error while reading request from client. Error response: " + else + errmsg = "Error while reading request from client: " + end + errmsg = errmsg .. status if text then errmsg = errmsg .. " (" .. text .. ")" end