diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-05-28 07:47:41 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-05-28 07:47:41 +0000 |
commit | 6c565dd7c06c96fd9b3394ade61f46da59590d30 (patch) | |
tree | f303c1a94627e002fa4dd73d2f2641596b8b1420 | |
parent | 84f03fda7c2be57e14f937e295710b5e883fedc6 (diff) | |
download | luasocket-6c565dd7c06c96fd9b3394ade61f46da59590d30.tar.gz luasocket-6c565dd7c06c96fd9b3394ade61f46da59590d30.tar.bz2 luasocket-6c565dd7c06c96fd9b3394ade61f46da59590d30.zip |
Almost there.
-rw-r--r-- | TODO | 3 | ||||
-rw-r--r-- | etc/check-links.lua | 1 | ||||
-rw-r--r-- | etc/eol.lua | 5 | ||||
-rw-r--r-- | etc/get.lua | 4 | ||||
-rw-r--r-- | samples/cddb.lua | 1 | ||||
-rw-r--r-- | src/ftp.lua | 3 | ||||
-rw-r--r-- | src/http.lua | 3 | ||||
-rw-r--r-- | src/smtp.lua | 6 | ||||
-rw-r--r-- | src/url.lua | 6 | ||||
-rw-r--r-- | test/httptest.lua | 1 | ||||
-rw-r--r-- | test/urltest.lua | 1 |
11 files changed, 20 insertions, 14 deletions
@@ -35,6 +35,9 @@ | |||
35 | * Create a passive mode option for the FTP (good for firewall). | 35 | * Create a passive mode option for the FTP (good for firewall). |
36 | * Modules should return their namespace table in the end of the chunk. | 36 | * Modules should return their namespace table in the end of the chunk. |
37 | 37 | ||
38 | |||
39 | get.lua precisa de ftp.get com url e sink | ||
40 | make sure filter.chain fails gracefully. | ||
38 | ajeitar o manual sobre select, mais liberal agora | 41 | ajeitar o manual sobre select, mais liberal agora |
39 | conjunto associativo | 42 | conjunto associativo |
40 | 43 | ||
diff --git a/etc/check-links.lua b/etc/check-links.lua index c200dfb..898ed4b 100644 --- a/etc/check-links.lua +++ b/etc/check-links.lua | |||
@@ -5,7 +5,6 @@ | |||
5 | -- RCS ID: $Id$ | 5 | -- RCS ID: $Id$ |
6 | ----------------------------------------------------------------------------- | 6 | ----------------------------------------------------------------------------- |
7 | 7 | ||
8 | require"luasocket" | ||
9 | require"http" | 8 | require"http" |
10 | 9 | ||
11 | socket.http.TIMEOUT = 10 | 10 | socket.http.TIMEOUT = 10 |
diff --git a/etc/eol.lua b/etc/eol.lua index aa43596..b13684b 100644 --- a/etc/eol.lua +++ b/etc/eol.lua | |||
@@ -1,6 +1,9 @@ | |||
1 | require"mime.lua" | ||
2 | require"ltn12.lua" | ||
3 | |||
1 | local marker = '\n' | 4 | local marker = '\n' |
2 | if arg and arg[1] == '-d' then marker = '\r\n' end | 5 | if arg and arg[1] == '-d' then marker = '\r\n' end |
3 | local filter = mime.normalize(marker) | 6 | local filter = mime.normalize(marker) |
4 | local source = ltn12.source.chain(ltn12.source.file(io.stdin), filter) | 7 | local source = ltn12.source.chain(ltn12.source.file(io.stdin), filter) |
5 | local sink = ltn12.sink.file(io.stdout) | 8 | local sink = ltn12.sink.file(io.stdout) |
6 | ltn12.pump(source, sink) | 9 | ltn12.pump.all(source, sink) |
diff --git a/etc/get.lua b/etc/get.lua index aa29ec2..cc270e8 100644 --- a/etc/get.lua +++ b/etc/get.lua | |||
@@ -4,6 +4,10 @@ | |||
4 | -- Author: Diego Nehab | 4 | -- Author: Diego Nehab |
5 | -- RCS ID: $Id$ | 5 | -- RCS ID: $Id$ |
6 | ----------------------------------------------------------------------------- | 6 | ----------------------------------------------------------------------------- |
7 | require"http" | ||
8 | require"ftp" | ||
9 | require"url" | ||
10 | |||
7 | -- formats a number of seconds into human readable form | 11 | -- formats a number of seconds into human readable form |
8 | function nicetime(s) | 12 | function nicetime(s) |
9 | local l = "s" | 13 | local l = "s" |
diff --git a/samples/cddb.lua b/samples/cddb.lua index 09309e8..d2e5b59 100644 --- a/samples/cddb.lua +++ b/samples/cddb.lua | |||
@@ -1,4 +1,3 @@ | |||
1 | require"luasocket" | ||
2 | require"http" | 1 | require"http" |
3 | 2 | ||
4 | if not arg or not arg[1] or not arg[2] then | 3 | if not arg or not arg[1] or not arg[2] then |
diff --git a/src/ftp.lua b/src/ftp.lua index efb872a..f197018 100644 --- a/src/ftp.lua +++ b/src/ftp.lua | |||
@@ -6,10 +6,9 @@ | |||
6 | -- RCS ID: $Id$ | 6 | -- RCS ID: $Id$ |
7 | ----------------------------------------------------------------------------- | 7 | ----------------------------------------------------------------------------- |
8 | -- make sure LuaSocket is loaded | 8 | -- make sure LuaSocket is loaded |
9 | if not LUASOCKET_LIBNAME then error('module requires LuaSocket') end | 9 | require("luasocket") |
10 | -- get LuaSocket namespace | 10 | -- get LuaSocket namespace |
11 | local socket = _G[LUASOCKET_LIBNAME] | 11 | local socket = _G[LUASOCKET_LIBNAME] |
12 | if not socket then error('module requires LuaSocket') end | ||
13 | 12 | ||
14 | -- require other modules | 13 | -- require other modules |
15 | require("ltn12") | 14 | require("ltn12") |
diff --git a/src/http.lua b/src/http.lua index e6a0928..7dee8e6 100644 --- a/src/http.lua +++ b/src/http.lua | |||
@@ -6,10 +6,9 @@ | |||
6 | -- RCS ID: $Id$ | 6 | -- RCS ID: $Id$ |
7 | ----------------------------------------------------------------------------- | 7 | ----------------------------------------------------------------------------- |
8 | -- make sure LuaSocket is loaded | 8 | -- make sure LuaSocket is loaded |
9 | if not LUASOCKET_LIBNAME then error('module requires LuaSocket') end | 9 | require("luasocket") |
10 | -- get LuaSocket namespace | 10 | -- get LuaSocket namespace |
11 | local socket = _G[LUASOCKET_LIBNAME] | 11 | local socket = _G[LUASOCKET_LIBNAME] |
12 | if not socket then error('module requires LuaSocket') end | ||
13 | 12 | ||
14 | -- require other modules | 13 | -- require other modules |
15 | require("ltn12") | 14 | require("ltn12") |
diff --git a/src/smtp.lua b/src/smtp.lua index 1d1905e..8b5e622 100644 --- a/src/smtp.lua +++ b/src/smtp.lua | |||
@@ -6,10 +6,11 @@ | |||
6 | -- RCS ID: $Id$ | 6 | -- RCS ID: $Id$ |
7 | ----------------------------------------------------------------------------- | 7 | ----------------------------------------------------------------------------- |
8 | -- make sure LuaSocket is loaded | 8 | -- make sure LuaSocket is loaded |
9 | if not LUASOCKET_LIBNAME then error('module requires LuaSocket') end | 9 | require"luasocket" |
10 | -- get LuaSocket namespace | 10 | -- get LuaSocket namespace |
11 | local socket = _G[LUASOCKET_LIBNAME] | 11 | local socket = _G[LUASOCKET_LIBNAME] |
12 | if not socket then error('module requires LuaSocket') end | 12 | |
13 | require"ltn12" | ||
13 | 14 | ||
14 | -- create smtp namespace inside LuaSocket namespace | 15 | -- create smtp namespace inside LuaSocket namespace |
15 | local smtp = socket.smtp or {} | 16 | local smtp = socket.smtp or {} |
@@ -18,6 +19,7 @@ socket.smtp = smtp | |||
18 | setmetatable(smtp, { __index = _G }) | 19 | setmetatable(smtp, { __index = _G }) |
19 | setfenv(1, smtp) | 20 | setfenv(1, smtp) |
20 | 21 | ||
22 | |||
21 | -- default server used to send e-mails | 23 | -- default server used to send e-mails |
22 | SERVER = "localhost" | 24 | SERVER = "localhost" |
23 | -- default port | 25 | -- default port |
diff --git a/src/url.lua b/src/url.lua index 0fba14d..b385d88 100644 --- a/src/url.lua +++ b/src/url.lua | |||
@@ -5,13 +5,11 @@ | |||
5 | -- Conforming to: RFC 2396, LTN7 | 5 | -- Conforming to: RFC 2396, LTN7 |
6 | -- RCS ID: $Id$ | 6 | -- RCS ID: $Id$ |
7 | ---------------------------------------------------------------------------- | 7 | ---------------------------------------------------------------------------- |
8 | |||
9 | -- make sure LuaSocket is loaded | 8 | -- make sure LuaSocket is loaded |
10 | if not LUASOCKET_LIBNAME then error('module requires LuaSocket') end | 9 | require"luasocket" |
11 | -- get LuaSocket namespace | 10 | -- get LuaSocket namespace |
12 | local socket = _G[LUASOCKET_LIBNAME] | 11 | local socket = _G[LUASOCKET_LIBNAME] |
13 | if not socket then error('module requires LuaSocket') end | 12 | -- create url namespace inside LuaSocket namespace |
14 | -- create smtp namespace inside LuaSocket namespace | ||
15 | local url = socket.url or {} | 13 | local url = socket.url or {} |
16 | socket.url = url | 14 | socket.url = url |
17 | -- make all module globals fall into smtp namespace | 15 | -- make all module globals fall into smtp namespace |
diff --git a/test/httptest.lua b/test/httptest.lua index d237547..a70aa87 100644 --- a/test/httptest.lua +++ b/test/httptest.lua | |||
@@ -4,7 +4,6 @@ | |||
4 | -- to "/luasocket-test-cgi" and "/luasocket-test-cgi/" | 4 | -- to "/luasocket-test-cgi" and "/luasocket-test-cgi/" |
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 | 6 | ||
7 | require("luasocket") | ||
8 | require("http") | 7 | require("http") |
9 | 8 | ||
10 | dofile("testsupport.lua") | 9 | dofile("testsupport.lua") |
diff --git a/test/urltest.lua b/test/urltest.lua index 02b7077..8c2ee88 100644 --- a/test/urltest.lua +++ b/test/urltest.lua | |||
@@ -1,3 +1,4 @@ | |||
1 | require"url" | ||
1 | dofile("testsupport.lua") | 2 | dofile("testsupport.lua") |
2 | 3 | ||
3 | local check_build_url = function(parsed) | 4 | local check_build_url = function(parsed) |