diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-06-18 21:41:44 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-06-18 21:41:44 +0000 |
commit | 7ed89c97f760600df238f9853ee453570935870f (patch) | |
tree | a17573a43815071e35f85557519fefca739ef7ef /test | |
parent | ac4aac0909da26befaaeb6b415f66cf35b6980e0 (diff) | |
download | luasocket-7ed89c97f760600df238f9853ee453570935870f.tar.gz luasocket-7ed89c97f760600df238f9853ee453570935870f.tar.bz2 luasocket-7ed89c97f760600df238f9853ee453570935870f.zip |
2.0 alpha RELEASED!
Diffstat (limited to 'test')
-rw-r--r-- | test/httptest.lua | 9 | ||||
-rw-r--r-- | test/testsrvr.lua | 1 |
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) | |||
155 | io.write("testing simple post function: ") | 155 | io.write("testing simple post function: ") |
156 | back = http.request("http://" .. host .. cgiprefix .. "/cat", index) | 156 | back = http.request("http://" .. host .. cgiprefix .. "/cat", index) |
157 | assert(back == index) | 157 | assert(back == index) |
158 | print("ok") | ||
158 | 159 | ||
159 | ------------------------------------------------------------------------ | 160 | ------------------------------------------------------------------------ |
160 | io.write("testing ltn12.(sink|source).file: ") | 161 | io.write("testing ltn12.(sink|source).file: ") |
161 | request = { | 162 | request = { |
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 | } |
168 | expect = { | 169 | expect = { |
@@ -187,7 +188,7 @@ local function b64length(len) | |||
187 | end | 188 | end |
188 | 189 | ||
189 | local source = ltn12.source.chain( | 190 | local 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 | ||
197 | local sink = ltn12.sink.chain( | 198 | local 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 | ||
202 | request = { | 203 | request = { |
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() |
16 | print(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...") |