httpd don't need readline now

This commit is contained in:
Cloud Wu
2014-07-23 12:19:48 +08:00
parent 551d5048c4
commit 18f20425a0
6 changed files with 176 additions and 93 deletions

View File

@@ -1,6 +1,5 @@
local socket = require "socket"
local readline = socket.readline
local readbytes = socket.read
local writebytes = socket.write
@@ -10,18 +9,7 @@ local socket_error = {}
sockethelper.socket_error = socket_error
function sockethelper.readfunc(fd)
local helper = {}
function helper.readline()
local ret = readline(fd, "\r\n")
if ret then
return ret
else
error(socket_error)
end
end
function helper.readbytes(sz)
return function (sz)
local ret = readbytes(fd, sz)
if ret then
return ret
@@ -29,8 +17,6 @@ function sockethelper.readfunc(fd)
error(socket_error)
end
end
return helper
end
function sockethelper.writefunc(fd)