moonbridge

changeset 204:7d1cda1ed530

Adjusted error message sent by request_error function in HTTP module
author jbe
date Sun Jun 21 02:49:23 2015 +0200 (2015-06-21)
parents a1907691f740
children 5601a486e68a
files moonbridge_http.lua
line diff
     1.1 --- a/moonbridge_http.lua	Sun Jun 21 02:42:27 2015 +0200
     1.2 +++ b/moonbridge_http.lua	Sun Jun 21 02:49:23 2015 +0200
     1.3 @@ -362,6 +362,7 @@
     1.4        local streamed_post_param_patterns = {}  -- list of POST field pattern and stream function pairs
     1.5        -- function to report an error:
     1.6        local function request_error(throw_error, status, text)
     1.7 +        local response_sent = false
     1.8          if
     1.9            state == "init" or
    1.10            state == "no_status_sent" or
    1.11 @@ -384,9 +385,16 @@
    1.12                error("Error while sending error response (" .. status .. "): " .. errmsg)
    1.13              end
    1.14            end
    1.15 +          response_sent = true
    1.16          end
    1.17          if throw_error then
    1.18 -          local errmsg = "Error while reading request from client. Error response: " .. status
    1.19 +          local errmsg
    1.20 +          if response_sent then
    1.21 +            errmsg = "Error while reading request from client. Error response: "
    1.22 +          else
    1.23 +            errmsg = "Error while reading request from client: "
    1.24 +          end
    1.25 +          errmsg = errmsg .. status
    1.26            if text then
    1.27              errmsg = errmsg .. " (" .. text .. ")"
    1.28            end

Impressum / About Us