Bug in forward.lua. Wasn't breaking from the loop.

This commit is contained in:
Diego Nehab
2005-04-21 05:38:07 +00:00
parent 434e8e014c
commit 9596c7f95d
3 changed files with 18 additions and 12 deletions

View File

@ -105,7 +105,7 @@ function metat.__index:send(sendt)
if self.pasvt then self:pasvconnect() end
-- get the transfer argument and command
local argument = sendt.argument or
url.unescape(string.gsub(sendt.path or "", "^/", ""))
url.unescape(string.gsub(sendt.path or "", "^[/\\]", ""))
if argument == "" then argument = nil end
local command = sendt.command or "stor"
-- send the transfer command and check the reply
@ -138,7 +138,7 @@ function metat.__index:receive(recvt)
self.try(self.pasvt or self.server, "need port or pasv first")
if self.pasvt then self:pasvconnect() end
local argument = recvt.argument or
url.unescape(string.gsub(recvt.path or "", "^/", ""))
url.unescape(string.gsub(recvt.path or "", "^[/\\]", ""))
if argument == "" then argument = nil end
local command = recvt.command or "retr"
self.try(self.tp:command(command, argument))

View File

@ -213,13 +213,14 @@ static int meth_connect(lua_State *L)
unsigned short port = (unsigned short) luaL_checknumber(L, 3);
p_tm tm = tm_markstart(&tcp->tm);
const char *err = inet_tryconnect(&tcp->sock, address, port, tm);
/* have to set the class even if it failed due to non-blocking connects */
aux_setclass(L, "tcp{client}", 1);
if (err) {
lua_pushnil(L);
lua_pushstring(L, err);
return 2;
}
/* turn master object into a client object */
aux_setclass(L, "tcp{client}", 1);
lua_pushnumber(L, 1);
return 1;
}