Skip to content

Commit

Permalink
bug fix incorrect http header pack
Browse files Browse the repository at this point in the history
  • Loading branch information
findstr committed Aug 6, 2016
1 parent 5e9a92d commit 23c4421
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lualib/http/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ function server.listen(port, handler)
end

function server.send(fd, status, header, body)
local tmp = string.format("HTTP/1.1 %d %s\r\n", status, http_err_msg[status])
tmp = tmp .. table.concat(header, "\r\n")
tmp = tmp .. string.format("Content-Length: %d\r\n", #body)
tmp = tmp .. "\r\n"
table.insert(header, 1, string.format("HTTP/1.1 %d %s", status, http_err_msg[status]))
table.insert(header, string.format("Content-Length: %d", #body))
local tmp = table.concat(header, "\r\n")
tmp = tmp .. "\r\n\r\n"
tmp = tmp .. body
write(fd, tmp)
end
Expand Down

0 comments on commit 23c4421

Please sign in to comment.