libs/web: Made luci.http.write a sink

This commit is contained in:
Steven Barth 2008-07-16 09:18:27 +00:00
parent 9fd9401d9b
commit 9b1ef9e2b1

View file

@ -169,10 +169,17 @@ function status(code, message)
coroutine.yield(1, code, message)
end
function write(content)
if not content or #content == 0 then
return
function write(content, src_err)
if not content then
if src_err then
error(src_err)
else
close()
end
return true
elseif #content == 0 then
return true
else
if not context.eoh then
if not context.status then
status()
@ -185,6 +192,8 @@ function write(content)
coroutine.yield(3)
end
coroutine.yield(4, content)
return true
end
end
function redirect(url)