# HG changeset patch # User jbe # Date 1424142638 -3600 # Node ID fd542c33020bf9e0a1c701edeadc64e1afb13460 # Parent 5ab8c0260e59fc4909b521324d2f1675e7f91f6c Method request:send_text_status_response(...) doesn't enfoce connection close diff -r 5ab8c0260e59 -r fd542c33020b moonbridge_http.lua --- a/moonbridge_http.lua Tue Feb 17 00:50:53 2015 +0100 +++ b/moonbridge_http.lua Tue Feb 17 04:10:38 2015 +0100 @@ -759,9 +759,6 @@ send_text_status_response = function(self, status, text) request:send_status(status) request:send_header("Content-Type", "text/plain") - if not connection_close_responded then - request:send_header("Connection", "close") - end request:send_data(status, "\n") if text then request:send_data("\n", text, "\n") @@ -790,11 +787,18 @@ end end }) - -- wrapper for request:send_text_status_response(...) method to - -- send an error status for malformed requests, etc., and to - -- return the boolean value of the "survive" variable: + -- function identical to request:send_text_status_response(...) + -- but enforcing a connection close after sending the response, and + -- returning the boolean value of the "survive" variable: local function error_response(...) - request:send_text_status_response(...) + request:send_status(status) + request:send_header("Content-Type", "text/plain") + request:send_header("Connection", "close") + request:send_data(status, "\n") + if text then + request:send_data("\n", text, "\n") + end + request:finish() return survive end -- read and parse request line: