Faltam testes de ftp e smtp. O resto passa.
This commit is contained in:
parent
d7e80592a6
commit
7da19138e3
9 changed files with 141 additions and 148 deletions
|
@ -74,7 +74,7 @@ int buf_send(lua_State *L, p_buf buf)
|
|||
}
|
||||
priv_pusherror(L, err);
|
||||
lua_pushnumber(L, total);
|
||||
#ifdef _DEBUG
|
||||
#ifdef LUASOCKET_DEBUG
|
||||
/* push time elapsed during operation as the last return value */
|
||||
lua_pushnumber(L, tm_getelapsed(&base->base_tm)/1000.0);
|
||||
#endif
|
||||
|
@ -139,7 +139,7 @@ int buf_receive(lua_State *L, p_buf buf)
|
|||
for ( ; arg <= top; arg++) lua_pushnil(L);
|
||||
/* last return is an error code */
|
||||
priv_pusherror(L, err);
|
||||
#ifdef _DEBUG
|
||||
#ifdef LUASOCKET_DEBUG
|
||||
/* push time elapsed during operation as the last return value */
|
||||
lua_pushnumber(L, tm_getelapsed(&base->base_tm)/1000.0);
|
||||
#endif
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
-----------------------------------------------------------------------------
|
||||
|
||||
local Public, Private = {}, {}
|
||||
HTTP = Public
|
||||
http = Public
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Program constants
|
||||
|
@ -195,7 +195,7 @@ end
|
|||
function Private.receivebody_bylength(sock, length, receive_cb)
|
||||
local uerr, go
|
||||
while length > 0 do
|
||||
local size = min(Public.BLOCKSIZE, length)
|
||||
local size = math.min(Public.BLOCKSIZE, length)
|
||||
local chunk, err = sock:receive(size)
|
||||
if err then
|
||||
go, uerr = receive_cb(nil, err)
|
||||
|
@ -542,7 +542,7 @@ function Public.request_cb(request, response)
|
|||
scheme = "http"
|
||||
})
|
||||
if parsed.scheme ~= "http" then
|
||||
response.error = format("unknown scheme '%s'", parsed.scheme)
|
||||
response.error = string.format("unknown scheme '%s'", parsed.scheme)
|
||||
return response
|
||||
end
|
||||
-- explicit authentication info overrides that given by the URL
|
||||
|
|
|
@ -31,8 +31,6 @@ void select_open(lua_State *L)
|
|||
{
|
||||
/* push select auxiliar lua function and register
|
||||
* select_lua_select with it as an upvalue */
|
||||
#ifdef LUASOCKET_DEBUG
|
||||
#endif
|
||||
luaL_loadfile(L, "lsselect.lua");
|
||||
lua_call(L, 0, 1);
|
||||
lua_pushcclosure(L, select_lua_select, 1);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/*=========================================================================*\
|
||||
* Internal function prototypes
|
||||
\*=========================================================================*/
|
||||
#ifdef _DEBUG
|
||||
#ifdef LUASOCKET_DEBUG
|
||||
static int tm_lua_time(lua_State *L);
|
||||
static int tm_lua_sleep(lua_State *L);
|
||||
#endif
|
||||
|
@ -123,7 +123,7 @@ int tm_gettime(void)
|
|||
void tm_open(lua_State *L)
|
||||
{
|
||||
(void) L;
|
||||
#ifdef _DEBUG
|
||||
#ifdef LUASOCKET_DEBUG
|
||||
lua_pushcfunction(L, tm_lua_time);
|
||||
priv_newglobal(L, "_time");
|
||||
lua_pushcfunction(L, tm_lua_sleep);
|
||||
|
@ -137,7 +137,7 @@ void tm_open(lua_State *L)
|
|||
/*-------------------------------------------------------------------------*\
|
||||
* Returns the time the system has been up, in secconds.
|
||||
\*-------------------------------------------------------------------------*/
|
||||
#ifdef _DEBUG
|
||||
#ifdef LUASOCKET_DEBUG
|
||||
static int tm_lua_time(lua_State *L)
|
||||
{
|
||||
lua_pushnumber(L, tm_gettime()/1000.0);
|
||||
|
|
|
@ -143,8 +143,8 @@ function Public.parse_path(path)
|
|||
for i = 1, table.getn(parsed) do
|
||||
parsed[i] = Code.unescape(parsed[i])
|
||||
end
|
||||
if stringsub(path, 1, 1) == "/" then parsed.is_absolute = 1 end
|
||||
if stringsub(path, -1, -1) == "/" then parsed.is_directory = 1 end
|
||||
if string.sub(path, 1, 1) == "/" then parsed.is_absolute = 1 end
|
||||
if string.sub(path, -1, -1) == "/" then parsed.is_directory = 1 end
|
||||
return parsed
|
||||
end
|
||||
|
||||
|
@ -214,7 +214,7 @@ end
|
|||
-- corresponding absolute path
|
||||
-----------------------------------------------------------------------------
|
||||
function Private.absolute_path(base_path, relative_path)
|
||||
if stringsub(relative_path, 1, 1) == "/" then return relative_path end
|
||||
if string.sub(relative_path, 1, 1) == "/" then return relative_path end
|
||||
local path = string.gsub(base_path, "[^/]*$", "")
|
||||
path = path .. relative_path
|
||||
path = string.gsub(path, "([^/]*%./)", function (s)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue