From f852959fa583ba7064b76ad830599a6f0e2356c5 Mon Sep 17 00:00:00 2001 From: Philip Gladstone Date: Sat, 28 Nov 2015 21:00:34 -0500 Subject: [PATCH] Handle the null write case --- httpserver.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/httpserver.lua b/httpserver.lua index 6695196..273eb16 100644 --- a/httpserver.lua +++ b/httpserver.lua @@ -18,9 +18,9 @@ return function (port) local function startServing(fileServeFunction, connection, req, args) local bufferedConnection = {} - connectionThread = coroutine.create(function(fileServeFunction, connection, req, args) - fileServeFunction(connection, req, args) - if not connection:flush() then + connectionThread = coroutine.create(function(fileServeFunction, bconnection, req, args) + fileServeFunction(bconnection, req, args) + if not bconnection:flush() then connection:close() connectionThread = nil end