aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2004-06-18 21:41:44 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2004-06-18 21:41:44 +0000
commit7ed89c97f760600df238f9853ee453570935870f (patch)
treea17573a43815071e35f85557519fefca739ef7ef /test
parentac4aac0909da26befaaeb6b415f66cf35b6980e0 (diff)
downloadluasocket-7ed89c97f760600df238f9853ee453570935870f.tar.gz
luasocket-7ed89c97f760600df238f9853ee453570935870f.tar.bz2
luasocket-7ed89c97f760600df238f9853ee453570935870f.zip
2.0 alpha RELEASED!
Diffstat (limited to 'test')
-rw-r--r--test/httptest.lua9
-rw-r--r--test/testsrvr.lua1
2 files changed, 5 insertions, 5 deletions
diff --git a/test/httptest.lua b/test/httptest.lua
index 45d7e8d..0ba6f56 100644
--- a/test/httptest.lua
+++ b/test/httptest.lua
@@ -155,14 +155,15 @@ check_request(request, expect, ignore)
155io.write("testing simple post function: ") 155io.write("testing simple post function: ")
156back = http.request("http://" .. host .. cgiprefix .. "/cat", index) 156back = http.request("http://" .. host .. cgiprefix .. "/cat", index)
157assert(back == index) 157assert(back == index)
158print("ok")
158 159
159------------------------------------------------------------------------ 160------------------------------------------------------------------------
160io.write("testing ltn12.(sink|source).file: ") 161io.write("testing ltn12.(sink|source).file: ")
161request = { 162request = {
162 url = "http://" .. host .. cgiprefix .. "/cat", 163 url = "http://" .. host .. cgiprefix .. "/cat",
163 method = "POST", 164 method = "POST",
164 source = ltn12.source.file(io.open(index_file, "r")), 165 source = ltn12.source.file(io.open(index_file, "rb")),
165 sink = ltn12.sink.file(io.open(index_file .. "-back", "w")), 166 sink = ltn12.sink.file(io.open(index_file .. "-back", "wb")),
166 headers = { ["content-length"] = string.len(index) } 167 headers = { ["content-length"] = string.len(index) }
167} 168}
168expect = { 169expect = {
@@ -187,7 +188,7 @@ local function b64length(len)
187end 188end
188 189
189local source = ltn12.source.chain( 190local source = ltn12.source.chain(
190 ltn12.source.file(io.open(index_file, "r")), 191 ltn12.source.file(io.open(index_file, "rb")),
191 ltn12.filter.chain( 192 ltn12.filter.chain(
192 mime.encode("base64"), 193 mime.encode("base64"),
193 mime.wrap("base64") 194 mime.wrap("base64")
@@ -196,7 +197,7 @@ local source = ltn12.source.chain(
196 197
197local sink = ltn12.sink.chain( 198local sink = ltn12.sink.chain(
198 mime.decode("base64"), 199 mime.decode("base64"),
199 ltn12.sink.file(io.open(index_file .. "-back", "w")) 200 ltn12.sink.file(io.open(index_file .. "-back", "wb"))
200) 201)
201 202
202request = { 203request = {
diff --git a/test/testsrvr.lua b/test/testsrvr.lua
index 6e786c8..5b842f1 100644
--- a/test/testsrvr.lua
+++ b/test/testsrvr.lua
@@ -13,7 +13,6 @@ while 1 do
13 -- control:setoption("nodelay", true) 13 -- control:setoption("nodelay", true)
14 while 1 do 14 while 1 do
15 command, error = control:receive() 15 command, error = control:receive()
16print(error)
17 if error then 16 if error then
18 control:close() 17 control:close()
19 print("server: closing connection...") 18 print("server: closing connection...")