From 13d920e1852d71584c830dd3b76fc99810699a03 Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Tue, 27 Oct 2015 15:40:15 +0800 Subject: [PATCH] body may contain ascii 0, see issue #365 --- lualib/http/httpc.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lualib/http/httpc.lua b/lualib/http/httpc.lua index ae771dc8..49ccb9b8 100644 --- a/lualib/http/httpc.lua +++ b/lualib/http/httpc.lua @@ -22,8 +22,9 @@ local function request(fd, method, host, url, recvheader, header, content) end if content then - local data = string.format("%s %s HTTP/1.1\r\n%scontent-length:%d\r\n\r\n%s", method, url, header_content, #content, content) + local data = string.format("%s %s HTTP/1.1\r\n%scontent-length:%d\r\n\r\n", method, url, header_content, #content) write(data) + write(content) else local request_header = string.format("%s %s HTTP/1.1\r\n%scontent-length:0\r\n\r\n", method, url, header_content) write(request_header)