Almost there.

This commit is contained in:
Diego Nehab 2004-05-28 07:47:41 +00:00
parent 84f03fda7c
commit 6c565dd7c0
11 changed files with 20 additions and 14 deletions

3
TODO
View File

@ -35,6 +35,9 @@
* Create a passive mode option for the FTP (good for firewall). * Create a passive mode option for the FTP (good for firewall).
* Modules should return their namespace table in the end of the chunk. * Modules should return their namespace table in the end of the chunk.
get.lua precisa de ftp.get com url e sink
make sure filter.chain fails gracefully.
ajeitar o manual sobre select, mais liberal agora ajeitar o manual sobre select, mais liberal agora
conjunto associativo conjunto associativo

View File

@ -5,7 +5,6 @@
-- RCS ID: $Id$ -- RCS ID: $Id$
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
require"luasocket"
require"http" require"http"
socket.http.TIMEOUT = 10 socket.http.TIMEOUT = 10

View File

@ -1,6 +1,9 @@
require"mime.lua"
require"ltn12.lua"
local marker = '\n' local marker = '\n'
if arg and arg[1] == '-d' then marker = '\r\n' end if arg and arg[1] == '-d' then marker = '\r\n' end
local filter = mime.normalize(marker) local filter = mime.normalize(marker)
local source = ltn12.source.chain(ltn12.source.file(io.stdin), filter) local source = ltn12.source.chain(ltn12.source.file(io.stdin), filter)
local sink = ltn12.sink.file(io.stdout) local sink = ltn12.sink.file(io.stdout)
ltn12.pump(source, sink) ltn12.pump.all(source, sink)

View File

@ -4,6 +4,10 @@
-- Author: Diego Nehab -- Author: Diego Nehab
-- RCS ID: $Id$ -- RCS ID: $Id$
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
require"http"
require"ftp"
require"url"
-- formats a number of seconds into human readable form -- formats a number of seconds into human readable form
function nicetime(s) function nicetime(s)
local l = "s" local l = "s"

View File

@ -1,4 +1,3 @@
require"luasocket"
require"http" require"http"
if not arg or not arg[1] or not arg[2] then if not arg or not arg[1] or not arg[2] then

View File

@ -6,10 +6,9 @@
-- RCS ID: $Id$ -- RCS ID: $Id$
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- make sure LuaSocket is loaded -- make sure LuaSocket is loaded
if not LUASOCKET_LIBNAME then error('module requires LuaSocket') end require("luasocket")
-- get LuaSocket namespace -- get LuaSocket namespace
local socket = _G[LUASOCKET_LIBNAME] local socket = _G[LUASOCKET_LIBNAME]
if not socket then error('module requires LuaSocket') end
-- require other modules -- require other modules
require("ltn12") require("ltn12")

View File

@ -6,10 +6,9 @@
-- RCS ID: $Id$ -- RCS ID: $Id$
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- make sure LuaSocket is loaded -- make sure LuaSocket is loaded
if not LUASOCKET_LIBNAME then error('module requires LuaSocket') end require("luasocket")
-- get LuaSocket namespace -- get LuaSocket namespace
local socket = _G[LUASOCKET_LIBNAME] local socket = _G[LUASOCKET_LIBNAME]
if not socket then error('module requires LuaSocket') end
-- require other modules -- require other modules
require("ltn12") require("ltn12")

View File

@ -6,10 +6,11 @@
-- RCS ID: $Id$ -- RCS ID: $Id$
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- make sure LuaSocket is loaded -- make sure LuaSocket is loaded
if not LUASOCKET_LIBNAME then error('module requires LuaSocket') end require"luasocket"
-- get LuaSocket namespace -- get LuaSocket namespace
local socket = _G[LUASOCKET_LIBNAME] local socket = _G[LUASOCKET_LIBNAME]
if not socket then error('module requires LuaSocket') end
require"ltn12"
-- create smtp namespace inside LuaSocket namespace -- create smtp namespace inside LuaSocket namespace
local smtp = socket.smtp or {} local smtp = socket.smtp or {}
@ -18,6 +19,7 @@ socket.smtp = smtp
setmetatable(smtp, { __index = _G }) setmetatable(smtp, { __index = _G })
setfenv(1, smtp) setfenv(1, smtp)
-- default server used to send e-mails -- default server used to send e-mails
SERVER = "localhost" SERVER = "localhost"
-- default port -- default port

View File

@ -5,13 +5,11 @@
-- Conforming to: RFC 2396, LTN7 -- Conforming to: RFC 2396, LTN7
-- RCS ID: $Id$ -- RCS ID: $Id$
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
-- make sure LuaSocket is loaded -- make sure LuaSocket is loaded
if not LUASOCKET_LIBNAME then error('module requires LuaSocket') end require"luasocket"
-- get LuaSocket namespace -- get LuaSocket namespace
local socket = _G[LUASOCKET_LIBNAME] local socket = _G[LUASOCKET_LIBNAME]
if not socket then error('module requires LuaSocket') end -- create url namespace inside LuaSocket namespace
-- create smtp namespace inside LuaSocket namespace
local url = socket.url or {} local url = socket.url or {}
socket.url = url socket.url = url
-- make all module globals fall into smtp namespace -- make all module globals fall into smtp namespace

View File

@ -4,7 +4,6 @@
-- to "/luasocket-test-cgi" and "/luasocket-test-cgi/" -- to "/luasocket-test-cgi" and "/luasocket-test-cgi/"
-- needs "AllowOverride AuthConfig" on /home/c/diego/tec/luasocket/test/auth -- needs "AllowOverride AuthConfig" on /home/c/diego/tec/luasocket/test/auth
require("luasocket")
require("http") require("http")
dofile("testsupport.lua") dofile("testsupport.lua")

View File

@ -1,3 +1,4 @@
require"url"
dofile("testsupport.lua") dofile("testsupport.lua")
local check_build_url = function(parsed) local check_build_url = function(parsed)