aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2005-08-23 05:53:14 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2005-08-23 05:53:14 +0000
commit773e35ced30fa2c03ddb2a332bf8a9aebb56aa44 (patch)
tree03e8e9a4bd64b9424006315c8e720c3f2841a751 /test
parent5e8ae76248ed31496dc6fef7855498a0479159ed (diff)
downloadluasocket-773e35ced30fa2c03ddb2a332bf8a9aebb56aa44.tar.gz
luasocket-773e35ced30fa2c03ddb2a332bf8a9aebb56aa44.tar.bz2
luasocket-773e35ced30fa2c03ddb2a332bf8a9aebb56aa44.zip
Compiled on Windows. Fixed a bunch of stuff. Almost ready to release.
Implemented a nice dispatcher! Non-blocking check-links and forward server use the dispatcher.
Diffstat (limited to 'test')
-rw-r--r--test/ftptest.lua4
-rw-r--r--test/testmesg.lua42
2 files changed, 40 insertions, 6 deletions
diff --git a/test/ftptest.lua b/test/ftptest.lua
index ef1bf0f..63d20e6 100644
--- a/test/ftptest.lua
+++ b/test/ftptest.lua
@@ -12,8 +12,8 @@ local host, port, index_file, index, back, err, ret
12 12
13local t = socket.gettime() 13local t = socket.gettime()
14 14
15host = host or "diego.student.princeton.edu" 15host = host or "localhost"
16index_file = "test/index.html" 16index_file = "index.html"
17 17
18 18
19-- a function that returns a directory listing 19-- a function that returns a directory listing
diff --git a/test/testmesg.lua b/test/testmesg.lua
index 37e8c11..1dd9a97 100644
--- a/test/testmesg.lua
+++ b/test/testmesg.lua
@@ -3,6 +3,42 @@ local smtp = require("socket.smtp")
3local mime = require("mime") 3local mime = require("mime")
4local ltn12 = require("ltn12") 4local ltn12 = require("ltn12")
5 5
6function filter(s)
7 if s then io.write(s) end
8 return s
9end
10
11source = smtp.message {
12 headers = { ['content-type'] = 'multipart/alternative' },
13 body = {
14 [1] = {
15 headers = { ['content-type'] = 'text/html' },
16 body = "<html> <body> Hi, <b>there</b>...</body> </html>"
17 },
18 [2] = {
19 headers = { ['content-type'] = 'text/plain' },
20 body = "Hi, there..."
21 }
22 }
23}
24
25r, e = smtp.send{
26 rcpt = {"<diego@tecgraf.puc-rio.br>",
27 "<diego@princeton.edu>" },
28 from = "<diego@princeton.edu>",
29 source = ltn12.source.chain(source, filter),
30 --server = "mail.cs.princeton.edu"
31 server = "localhost",
32 port = 2525
33}
34
35
36os.exit()
37
38
39
40
41
6-- creates a source to send a message with two parts. The first part is 42-- creates a source to send a message with two parts. The first part is
7-- plain text, the second part is a PNG image, encoded as base64. 43-- plain text, the second part is a PNG image, encoded as base64.
8source = smtp.message{ 44source = smtp.message{
@@ -48,10 +84,6 @@ source = smtp.message{
48 } 84 }
49} 85}
50 86
51function filter(s)
52 if s then io.write(s) end
53 return s
54end
55 87
56r, e = smtp.send{ 88r, e = smtp.send{
57 rcpt = {"<diego@tecgraf.puc-rio.br>", 89 rcpt = {"<diego@tecgraf.puc-rio.br>",
@@ -64,3 +96,5 @@ r, e = smtp.send{
64} 96}
65 97
66print(r, e) 98print(r, e)
99
100