diff options
| author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2002-12-03 07:20:34 +0000 |
|---|---|---|
| committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2002-12-03 07:20:34 +0000 |
| commit | 7da19138e37c4e0123860f1fecbceb80c3d2627d (patch) | |
| tree | 8453f003a9ba212807d9c9590c2f2b850d323f0f /src | |
| parent | d7e80592a69c076991ed4f4cc15d5390e14d1f0b (diff) | |
| download | luasocket-7da19138e37c4e0123860f1fecbceb80c3d2627d.tar.gz luasocket-7da19138e37c4e0123860f1fecbceb80c3d2627d.tar.bz2 luasocket-7da19138e37c4e0123860f1fecbceb80c3d2627d.zip | |
Faltam testes de ftp e smtp. O resto passa.
Diffstat (limited to 'src')
| -rw-r--r-- | src/buffer.c | 4 | ||||
| -rw-r--r-- | src/http.lua | 6 | ||||
| -rw-r--r-- | src/select.c | 2 | ||||
| -rw-r--r-- | src/timeout.c | 6 | ||||
| -rw-r--r-- | src/url.lua | 6 |
5 files changed, 11 insertions, 13 deletions
diff --git a/src/buffer.c b/src/buffer.c index a9a9782..4260f20 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -74,7 +74,7 @@ int buf_send(lua_State *L, p_buf buf) | |||
| 74 | } | 74 | } |
| 75 | priv_pusherror(L, err); | 75 | priv_pusherror(L, err); |
| 76 | lua_pushnumber(L, total); | 76 | lua_pushnumber(L, total); |
| 77 | #ifdef _DEBUG | 77 | #ifdef LUASOCKET_DEBUG |
| 78 | /* push time elapsed during operation as the last return value */ | 78 | /* push time elapsed during operation as the last return value */ |
| 79 | lua_pushnumber(L, tm_getelapsed(&base->base_tm)/1000.0); | 79 | lua_pushnumber(L, tm_getelapsed(&base->base_tm)/1000.0); |
| 80 | #endif | 80 | #endif |
| @@ -139,7 +139,7 @@ int buf_receive(lua_State *L, p_buf buf) | |||
| 139 | for ( ; arg <= top; arg++) lua_pushnil(L); | 139 | for ( ; arg <= top; arg++) lua_pushnil(L); |
| 140 | /* last return is an error code */ | 140 | /* last return is an error code */ |
| 141 | priv_pusherror(L, err); | 141 | priv_pusherror(L, err); |
| 142 | #ifdef _DEBUG | 142 | #ifdef LUASOCKET_DEBUG |
| 143 | /* push time elapsed during operation as the last return value */ | 143 | /* push time elapsed during operation as the last return value */ |
| 144 | lua_pushnumber(L, tm_getelapsed(&base->base_tm)/1000.0); | 144 | lua_pushnumber(L, tm_getelapsed(&base->base_tm)/1000.0); |
| 145 | #endif | 145 | #endif |
diff --git a/src/http.lua b/src/http.lua index dce3ac8..9543d59 100644 --- a/src/http.lua +++ b/src/http.lua | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | ----------------------------------------------------------------------------- | 8 | ----------------------------------------------------------------------------- |
| 9 | 9 | ||
| 10 | local Public, Private = {}, {} | 10 | local Public, Private = {}, {} |
| 11 | HTTP = Public | 11 | http = Public |
| 12 | 12 | ||
| 13 | ----------------------------------------------------------------------------- | 13 | ----------------------------------------------------------------------------- |
| 14 | -- Program constants | 14 | -- Program constants |
| @@ -195,7 +195,7 @@ end | |||
| 195 | function Private.receivebody_bylength(sock, length, receive_cb) | 195 | function Private.receivebody_bylength(sock, length, receive_cb) |
| 196 | local uerr, go | 196 | local uerr, go |
| 197 | while length > 0 do | 197 | while length > 0 do |
| 198 | local size = min(Public.BLOCKSIZE, length) | 198 | local size = math.min(Public.BLOCKSIZE, length) |
| 199 | local chunk, err = sock:receive(size) | 199 | local chunk, err = sock:receive(size) |
| 200 | if err then | 200 | if err then |
| 201 | go, uerr = receive_cb(nil, err) | 201 | go, uerr = receive_cb(nil, err) |
| @@ -542,7 +542,7 @@ function Public.request_cb(request, response) | |||
| 542 | scheme = "http" | 542 | scheme = "http" |
| 543 | }) | 543 | }) |
| 544 | if parsed.scheme ~= "http" then | 544 | if parsed.scheme ~= "http" then |
| 545 | response.error = format("unknown scheme '%s'", parsed.scheme) | 545 | response.error = string.format("unknown scheme '%s'", parsed.scheme) |
| 546 | return response | 546 | return response |
| 547 | end | 547 | end |
| 548 | -- explicit authentication info overrides that given by the URL | 548 | -- explicit authentication info overrides that given by the URL |
diff --git a/src/select.c b/src/select.c index 1aaa7fe..5c08730 100644 --- a/src/select.c +++ b/src/select.c | |||
| @@ -31,8 +31,6 @@ void select_open(lua_State *L) | |||
| 31 | { | 31 | { |
| 32 | /* push select auxiliar lua function and register | 32 | /* push select auxiliar lua function and register |
| 33 | * select_lua_select with it as an upvalue */ | 33 | * select_lua_select with it as an upvalue */ |
| 34 | #ifdef LUASOCKET_DEBUG | ||
| 35 | #endif | ||
| 36 | luaL_loadfile(L, "lsselect.lua"); | 34 | luaL_loadfile(L, "lsselect.lua"); |
| 37 | lua_call(L, 0, 1); | 35 | lua_call(L, 0, 1); |
| 38 | lua_pushcclosure(L, select_lua_select, 1); | 36 | lua_pushcclosure(L, select_lua_select, 1); |
diff --git a/src/timeout.c b/src/timeout.c index fdbc47a..940ddca 100644 --- a/src/timeout.c +++ b/src/timeout.c | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | /*=========================================================================*\ | 20 | /*=========================================================================*\ |
| 21 | * Internal function prototypes | 21 | * Internal function prototypes |
| 22 | \*=========================================================================*/ | 22 | \*=========================================================================*/ |
| 23 | #ifdef _DEBUG | 23 | #ifdef LUASOCKET_DEBUG |
| 24 | static int tm_lua_time(lua_State *L); | 24 | static int tm_lua_time(lua_State *L); |
| 25 | static int tm_lua_sleep(lua_State *L); | 25 | static int tm_lua_sleep(lua_State *L); |
| 26 | #endif | 26 | #endif |
| @@ -123,7 +123,7 @@ int tm_gettime(void) | |||
| 123 | void tm_open(lua_State *L) | 123 | void tm_open(lua_State *L) |
| 124 | { | 124 | { |
| 125 | (void) L; | 125 | (void) L; |
| 126 | #ifdef _DEBUG | 126 | #ifdef LUASOCKET_DEBUG |
| 127 | lua_pushcfunction(L, tm_lua_time); | 127 | lua_pushcfunction(L, tm_lua_time); |
| 128 | priv_newglobal(L, "_time"); | 128 | priv_newglobal(L, "_time"); |
| 129 | lua_pushcfunction(L, tm_lua_sleep); | 129 | lua_pushcfunction(L, tm_lua_sleep); |
| @@ -137,7 +137,7 @@ void tm_open(lua_State *L) | |||
| 137 | /*-------------------------------------------------------------------------*\ | 137 | /*-------------------------------------------------------------------------*\ |
| 138 | * Returns the time the system has been up, in secconds. | 138 | * Returns the time the system has been up, in secconds. |
| 139 | \*-------------------------------------------------------------------------*/ | 139 | \*-------------------------------------------------------------------------*/ |
| 140 | #ifdef _DEBUG | 140 | #ifdef LUASOCKET_DEBUG |
| 141 | static int tm_lua_time(lua_State *L) | 141 | static int tm_lua_time(lua_State *L) |
| 142 | { | 142 | { |
| 143 | lua_pushnumber(L, tm_gettime()/1000.0); | 143 | lua_pushnumber(L, tm_gettime()/1000.0); |
diff --git a/src/url.lua b/src/url.lua index 0ecec3c..4d2bfa7 100644 --- a/src/url.lua +++ b/src/url.lua | |||
| @@ -143,8 +143,8 @@ function Public.parse_path(path) | |||
| 143 | for i = 1, table.getn(parsed) do | 143 | for i = 1, table.getn(parsed) do |
| 144 | parsed[i] = Code.unescape(parsed[i]) | 144 | parsed[i] = Code.unescape(parsed[i]) |
| 145 | end | 145 | end |
| 146 | if stringsub(path, 1, 1) == "/" then parsed.is_absolute = 1 end | 146 | if string.sub(path, 1, 1) == "/" then parsed.is_absolute = 1 end |
| 147 | if stringsub(path, -1, -1) == "/" then parsed.is_directory = 1 end | 147 | if string.sub(path, -1, -1) == "/" then parsed.is_directory = 1 end |
| 148 | return parsed | 148 | return parsed |
| 149 | end | 149 | end |
| 150 | 150 | ||
| @@ -214,7 +214,7 @@ end | |||
| 214 | -- corresponding absolute path | 214 | -- corresponding absolute path |
| 215 | ----------------------------------------------------------------------------- | 215 | ----------------------------------------------------------------------------- |
| 216 | function Private.absolute_path(base_path, relative_path) | 216 | function Private.absolute_path(base_path, relative_path) |
| 217 | if stringsub(relative_path, 1, 1) == "/" then return relative_path end | 217 | if string.sub(relative_path, 1, 1) == "/" then return relative_path end |
| 218 | local path = string.gsub(base_path, "[^/]*$", "") | 218 | local path = string.gsub(base_path, "[^/]*$", "") |
| 219 | path = path .. relative_path | 219 | path = path .. relative_path |
| 220 | path = string.gsub(path, "([^/]*%./)", function (s) | 220 | path = string.gsub(path, "([^/]*%./)", function (s) |
