1
0
mirror of https://github.com/lammertb/libhttp.git synced 2025-12-23 15:42:08 +03:00

Test for chunked transfer encoding (#95, #98)

This commit is contained in:
bel
2015-04-24 00:36:34 +02:00
parent 199afb7369
commit e497dd34f8
2 changed files with 9 additions and 2 deletions

View File

@@ -72,7 +72,14 @@ if method=="PUT" then
mg.write("<body>Resource of type \"" .. mime .. "\" already exists.</body></html>\r\n")
else
local f = io.open(file, "w")
f:write(mg.read())
local data = {}
repeat
local l = mg.read();
data[#data+1] = l;
until ((l == "") or (l == nil));
f:write(table.concat(data, ""))
f:close()
mg.write("HTTP/1.0 200 OK\r\n")
mg.write("Connection: close\r\n")

View File

@@ -32,7 +32,7 @@ unsigned short PORT = 8080;
const char * RESOURCE = "/resource_script_demo.lua/r1.txt";
const char * METHOD = "PUT";
unsigned postSize = 987;
unsigned postSize = 9876;
unsigned extraHeadSize = 0;
unsigned queryStringSize = 0;
int keep_alive = 0;