diff --git a/FIX b/FIX index a811ec0..0ec76a1 100644 --- a/FIX +++ b/FIX @@ -1,13 +1,16 @@ url.absolute was not working when base_url was already parsed -http.request was redirecting even when the location header is empty +http.request was redirecting even when the location header was empty tcp{client}:shutdown() was checking for group instead of class. tcp{client}:send() now returns i+sent-1... -get rid of a = socket.try() in the manual, except for protected cases. - replace it with assert. -get rid of "base." kludge +get rid of a = socket.try() in the manual, except for protected cases. replace it with assert. +get rid of "base." kludge in package.loaded check all "require("http")" etc in the manual. make sure sock_gethostname.* only return success if the hp is not null! -change 'l' prefix in C libraries to 'c' +change 'l' prefix in C libraries to 'c' to avoid clash with LHF libraries don't forget the declarations in luasocket.h and mime.h!!! setpeername was using udp{unconnected} -fixed a bug in http.lua that caused some requests to fail +fixed a bug in http.lua that caused some requests to fail (Florian Berger) +fixed a bug in select.c that prevented sockets with descriptor 0 from working (Renato Maia) +fixed a "bug" that caused dns.toip to crash under uLinux +fixed a "bug" that caused a crash in gethostbyname under VMS +DEBUG and VERSION became _DEBUG and _VERSION diff --git a/TODO b/TODO index 460165f..8749ea8 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,3 @@ - talk about the non-blocking connect in the manual test it on Windows!!! @@ -13,7 +12,6 @@ functions for non-blocking so they can be used in the context of the dispatcher! adjust manual for new sock:send returns. -_VERSION, _DEBUG, etc. leave code for losers that don't have nanosleep @@ -42,3 +40,4 @@ testar os options! eliminate globals from namespaces created by module(). * BUG NO SET DO TINYIRC!!! SINISTRO. +* _VERSION, _DEBUG, etc. diff --git a/doc/index.html b/doc/index.html index cfd3548..ee97e02 100644 --- a/doc/index.html +++ b/doc/index.html @@ -93,38 +93,24 @@ Windows XP, Linux, and Mac OS X.

-The library can be downloaded in source code from the following links: -

- -
-

-luasocket-2.0.tar.gz
-luasocket-2.0.zip -

-
- -

+The library can be downloaded in source code from the +LuaSocket +project page at LuaForge. Besides the full C and Lua source code for the library, the distribution contains several examples, this user's manual and basic test procedures.

-I am also providing PC Win32 binaries for those that want to give -LuaSocket a try (those on Unix or Mac OS X can just type make). -These are compatible with the +Danilo Tuler is mantaining Win32 binaries for LuaSocket, which are also +available from LuaForge. These are compatible with the LuaBinaries available from LuaForge.

-

-luasocket-2.0-win32.zip -

-
- -

-The quick and dirty way to use these binaries is to unpack everything into -a directory, say c:\luasocket, then set LUA_INIT to load +For those that want to give LuaSocket a quick try, download the +stand-alone archive and unpack everything into +a directory, say c:\luasocket. Then set LUA_INIT to load the compat-5.1.lua and set LUA_PATH and LUA_CPATH to look for files in the current directory:

@@ -142,10 +128,10 @@ do the following:

-c:\luasocket\> lua
+c:\luasocket\> lua50
 Lua 5.0.2  Copyright (C) 1994-2004 Tecgraf, PUC-Rio
 > http = require"socket.http"
-> print(http.request"http://www.tecgraf.puc-rio.br/luasocket/")
+> print(http.request"http://www.cs.princeton.edu/~diego/professional/luasocket/")
 --> the source to this web page gets dumped to terminal
 
@@ -173,31 +159,39 @@ has been helping a lot too! Thanks to you all!

What's New

-The big change for the 2.0 (beta3) release was the adoption of the Lua 5.1 -package proposal. Naturally, there were a few bug fixes (a beta is a -beta, is a beta). +There is no big change for the 2.0 (final) release. It is basically a +bug fix release. The only improvement is in the non-blocking +support.

@@ -205,9 +199,11 @@ beta, is a beta).

Incompatibilities with previous versions

diff --git a/doc/reference.html b/doc/reference.html index b2e31d5..fd5140b 100644 --- a/doc/reference.html +++ b/doc/reference.html @@ -142,7 +142,7 @@ Support, Manual">
Socket
-DEBUG, +_DEBUG, dns, gettime, newtry, @@ -155,7 +155,7 @@ Support, Manual"> tcp, try, udp, -VERSION. +_VERSION.
diff --git a/doc/socket.html b/doc/socket.html index 18c71d1..5cc7157 100644 --- a/doc/socket.html +++ b/doc/socket.html @@ -85,8 +85,8 @@ the user can also specify the local address and port to bind -

-socket.DEBUG +

+socket._DEBUG

@@ -372,8 +372,8 @@ c = socket.try(socket.connect("localhost", 80)) -

-socket.VERSION +

+socket._VERSION

diff --git a/etc/dict.lua b/etc/dict.lua index a52b977..76b254a 100644 --- a/etc/dict.lua +++ b/etc/dict.lua @@ -8,7 +8,7 @@ ----------------------------------------------------------------------------- -- Load required modules ----------------------------------------------------------------------------- -local base = require("base") +local base = _G local string = require("string") local table = require("table") local socket = require("socket") diff --git a/etc/lp.lua b/etc/lp.lua index 7637d16..2ba7954 100644 --- a/etc/lp.lua +++ b/etc/lp.lua @@ -10,7 +10,7 @@ ]] -- make sure LuaSocket is loaded local io = require("io") -local base = require("base") +local base = _G local string = require("string") local socket = require("socket") local ltn12 = require("ltn12") diff --git a/etc/tftp.lua b/etc/tftp.lua index ba21a43..60658f7 100644 --- a/etc/tftp.lua +++ b/etc/tftp.lua @@ -8,7 +8,7 @@ ----------------------------------------------------------------------------- -- Load required files ----------------------------------------------------------------------------- -local base = require("base") +local base = _G local table = require("table") local math = require("math") local string = require("string") diff --git a/src/ftp.lua b/src/ftp.lua index a793298..841df5f 100644 --- a/src/ftp.lua +++ b/src/ftp.lua @@ -8,7 +8,7 @@ ----------------------------------------------------------------------------- -- Declare module and import dependencies ----------------------------------------------------------------------------- -local base = require("base") +local base = _G local table = require("table") local string = require("string") local math = require("math") diff --git a/src/http.lua b/src/http.lua index 669f54d..1a7b101 100644 --- a/src/http.lua +++ b/src/http.lua @@ -13,7 +13,7 @@ local url = require("socket.url") local ltn12 = require("ltn12") local mime = require("mime") local string = require("string") -local base = require("base") +local base = _G local table = require("table") module("socket.http") @@ -25,7 +25,7 @@ TIMEOUT = 60 -- default port for document retrieval PORT = 80 -- user agent field sent in request -USERAGENT = socket.VERSION +USERAGENT = socket._VERSION ----------------------------------------------------------------------------- -- Extra sources and sinks diff --git a/src/inet.c b/src/inet.c index d713643..d102060 100644 --- a/src/inet.c +++ b/src/inet.c @@ -172,21 +172,25 @@ static void inet_pushresolved(lua_State *L, struct hostent *hp) i = 1; alias = hp->h_aliases; lua_newtable(L); - while (*alias) { - lua_pushnumber(L, i); - lua_pushstring(L, *alias); - lua_settable(L, -3); - i++; alias++; + if (alias) { + while (*alias) { + lua_pushnumber(L, i); + lua_pushstring(L, *alias); + lua_settable(L, -3); + i++; alias++; + } } lua_settable(L, resolved); i = 1; lua_newtable(L); addr = (struct in_addr **) hp->h_addr_list; - while (*addr) { - lua_pushnumber(L, i); - lua_pushstring(L, inet_ntoa(**addr)); - lua_settable(L, -3); - i++; addr++; + if (addr) { + while (*addr) { + lua_pushnumber(L, i); + lua_pushstring(L, inet_ntoa(**addr)); + lua_settable(L, -3); + i++; addr++; + } } lua_settable(L, resolved); } diff --git a/src/ltn12.lua b/src/ltn12.lua index 1acb9b1..fbc9dce 100644 --- a/src/ltn12.lua +++ b/src/ltn12.lua @@ -10,7 +10,7 @@ ----------------------------------------------------------------------------- local string = require("string") local table = require("table") -local base = require("base") +local base = _G module("ltn12") filter = {} diff --git a/src/luasocket.c b/src/luasocket.c index 8f13dbc..2c3b526 100644 --- a/src/luasocket.c +++ b/src/luasocket.c @@ -89,12 +89,12 @@ static int base_open(lua_State *L) { /* export functions (and leave namespace table on top of stack) */ luaL_openlib(L, "socket", func, 0); #ifdef LUASOCKET_DEBUG - lua_pushstring(L, "DEBUG"); + lua_pushstring(L, "_DEBUG"); lua_pushboolean(L, 1); lua_rawset(L, -3); #endif /* make version string available to scripts */ - lua_pushstring(L, "VERSION"); + lua_pushstring(L, "_VERSION"); lua_pushstring(L, LUASOCKET_VERSION); lua_rawset(L, -3); return 1; diff --git a/src/mime.lua b/src/mime.lua index 6ef82b8..f6509a0 100644 --- a/src/mime.lua +++ b/src/mime.lua @@ -8,8 +8,7 @@ ----------------------------------------------------------------------------- -- Declare module and import dependencies ----------------------------------------------------------------------------- -package.loaded.base = _G -local base = require("base") +local base = _G local ltn12 = require("ltn12") local mime = require("cmime") module("mime") diff --git a/src/smtp.lua b/src/smtp.lua index 944a40f..6850f7f 100644 --- a/src/smtp.lua +++ b/src/smtp.lua @@ -8,7 +8,7 @@ ----------------------------------------------------------------------------- -- Declare module and import dependencies ----------------------------------------------------------------------------- -local base = require("base") +local base = _G local coroutine = require("coroutine") local string = require("string") local math = require("math") @@ -216,7 +216,7 @@ local function adjust_headers(mesgt) end lower["date"] = lower["date"] or os.date("!%a, %d %b %Y %H:%M:%S ") .. (mesgt.zone or ZONE) - lower["x-mailer"] = lower["x-mailer"] or socket.VERSION + lower["x-mailer"] = lower["x-mailer"] or socket._VERSION -- this can't be overriden lower["mime-version"] = "1.0" mesgt.headers = lower diff --git a/src/socket.lua b/src/socket.lua index 9a523fe..d1c7846 100644 --- a/src/socket.lua +++ b/src/socket.lua @@ -7,8 +7,7 @@ ----------------------------------------------------------------------------- -- Declare module and import dependencies ----------------------------------------------------------------------------- -package.loaded.base = _G -local base = require("base") +local base = _G local string = require("string") local math = require("math") local socket = require("csocket") diff --git a/src/tp.lua b/src/tp.lua index 1adc656..c51d123 100644 --- a/src/tp.lua +++ b/src/tp.lua @@ -8,7 +8,7 @@ ----------------------------------------------------------------------------- -- Declare module and import dependencies ----------------------------------------------------------------------------- -local base = require("base") +local base = _G local string = require("string") local socket = require("socket") local ltn12 = require("ltn12") diff --git a/src/url.lua b/src/url.lua index f29ecc8..0db111b 100644 --- a/src/url.lua +++ b/src/url.lua @@ -9,7 +9,7 @@ -- Declare module ----------------------------------------------------------------------------- local string = require("string") -local base = require("base") +local base = _G local table = require("table") module("socket.url") diff --git a/test/testclnt.lua b/test/testclnt.lua index e3f2b94..83f925b 100644 --- a/test/testclnt.lua +++ b/test/testclnt.lua @@ -69,7 +69,7 @@ function check_timeout(tm, sl, elapsed, err, opp, mode, alldone) end end -if not socket.DEBUG then +if not socket._DEBUG then fail("Please define LUASOCKET_DEBUG and recompile LuaSocket") end