2 Commits

Author SHA1 Message Date
5c4fc93d5f Merge branch 'master' into hjelmeland-patch-1 2023-11-10 09:12:04 +03:00
ccef3bc4e2 Changed return text for ETIMEDOUT/ WSAETIMEDOUT
Changed return text for ETIMEDOUT/ WSAETIMEDOUT to “connection timeout”.

This is needed for the application to be able tell to the difference between timeout of TCP connection (ETIMEDOUT/ WSAETIMEDOUT) and a normal return from a non-blocking socket (error codes EAGAIN/WSAEWOULDBLOCK). Both situations returned the text “timeout”.
2015-09-03 15:24:22 +02:00
13 changed files with 91 additions and 93 deletions

View File

@ -89,7 +89,7 @@ it should be easy to use LuaSocket. Just fire the interpreter and use the
Lua 5.2.2 Copyright (C) 1994-2013 Lua.org, PUC-Rio
> socket = require("socket")
> print(socket._VERSION)
--> LuaSocket 3.1.0
--> LuaSocket 3.0.0
</pre>
<p> Each module loads their dependencies automatically, so you only need to

View File

@ -69,7 +69,6 @@ local function make_plat(plat)
["socket.smtp"] = "src/smtp.lua",
ltn12 = "src/ltn12.lua",
socket = "src/socket.lua",
mbox = "src/mbox.lua",
mime = "src/mime.lua"
}
if plat == "unix"

View File

@ -1,7 +1,7 @@
#--------------------------------------------------------------------------
# Distribution makefile
#--------------------------------------------------------------------------
DIST = luasocket-3.1.0
DIST = luasocket-3.0.0
TEST = \
test/README \

View File

@ -62,7 +62,7 @@ local function receiveheaders(sock, headers)
-- unfold any folded values
while string.find(line, "^%s") do
value = value .. line
line, err = sock:receive()
line = sock:receive()
if err then return nil, err end
end
-- save pair in table

View File

@ -290,7 +290,7 @@ int inet_meth_getsockname(lua_State *L, p_socket ps, int family)
return 2;
}
lua_pushstring(L, name);
lua_pushinteger(L, (int) strtol(port, (char **) NULL, 10));
lua_pushstring(L, port);
switch (family) {
case AF_INET: lua_pushliteral(L, "inet"); break;
case AF_INET6: lua_pushliteral(L, "inet6"); break;

View File

@ -10,7 +10,7 @@
/*-------------------------------------------------------------------------* \
* Current socket library version
\*-------------------------------------------------------------------------*/
#define LUASOCKET_VERSION "LuaSocket 3.1.0"
#define LUASOCKET_VERSION "LuaSocket 3.0.0"
#define LUASOCKET_COPYRIGHT "Copyright (C) 1999-2013 Diego Nehab"
/*-------------------------------------------------------------------------*\

View File

@ -272,7 +272,7 @@ SOCKET_win64=wsocket.obj
#
SO=$(SO_$(PLAT))
O=$(O_$(PLAT))
SOCKET_V=3.1.0
SOCKET_V=3.0.0
MIME_V=1.0.3
SOCKET_SO=socket-$(SOCKET_V).$(SO)
MIME_SO=mime-$(MIME_V).$(SO)

View File

@ -12,7 +12,7 @@
#define PIE_CONNREFUSED "connection refused"
#define PIE_CONNABORTED "closed"
#define PIE_CONNRESET "closed"
#define PIE_TIMEDOUT "timeout"
#define PIE_TIMEDOUT "connection timeout"
#define PIE_AGAIN "temporary failure in name resolution"
#define PIE_BADFLAGS "invalid value for ai_flags"
#define PIE_BADHINTS "invalid value for hints"

View File

@ -152,7 +152,7 @@ function _M.parse(url, default)
url = string.gsub(url, "^([%w][%w%+%-%.]*)%:",
function(s) parsed.scheme = s; return "" end)
-- get authority
url = string.gsub(url, "^//([^/%?#]*)", function(n)
url = string.gsub(url, "^//([^/]*)", function(n)
parsed.authority = n
return ""
end)

View File

@ -262,7 +262,6 @@ int socket_recv(p_socket ps, char *data, size_t count, size_t *got,
if (err != WSAEWOULDBLOCK) {
if (err != WSAECONNRESET || prev == WSAECONNRESET) return err;
prev = err;
continue;
}
if ((err = socket_waitfd(ps, WAITFD_R, tm)) != IO_DONE) return err;
}
@ -292,7 +291,6 @@ int socket_recvfrom(p_socket ps, char *data, size_t count, size_t *got,
if (err != WSAEWOULDBLOCK) {
if (err != WSAECONNRESET || prev == WSAECONNRESET) return err;
prev = err;
continue;
}
if ((err = socket_waitfd(ps, WAITFD_R, tm)) != IO_DONE) return err;
}

View File

@ -11,6 +11,7 @@
#include <winsock2.h>
#include <ws2tcpip.h>
typedef int socklen_t;
typedef SOCKADDR_STORAGE t_sockaddr_storage;
typedef SOCKET t_socket;
typedef t_socket *p_socket;