moonbridge
diff moonbridge_http.lua @ 33:59f485dc48ea
Removed method request:send_text_status_response(...); Added helloworld.lua
| author | jbe |
|---|---|
| date | Tue Feb 17 13:15:08 2015 +0100 (2015-02-17) |
| parents | fd542c33020b |
| children | 2d7e3028d993 |
line diff
1.1 --- a/moonbridge_http.lua Tue Feb 17 04:10:38 2015 +0100 1.2 +++ b/moonbridge_http.lua Tue Feb 17 13:15:08 2015 +0100 1.3 @@ -753,17 +753,6 @@ 1.4 read_body_bytes(request_body_content_length, callback) 1.5 end 1.6 input_state = "finished" 1.7 - end, 1.8 - -- helper function to send simple status responses, 1.9 - -- e.g. to send errors for malformed requests, etc.: 1.10 - send_text_status_response = function(self, status, text) 1.11 - request:send_status(status) 1.12 - request:send_header("Content-Type", "text/plain") 1.13 - request:send_data(status, "\n") 1.14 - if text then 1.15 - request:send_data("\n", text, "\n") 1.16 - end 1.17 - request:finish() 1.18 end 1.19 } 1.20 -- initialize tables for GET params in request object: 1.21 @@ -787,9 +776,8 @@ 1.22 end 1.23 end 1.24 }) 1.25 - -- function identical to request:send_text_status_response(...) 1.26 - -- but enforcing a connection close after sending the response, and 1.27 - -- returning the boolean value of the "survive" variable: 1.28 + -- sends a minimalistic error response and enforces closing of the 1.29 + -- connection and returns the boolean value "survive" 1.30 local function error_response(...) 1.31 request:send_status(status) 1.32 request:send_header("Content-Type", "text/plain")