diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2005-08-23 05:53:14 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2005-08-23 05:53:14 +0000 |
commit | 773e35ced30fa2c03ddb2a332bf8a9aebb56aa44 (patch) | |
tree | 03e8e9a4bd64b9424006315c8e720c3f2841a751 /test | |
parent | 5e8ae76248ed31496dc6fef7855498a0479159ed (diff) | |
download | luasocket-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.lua | 4 | ||||
-rw-r--r-- | test/testmesg.lua | 42 |
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 | ||
13 | local t = socket.gettime() | 13 | local t = socket.gettime() |
14 | 14 | ||
15 | host = host or "diego.student.princeton.edu" | 15 | host = host or "localhost" |
16 | index_file = "test/index.html" | 16 | index_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") | |||
3 | local mime = require("mime") | 3 | local mime = require("mime") |
4 | local ltn12 = require("ltn12") | 4 | local ltn12 = require("ltn12") |
5 | 5 | ||
6 | function filter(s) | ||
7 | if s then io.write(s) end | ||
8 | return s | ||
9 | end | ||
10 | |||
11 | source = 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 | |||
25 | r, 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 | |||
36 | os.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. |
8 | source = smtp.message{ | 44 | source = smtp.message{ |
@@ -48,10 +84,6 @@ source = smtp.message{ | |||
48 | } | 84 | } |
49 | } | 85 | } |
50 | 86 | ||
51 | function filter(s) | ||
52 | if s then io.write(s) end | ||
53 | return s | ||
54 | end | ||
55 | 87 | ||
56 | r, e = smtp.send{ | 88 | r, 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 | ||
66 | print(r, e) | 98 | print(r, e) |
99 | |||
100 | |||