diff options
| author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-01-21 01:09:50 +0000 |
|---|---|---|
| committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-01-21 01:09:50 +0000 |
| commit | 3a7ac1e04361e12ddfcbf344e9e1db82fb88157b (patch) | |
| tree | 166d452836a474541e1054f77b0b586bbe68dd6e /test | |
| parent | 0b61b577f5d65a9c8bd5e690c4010c1e28b70e66 (diff) | |
| download | luasocket-3a7ac1e04361e12ddfcbf344e9e1db82fb88157b.tar.gz luasocket-3a7ac1e04361e12ddfcbf344e9e1db82fb88157b.tar.bz2 luasocket-3a7ac1e04361e12ddfcbf344e9e1db82fb88157b.zip | |
Changed the naming convention of the mime module.
Looks beautiful.
Diffstat (limited to 'test')
| -rw-r--r-- | test/httptest.lua | 124 | ||||
| -rw-r--r-- | test/mimetest.lua | 30 |
2 files changed, 129 insertions, 25 deletions
diff --git a/test/httptest.lua b/test/httptest.lua index 44266d5..4667605 100644 --- a/test/httptest.lua +++ b/test/httptest.lua | |||
| @@ -5,8 +5,8 @@ | |||
| 5 | -- needs "AllowOverride AuthConfig" on /home/c/diego/tec/luasocket/test/auth | 5 | -- needs "AllowOverride AuthConfig" on /home/c/diego/tec/luasocket/test/auth |
| 6 | dofile("noglobals.lua") | 6 | dofile("noglobals.lua") |
| 7 | 7 | ||
| 8 | local host, proxy, request, response | 8 | local host, proxy, request, response, index_file |
| 9 | local ignore, expect, index, prefix, cgiprefix | 9 | local ignore, expect, index, prefix, cgiprefix, index_crlf |
| 10 | 10 | ||
| 11 | socket.http.TIMEOUT = 5 | 11 | socket.http.TIMEOUT = 5 |
| 12 | 12 | ||
| @@ -16,6 +16,7 @@ host = host or "diego.student.dyn.cs.princeton.edu" | |||
| 16 | proxy = proxy or "http://localhost:3128" | 16 | proxy = proxy or "http://localhost:3128" |
| 17 | prefix = prefix or "/luasocket-test" | 17 | prefix = prefix or "/luasocket-test" |
| 18 | cgiprefix = cgiprefix or "/luasocket-test-cgi" | 18 | cgiprefix = cgiprefix or "/luasocket-test-cgi" |
| 19 | index_file = "test/index.html" | ||
| 19 | 20 | ||
| 20 | local readfile = function(name) | 21 | local readfile = function(name) |
| 21 | local f = io.open(name, "r") | 22 | local f = io.open(name, "r") |
| @@ -25,7 +26,8 @@ local readfile = function(name) | |||
| 25 | return s | 26 | return s |
| 26 | end | 27 | end |
| 27 | 28 | ||
| 28 | index = readfile("test/index.html") | 29 | -- read index with CRLF convention |
| 30 | index = readfile(index_file) | ||
| 29 | 31 | ||
| 30 | local similar = function(s1, s2) | 32 | local similar = function(s1, s2) |
| 31 | return string.lower(string.gsub(s1 or "", "%s", "")) == | 33 | return string.lower(string.gsub(s1 or "", "%s", "")) == |
| @@ -42,13 +44,13 @@ local check = function (v, e) | |||
| 42 | if v then print("ok") | 44 | if v then print("ok") |
| 43 | else fail(e) end | 45 | else fail(e) end |
| 44 | end | 46 | end |
| 45 | 47 | ||
| 46 | local check_request = function(request, expect, ignore) | 48 | local check_result = function(response, expect, ignore) |
| 47 | local response = socket.http.request(request) | ||
| 48 | for i,v in response do | 49 | for i,v in response do |
| 49 | if not ignore[i] then | 50 | if not ignore[i] then |
| 50 | if v ~= expect[i] then | 51 | if v ~= expect[i] then |
| 51 | if string.len(v) < 80 then print(v) end | 52 | v = string.sub(type(v) == "string" and v or "", 1, 70) |
| 53 | print(v) | ||
| 52 | fail(i .. " differs!") | 54 | fail(i .. " differs!") |
| 53 | end | 55 | end |
| 54 | end | 56 | end |
| @@ -56,7 +58,8 @@ local check_request = function(request, expect, ignore) | |||
| 56 | for i,v in expect do | 58 | for i,v in expect do |
| 57 | if not ignore[i] then | 59 | if not ignore[i] then |
| 58 | if v ~= response[i] then | 60 | if v ~= response[i] then |
| 59 | if string.len(v) < 80 then print(v) end | 61 | v = string.sub(type(v) == "string" and v or "", 1, 70) |
| 62 | print(v) | ||
| 60 | fail(i .. " differs!") | 63 | fail(i .. " differs!") |
| 61 | end | 64 | end |
| 62 | end | 65 | end |
| @@ -64,6 +67,17 @@ local check_request = function(request, expect, ignore) | |||
| 64 | print("ok") | 67 | print("ok") |
| 65 | end | 68 | end |
| 66 | 69 | ||
| 70 | local check_request = function(request, expect, ignore) | ||
| 71 | local response = socket.http.request(request) | ||
| 72 | check_result(response, expect, ignore) | ||
| 73 | end | ||
| 74 | |||
| 75 | local check_request_cb = function(request, response, expect, ignore) | ||
| 76 | local response = socket.http.request_cb(request, response) | ||
| 77 | check_result(response, expect, ignore) | ||
| 78 | end | ||
| 79 | |||
| 80 | ------------------------------------------------------------------------ | ||
| 67 | io.write("testing request uri correctness: ") | 81 | io.write("testing request uri correctness: ") |
| 68 | local forth = cgiprefix .. "/request-uri?" .. "this+is+the+query+string" | 82 | local forth = cgiprefix .. "/request-uri?" .. "this+is+the+query+string" |
| 69 | local back, h, c, e = socket.http.get("http://" .. host .. forth) | 83 | local back, h, c, e = socket.http.get("http://" .. host .. forth) |
| @@ -72,12 +86,15 @@ back = socket.url.parse(back) | |||
| 72 | if similar(back.query, "this+is+the+query+string") then print("ok") | 86 | if similar(back.query, "this+is+the+query+string") then print("ok") |
| 73 | else fail() end | 87 | else fail() end |
| 74 | 88 | ||
| 89 | ------------------------------------------------------------------------ | ||
| 75 | io.write("testing query string correctness: ") | 90 | io.write("testing query string correctness: ") |
| 76 | forth = "this+is+the+query+string" | 91 | forth = "this+is+the+query+string" |
| 77 | back = socket.http.get("http://" .. host .. cgiprefix .. "/query-string?" .. forth) | 92 | back = socket.http.get("http://" .. host .. cgiprefix .. |
| 93 | "/query-string?" .. forth) | ||
| 78 | if similar(back, forth) then print("ok") | 94 | if similar(back, forth) then print("ok") |
| 79 | else fail("failed!") end | 95 | else fail("failed!") end |
| 80 | 96 | ||
| 97 | ------------------------------------------------------------------------ | ||
| 81 | io.write("testing document retrieval: ") | 98 | io.write("testing document retrieval: ") |
| 82 | request = { | 99 | request = { |
| 83 | url = "http://" .. host .. prefix .. "/index.html" | 100 | url = "http://" .. host .. prefix .. "/index.html" |
| @@ -92,6 +109,7 @@ ignore = { | |||
| 92 | } | 109 | } |
| 93 | check_request(request, expect, ignore) | 110 | check_request(request, expect, ignore) |
| 94 | 111 | ||
| 112 | ------------------------------------------------------------------------ | ||
| 95 | io.write("testing redirect loop: ") | 113 | io.write("testing redirect loop: ") |
| 96 | request = { | 114 | request = { |
| 97 | url = "http://" .. host .. cgiprefix .. "/redirect-loop" | 115 | url = "http://" .. host .. cgiprefix .. "/redirect-loop" |
| @@ -106,6 +124,7 @@ ignore = { | |||
| 106 | } | 124 | } |
| 107 | check_request(request, expect, ignore) | 125 | check_request(request, expect, ignore) |
| 108 | 126 | ||
| 127 | ------------------------------------------------------------------------ | ||
| 109 | io.write("testing post method: ") | 128 | io.write("testing post method: ") |
| 110 | -- wanted to test chunked post, but apache doesn't support it... | 129 | -- wanted to test chunked post, but apache doesn't support it... |
| 111 | request = { | 130 | request = { |
| @@ -125,6 +144,7 @@ ignore = { | |||
| 125 | } | 144 | } |
| 126 | check_request(request, expect, ignore) | 145 | check_request(request, expect, ignore) |
| 127 | 146 | ||
| 147 | ------------------------------------------------------------------------ | ||
| 128 | io.write("testing proxy with post method: ") | 148 | io.write("testing proxy with post method: ") |
| 129 | request = { | 149 | request = { |
| 130 | url = "http://" .. host .. cgiprefix .. "/cat", | 150 | url = "http://" .. host .. cgiprefix .. "/cat", |
| @@ -143,10 +163,78 @@ ignore = { | |||
| 143 | } | 163 | } |
| 144 | check_request(request, expect, ignore) | 164 | check_request(request, expect, ignore) |
| 145 | 165 | ||
| 166 | ------------------------------------------------------------------------ | ||
| 146 | io.write("testing simple post function: ") | 167 | io.write("testing simple post function: ") |
| 147 | back = socket.http.post("http://" .. host .. cgiprefix .. "/cat", index) | 168 | back = socket.http.post("http://" .. host .. cgiprefix .. "/cat", index) |
| 148 | check(back == index) | 169 | check(back == index) |
| 149 | 170 | ||
| 171 | ------------------------------------------------------------------------ | ||
| 172 | io.write("testing send.file and receive.file callbacks: ") | ||
| 173 | request = { | ||
| 174 | url = "http://" .. host .. cgiprefix .. "/cat", | ||
| 175 | method = "POST", | ||
| 176 | body_cb = socket.callback.send.file(io.open(index_file, "r")), | ||
| 177 | headers = { ["content-length"] = string.len(index) } | ||
| 178 | } | ||
| 179 | response = { | ||
| 180 | body_cb = socket.callback.receive.file(io.open(index_file .. "-back", "w")) | ||
| 181 | } | ||
| 182 | expect = { | ||
| 183 | code = 200 | ||
| 184 | } | ||
| 185 | ignore = { | ||
| 186 | body_cb = 1, | ||
| 187 | status = 1, | ||
| 188 | headers = 1 | ||
| 189 | } | ||
| 190 | check_request_cb(request, response, expect, ignore) | ||
| 191 | back = readfile(index_file .. "-back") | ||
| 192 | check(back == index) | ||
| 193 | os.remove(index_file .. "-back") | ||
| 194 | |||
| 195 | ------------------------------------------------------------------------ | ||
| 196 | io.write("testing send.chain and receive.chain callbacks: ") | ||
| 197 | |||
| 198 | local function b64length(len) | ||
| 199 | local a = math.ceil(len/3)*4 | ||
| 200 | local l = math.ceil(a/76) | ||
| 201 | return a + l*2 | ||
| 202 | end | ||
| 203 | |||
| 204 | local req_cb = socket.callback.send.chain( | ||
| 205 | socket.callback.send.file(io.open(index_file, "r")), | ||
| 206 | socket.mime.chain( | ||
| 207 | socket.mime.encode("base64"), | ||
| 208 | socket.mime.wrap("base64") | ||
| 209 | ) | ||
| 210 | ) | ||
| 211 | |||
| 212 | local resp_cb = socket.callback.receive.chain( | ||
| 213 | socket.mime.decode("base64"), | ||
| 214 | socket.callback.receive.file(io.open(index_file .. "-back", "w")) | ||
| 215 | ) | ||
| 216 | |||
| 217 | request = { | ||
| 218 | url = "http://" .. host .. cgiprefix .. "/cat", | ||
| 219 | method = "POST", | ||
| 220 | body_cb = req_cb, | ||
| 221 | headers = { ["content-length"] = b64length(string.len(index)) } | ||
| 222 | } | ||
| 223 | response = { body_cb = resp_cb } | ||
| 224 | expect = { | ||
| 225 | code = 200 | ||
| 226 | } | ||
| 227 | ignore = { | ||
| 228 | body_cb = 1, | ||
| 229 | status = 1, | ||
| 230 | headers = 1 | ||
| 231 | } | ||
| 232 | check_request_cb(request, response, expect, ignore) | ||
| 233 | back = readfile(index_file .. "-back") | ||
| 234 | check(back == index) | ||
| 235 | os.remove(index_file .. "-back") | ||
| 236 | |||
| 237 | ------------------------------------------------------------------------ | ||
| 150 | io.write("testing simple post function with table args: ") | 238 | io.write("testing simple post function with table args: ") |
| 151 | back = socket.http.post { | 239 | back = socket.http.post { |
| 152 | url = "http://" .. host .. cgiprefix .. "/cat", | 240 | url = "http://" .. host .. cgiprefix .. "/cat", |
| @@ -154,6 +242,7 @@ back = socket.http.post { | |||
| 154 | } | 242 | } |
| 155 | check(back == index) | 243 | check(back == index) |
| 156 | 244 | ||
| 245 | ------------------------------------------------------------------------ | ||
| 157 | io.write("testing http redirection: ") | 246 | io.write("testing http redirection: ") |
| 158 | request = { | 247 | request = { |
| 159 | url = "http://" .. host .. prefix | 248 | url = "http://" .. host .. prefix |
| @@ -168,6 +257,7 @@ ignore = { | |||
| 168 | } | 257 | } |
| 169 | check_request(request, expect, ignore) | 258 | check_request(request, expect, ignore) |
| 170 | 259 | ||
| 260 | ------------------------------------------------------------------------ | ||
| 171 | io.write("testing proxy with redirection: ") | 261 | io.write("testing proxy with redirection: ") |
| 172 | request = { | 262 | request = { |
| 173 | url = "http://" .. host .. prefix, | 263 | url = "http://" .. host .. prefix, |
| @@ -183,7 +273,7 @@ ignore = { | |||
| 183 | } | 273 | } |
| 184 | check_request(request, expect, ignore) | 274 | check_request(request, expect, ignore) |
| 185 | 275 | ||
| 186 | 276 | ------------------------------------------------------------------------ | |
| 187 | io.write("testing automatic auth failure: ") | 277 | io.write("testing automatic auth failure: ") |
| 188 | request = { | 278 | request = { |
| 189 | url = "http://really:wrong@" .. host .. prefix .. "/auth/index.html" | 279 | url = "http://really:wrong@" .. host .. prefix .. "/auth/index.html" |
| @@ -198,6 +288,7 @@ ignore = { | |||
| 198 | } | 288 | } |
| 199 | check_request(request, expect, ignore) | 289 | check_request(request, expect, ignore) |
| 200 | 290 | ||
| 291 | ------------------------------------------------------------------------ | ||
| 201 | io.write("testing http redirection failure: ") | 292 | io.write("testing http redirection failure: ") |
| 202 | request = { | 293 | request = { |
| 203 | url = "http://" .. host .. prefix, | 294 | url = "http://" .. host .. prefix, |
| @@ -213,6 +304,7 @@ ignore = { | |||
| 213 | } | 304 | } |
| 214 | check_request(request, expect, ignore) | 305 | check_request(request, expect, ignore) |
| 215 | 306 | ||
| 307 | ------------------------------------------------------------------------ | ||
| 216 | io.write("testing host not found: ") | 308 | io.write("testing host not found: ") |
| 217 | request = { | 309 | request = { |
| 218 | url = "http://wronghost/does/not/exist" | 310 | url = "http://wronghost/does/not/exist" |
| @@ -224,6 +316,7 @@ expect = { | |||
| 224 | ignore = {} | 316 | ignore = {} |
| 225 | check_request(request, expect, ignore) | 317 | check_request(request, expect, ignore) |
| 226 | 318 | ||
| 319 | ------------------------------------------------------------------------ | ||
| 227 | io.write("testing invalid url: ") | 320 | io.write("testing invalid url: ") |
| 228 | request = { | 321 | request = { |
| 229 | url = host .. prefix | 322 | url = host .. prefix |
| @@ -235,6 +328,7 @@ expect = { | |||
| 235 | ignore = {} | 328 | ignore = {} |
| 236 | check_request(request, expect, ignore) | 329 | check_request(request, expect, ignore) |
| 237 | 330 | ||
| 331 | ------------------------------------------------------------------------ | ||
| 238 | io.write("testing document not found: ") | 332 | io.write("testing document not found: ") |
| 239 | request = { | 333 | request = { |
| 240 | url = "http://" .. host .. "/wrongdocument.html" | 334 | url = "http://" .. host .. "/wrongdocument.html" |
| @@ -249,6 +343,7 @@ ignore = { | |||
| 249 | } | 343 | } |
| 250 | check_request(request, expect, ignore) | 344 | check_request(request, expect, ignore) |
| 251 | 345 | ||
| 346 | ------------------------------------------------------------------------ | ||
| 252 | io.write("testing auth failure: ") | 347 | io.write("testing auth failure: ") |
| 253 | request = { | 348 | request = { |
| 254 | url = "http://" .. host .. prefix .. "/auth/index.html" | 349 | url = "http://" .. host .. prefix .. "/auth/index.html" |
| @@ -263,6 +358,7 @@ ignore = { | |||
| 263 | } | 358 | } |
| 264 | check_request(request, expect, ignore) | 359 | check_request(request, expect, ignore) |
| 265 | 360 | ||
| 361 | ------------------------------------------------------------------------ | ||
| 266 | io.write("testing manual basic auth: ") | 362 | io.write("testing manual basic auth: ") |
| 267 | request = { | 363 | request = { |
| 268 | url = "http://" .. host .. prefix .. "/auth/index.html", | 364 | url = "http://" .. host .. prefix .. "/auth/index.html", |
| @@ -280,6 +376,7 @@ ignore = { | |||
| 280 | } | 376 | } |
| 281 | check_request(request, expect, ignore) | 377 | check_request(request, expect, ignore) |
| 282 | 378 | ||
| 379 | ------------------------------------------------------------------------ | ||
| 283 | io.write("testing automatic basic auth: ") | 380 | io.write("testing automatic basic auth: ") |
| 284 | request = { | 381 | request = { |
| 285 | url = "http://luasocket:password@" .. host .. prefix .. "/auth/index.html" | 382 | url = "http://luasocket:password@" .. host .. prefix .. "/auth/index.html" |
| @@ -294,6 +391,7 @@ ignore = { | |||
| 294 | } | 391 | } |
| 295 | check_request(request, expect, ignore) | 392 | check_request(request, expect, ignore) |
| 296 | 393 | ||
| 394 | ------------------------------------------------------------------------ | ||
| 297 | io.write("testing auth info overriding: ") | 395 | io.write("testing auth info overriding: ") |
| 298 | request = { | 396 | request = { |
| 299 | url = "http://really:wrong@" .. host .. prefix .. "/auth/index.html", | 397 | url = "http://really:wrong@" .. host .. prefix .. "/auth/index.html", |
| @@ -310,6 +408,7 @@ ignore = { | |||
| 310 | } | 408 | } |
| 311 | check_request(request, expect, ignore) | 409 | check_request(request, expect, ignore) |
| 312 | 410 | ||
| 411 | ------------------------------------------------------------------------ | ||
| 313 | io.write("testing cgi output retrieval (probably chunked...): ") | 412 | io.write("testing cgi output retrieval (probably chunked...): ") |
| 314 | request = { | 413 | request = { |
| 315 | url = "http://" .. host .. cgiprefix .. "/cat-index-html" | 414 | url = "http://" .. host .. cgiprefix .. "/cat-index-html" |
| @@ -324,6 +423,7 @@ ignore = { | |||
| 324 | } | 423 | } |
| 325 | check_request(request, expect, ignore) | 424 | check_request(request, expect, ignore) |
| 326 | 425 | ||
| 426 | ------------------------------------------------------------------------ | ||
| 327 | io.write("testing wrong scheme: ") | 427 | io.write("testing wrong scheme: ") |
| 328 | request = { | 428 | request = { |
| 329 | url = "wrong://" .. host .. cgiprefix .. "/cat", | 429 | url = "wrong://" .. host .. cgiprefix .. "/cat", |
| @@ -336,11 +436,13 @@ ignore = { | |||
| 336 | } | 436 | } |
| 337 | check_request(request, expect, ignore) | 437 | check_request(request, expect, ignore) |
| 338 | 438 | ||
| 439 | ------------------------------------------------------------------------ | ||
| 339 | local body | 440 | local body |
| 340 | io.write("testing simple get function: ") | 441 | io.write("testing simple get function: ") |
| 341 | body = socket.http.get("http://" .. host .. prefix .. "/index.html") | 442 | body = socket.http.get("http://" .. host .. prefix .. "/index.html") |
| 342 | check(body == index) | 443 | check(body == index) |
| 343 | 444 | ||
| 445 | ------------------------------------------------------------------------ | ||
| 344 | io.write("testing simple get function with table args: ") | 446 | io.write("testing simple get function with table args: ") |
| 345 | body = socket.http.get { | 447 | body = socket.http.get { |
| 346 | url = "http://really:wrong@" .. host .. prefix .. "/auth/index.html", | 448 | url = "http://really:wrong@" .. host .. prefix .. "/auth/index.html", |
| @@ -349,6 +451,7 @@ body = socket.http.get { | |||
| 349 | } | 451 | } |
| 350 | check(body == index) | 452 | check(body == index) |
| 351 | 453 | ||
| 454 | ------------------------------------------------------------------------ | ||
| 352 | io.write("testing HEAD method: ") | 455 | io.write("testing HEAD method: ") |
| 353 | socket.http.TIMEOUT = 1 | 456 | socket.http.TIMEOUT = 1 |
| 354 | response = socket.http.request { | 457 | response = socket.http.request { |
| @@ -357,6 +460,7 @@ response = socket.http.request { | |||
| 357 | } | 460 | } |
| 358 | check(response and response.headers) | 461 | check(response and response.headers) |
| 359 | 462 | ||
| 463 | ------------------------------------------------------------------------ | ||
| 360 | print("passed all tests") | 464 | print("passed all tests") |
| 361 | 465 | ||
| 362 | print(string.format("done in %.2fs", socket.time() - t)) | 466 | print(string.format("done in %.2fs", socket.time() - t)) |
diff --git a/test/mimetest.lua b/test/mimetest.lua index 5485db1..0adcb18 100644 --- a/test/mimetest.lua +++ b/test/mimetest.lua | |||
| @@ -66,8 +66,8 @@ local function compare(input, output) | |||
| 66 | end | 66 | end |
| 67 | 67 | ||
| 68 | local function encode_qptest(mode) | 68 | local function encode_qptest(mode) |
| 69 | local encode = socket.mime.qprint.encode(mode) | 69 | local encode = socket.mime.encode("quoted-printable", mode) |
| 70 | local split = socket.mime.qprint.split() | 70 | local split = socket.mime.wrap("quoted-printable") |
| 71 | local chain = socket.mime.chain(encode, split) | 71 | local chain = socket.mime.chain(encode, split) |
| 72 | transform(qptest, eqptest, chain) | 72 | transform(qptest, eqptest, chain) |
| 73 | end | 73 | end |
| @@ -77,7 +77,7 @@ local function compare_qptest() | |||
| 77 | end | 77 | end |
| 78 | 78 | ||
| 79 | local function decode_qptest() | 79 | local function decode_qptest() |
| 80 | local decode = socket.mime.qprint.decode() | 80 | local decode = socket.mime.decode("quoted-printable") |
| 81 | transform(eqptest, dqptest, decode) | 81 | transform(eqptest, dqptest, decode) |
| 82 | end | 82 | end |
| 83 | 83 | ||
| @@ -151,23 +151,23 @@ local function cleanup_qptest() | |||
| 151 | end | 151 | end |
| 152 | 152 | ||
| 153 | local function encode_b64test() | 153 | local function encode_b64test() |
| 154 | local e1 = socket.mime.base64.encode() | 154 | local e1 = socket.mime.encode("base64") |
| 155 | local e2 = socket.mime.base64.encode() | 155 | local e2 = socket.mime.encode("base64") |
| 156 | local e3 = socket.mime.base64.encode() | 156 | local e3 = socket.mime.encode("base64") |
| 157 | local e4 = socket.mime.base64.encode() | 157 | local e4 = socket.mime.encode("base64") |
| 158 | local sp4 = socket.mime.split() | 158 | local sp4 = socket.mime.wrap("character") |
| 159 | local sp3 = socket.mime.split(59) | 159 | local sp3 = socket.mime.wrap("character", 59) |
| 160 | local sp2 = socket.mime.split(30) | 160 | local sp2 = socket.mime.wrap("character", 30) |
| 161 | local sp1 = socket.mime.split(27) | 161 | local sp1 = socket.mime.wrap("character", 27) |
| 162 | local chain = socket.mime.chain(e1, sp1, e2, sp2, e3, sp3, e4, sp4) | 162 | local chain = socket.mime.chain(e1, sp1, e2, sp2, e3, sp3, e4, sp4) |
| 163 | transform(b64test, eb64test, chain) | 163 | transform(b64test, eb64test, chain) |
| 164 | end | 164 | end |
| 165 | 165 | ||
| 166 | local function decode_b64test() | 166 | local function decode_b64test() |
| 167 | local d1 = socket.mime.base64.decode() | 167 | local d1 = socket.mime.decode("base64") |
| 168 | local d2 = socket.mime.base64.decode() | 168 | local d2 = socket.mime.decode("base64") |
| 169 | local d3 = socket.mime.base64.decode() | 169 | local d3 = socket.mime.decode("base64") |
| 170 | local d4 = socket.mime.base64.decode() | 170 | local d4 = socket.mime.decode("base64") |
| 171 | local chain = socket.mime.chain(d1, d2, d3, d4) | 171 | local chain = socket.mime.chain(d1, d2, d3, d4) |
| 172 | transform(eb64test, db64test, chain) | 172 | transform(eb64test, db64test, chain) |
| 173 | end | 173 | end |
