moonbridge
diff moonbridge_http.lua @ 187:fac4ea0c4120
Fixed mistake with additional local state variable in HTTP module
author | jbe |
---|---|
date | Fri Jun 19 19:04:52 2015 +0200 (2015-06-19) |
parents | f7ed5b923331 |
children | 4f081664a1db |
line diff
1.1 --- a/moonbridge_http.lua Fri Jun 19 18:57:02 2015 +0200 1.2 +++ b/moonbridge_http.lua Fri Jun 19 19:04:52 2015 +0200 1.3 @@ -366,7 +366,7 @@ 1.4 end 1.5 -- functions to send data to the browser: 1.6 local function send(...) 1.7 - local old_state, state = state, "faulty" 1.8 + local old_state = state; state = "faulty" 1.9 if not socket:write_call(unblock, ...) then 1.10 socket:reset() 1.11 error("Could not send data to client: " .. errmsg) 1.12 @@ -374,7 +374,7 @@ 1.13 state = old_state 1.14 end 1.15 local function send_flush(...) 1.16 - local old_state, state = state, "faulty" 1.17 + local old_state = state; state = "faulty" 1.18 if not socket:flush_call(unblock, ...) then 1.19 socket:reset() 1.20 error("Could not send data to client: " .. errmsg) 1.21 @@ -409,7 +409,7 @@ 1.22 -- function that writes out buffered chunks (without flushing the socket): 1.23 function send_chunk() 1.24 if chunk_bytes > 0 then 1.25 - local old_state, state = state, "faulty" 1.26 + local old_state = state; state = "faulty" 1.27 send(string.format("%x\r\n", chunk_bytes)) 1.28 for i = 1, #chunk_parts do 1.29 send(chunk_parts[i]) 1.30 @@ -732,7 +732,7 @@ 1.31 then 1.32 error("All HTTP headers have already been sent") 1.33 end 1.34 - local old_state, state = state, "faulty" 1.35 + local old_state = state; state = "faulty" 1.36 enable_drain() 1.37 close_requested = true 1.38 if old_state == "init" then 1.39 @@ -744,7 +744,7 @@ 1.40 -- method to send a HTTP response status (e.g. "200 OK"): 1.41 function request:send_status(status) 1.42 prepare() 1.43 - local old_state, state = state, "faulty" 1.44 + local old_state = state; state = "faulty" 1.45 if old_state == "info_status_sent" then 1.46 send_flush("\r\n") 1.47 elseif old_state ~= "no_status_sent" then 1.48 @@ -778,7 +778,7 @@ 1.49 then 1.50 error("All HTTP headers have already been sent") 1.51 end 1.52 - local old_state, state = state, "faulty" 1.53 + local old_state = state; state = "faulty" 1.54 local key_lower = string.lower(key) 1.55 if key_lower == "content-length" then 1.56 if old_state == "info_status_sent" then