Almost done 2.0.1.

This commit is contained in:
Diego Nehab 2006-04-03 04:45:42 +00:00
parent e9d477aba3
commit 11282d17c8
14 changed files with 72 additions and 140 deletions

View File

@ -1,5 +1,5 @@
LuaSocket 2.0 license LuaSocket 2.0.1 license
Copyright © 2004-2005 Diego Nehab Copyright © 2004-2006 Diego Nehab
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"), copy of this software and associated documentation files (the "Software"),

67
NEW
View File

@ -1,54 +1,21 @@
What's New What's New
There is no big change for the 2.0 (final) release. It is This is just a bug-fix/update release.
basically a bug fix release. The main improvement is in the
non-blocking support.
* New: sample module dispatch.lua implements a coroutine * Updated: now using compat-5.1r5;
based dispatcher;
* New: sample check-links.lua works both in blocking and * Improved: http.request is more robust to malformed
non-blocking mode using coroutines (using the new URLs (Adrian Sietsma);
dispatcher);
* New: sample forward.lua implements a coroutine based * Improved: the simple http.request interface sends a
forward server (using the new dispatcher); "Content-type: application/x-www-form-urlencoded" header
* Improved: tcp:send(data, i, j) to return (i+sent-1). This
is great for non-blocking I/O, but might break some code;
* Improved: HTTP, SMTP, and FTP functions to accept a new
field create that overrides the function used to create
socket objects;
* Improved: smtp.message now supports multipart/alternative
(for the HTML messages we all love so much);
* Fixed: smtp.send was hanging on errors returned by LTN12
sources;
* Fixed: url.absolute() to work when base_url is in parsed
form;
* Fixed: http.request() not to redirect when the location
header is empty (naughty servers...);
* Fixed: tcp{client}:shutdown() to check for class instead
of group;
* Fixed: The manual to stop using socket.try() in place of
assert(), since it can't;
* Improved: Got rid of package.loaded.base = _G kludge;
* Fixed: Parts of the manual referred to require("http")
instead of require("socket.http");
* Improved: Socket and MIME binaries are called 'core' each
inside their directory (ex. "socket/core.dll"). The 'l'
prefix was just a bad idea;
* Improved: Using bundles in Mac OS X, instead of dylibs;
* Fixed: luasocket.h to export luaopen_socket_core;
* Fixed: udp:setpeername() so you can "disconnect" an UDP
socket;
* Fixed: A weird bug in HTTP support that caused some
requests to fail (Florian Berger);
* Fixed: Bug in socket.select() that caused sockets with
descriptor 0 to be ignored (Renato Maia);
* Fixed: "Bug" that caused dns.toip() to crash under uLinux
(William Trenker); (William Trenker);
* Fixed: "Bug" that caused gethostbyname to crash under VMS
(Renato Maia); * Improved: http.request is robust to evil servers that
* Fixed: tcp:send("") to return 0 bytes sent (Alexander send inappropriate 100-continue messages (David Burgess);
Marinov);
* Improved: socket.DEBUG and socket.VERSION became * Fixed: sample unix.c had fallen through the cracks
socket._DEBUGs and socket._VERSION for uniformity with other during development (Matthew Percival);
libraries;
* Improved: socket.select now works on empty sets on Windows. * Fixed: error code was not being propagated correctly
in ftp.lua (David Burgess).

2
README
View File

@ -1,4 +1,4 @@
This is the LuaSocket 2.0. It has been tested on WinXP, Mac OS X, This is the LuaSocket 2.0.1. It has been tested on WinXP, Mac OS X,
and Linux. Please use the Lua mailing list to report any bugs and Linux. Please use the Lua mailing list to report any bugs
(or "features") you encounter. (or "features") you encounter.

24
config
View File

@ -6,8 +6,8 @@
# Output file names # Output file names
# #
EXT=so EXT=so
SOCKET_V=2.0.0 SOCKET_V=2.0.1
MIME_V=1.0.0 MIME_V=1.0.1
SOCKET_SO=socket.$(EXT).$(SOCKET_V) SOCKET_SO=socket.$(EXT).$(SOCKET_V)
MIME_SO=mime.$(EXT).$(MIME_V) MIME_SO=mime.$(EXT).$(MIME_V)
UNIX_SO=unix.$(EXT) UNIX_SO=unix.$(EXT)
@ -37,20 +37,20 @@ INSTALL_EXEC=cp
# Compiler and linker settings # Compiler and linker settings
# for Mac OS X # for Mac OS X
# #
#CC=gcc CC=gcc
#DEF=-DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN DEF=-DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN
#CFLAGS= $(LUAINC) -I$(COMPAT) $(DEF) -pedantic -Wall -O2 -fno-common CFLAGS= $(LUAINC) -I$(COMPAT) $(DEF) -pedantic -Wall -O2 -fno-common
#LDFLAGS=-bundle -undefined dynamic_lookup LDFLAGS=-bundle -undefined dynamic_lookup
#LD=export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc LD=export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc
#------ #------
# Compiler and linker settings # Compiler and linker settings
# for Linux # for Linux
CC=gcc #CC=gcc
DEF=-DLUASOCKET_DEBUG #DEF=-DLUASOCKET_DEBUG
CFLAGS= $(LUAINC) -I$(COMPAT) $(DEF) -pedantic -Wall -O2 -fpic #CFLAGS= $(LUAINC) -I$(COMPAT) $(DEF) -pedantic -Wall -O2 -fpic
LDFLAGS=-O -shared #LDFLAGS=-O -shared
LD=gcc #LD=gcc
#------ #------
# End of makefile configuration # End of makefile configuration

View File

@ -188,7 +188,7 @@ function from automatically following 301 or 302 server redirect messages;
In case of failure, the function returns <tt><b>nil</b></tt> followed by an In case of failure, the function returns <tt><b>nil</b></tt> followed by an
error message. If successful, the simple form returns the response error message. If successful, the simple form returns the response
body as a string, followed by the response status code, the response body as a string, followed by the response status code, the response
headers and the response status line. The complex function returns the same headers and the response status line. The generic function returns the same
information, except the first return value is just the number 1 (the body information, except the first return value is just the number 1 (the body
goes to the <tt>sink</tt>). goes to the <tt>sink</tt>).
</p> </p>
@ -259,6 +259,14 @@ r, c, h = http.request {
-- } -- }
</pre> </pre>
<p class=note id=post>
Note: When sending a POST request, simple interface adds a
"<tt>Content-type: application/x-www-form-urlencoded</tt>"
header to the request. This is the type used by
HTML forms. If you need another type, use the generic
interface.
</p>
<p class=note id=authentication> <p class=note id=authentication>
Note: Some URLs are protected by their Note: Some URLs are protected by their
servers from anonymous download. For those URLs, the server must receive servers from anonymous download. For those URLs, the server must receive

View File

@ -78,7 +78,7 @@ LuaSocket.
</p> </p>
<p> <p>
Copyright &copy; 2004-2005 Diego Nehab. All rights reserved. <br> Copyright &copy; 2004-2006 Diego Nehab. All rights reserved. <br>
Author: <A href="http://www.cs.princeton.edu/~diego">Diego Nehab</a> Author: <A href="http://www.cs.princeton.edu/~diego">Diego Nehab</a>
</p> </p>
@ -87,7 +87,7 @@ Author: <A href="http://www.cs.princeton.edu/~diego">Diego Nehab</a>
<h2 id=download>Download</h2> <h2 id=download>Download</h2>
<p> <p>
LuaSocket version 2.0 (final) is now available for download! It is LuaSocket version 2.0.1 is now available for download! It is
compatible with Lua&nbsp;5.0 and has been tested on compatible with Lua&nbsp;5.0 and has been tested on
Windows&nbsp;XP, Linux, and Mac OS X. Windows&nbsp;XP, Linux, and Mac OS X.
</p> </p>
@ -159,65 +159,24 @@ has been helping a lot too! Thanks to you all!
<h2 id=new>What's New</h2> <h2 id=new>What's New</h2>
<p> <p>
There is no big change for the 2.0 (final) release. It is basically a This is just a bug-fix/update release.
bug fix release. The only improvement is in the non-blocking
support.
</p> </p>
<ul> <ul>
<li> New: sample module <tt>dispatch.lua</tt> implements a <li> Updated: now using <tt>compat-5.1r5</tt>;
coroutine based dispatcher; <li> Improved: <tt>http.request</tt> is more robust to
<li> New: sample <tt>check-links.lua</tt> works malformed URLs (Adrian Sietsma);
both in blocking and non-blocking mode using coroutines <li> Improved: the simple <tt>http.request</tt> interface sends a
(using the new dispatcher); "<tt>Content-type: application/x-www-form-urlencoded</tt>"
<li> New: sample <tt>forward.lua</tt> implements a coroutine header (William Trenker);
based forward server (using the new dispatcher); <li> Improved: <tt>http.request</tt> is robust to evil
<li> Improved: <tt>tcp:send(data, i, j)</tt> to return <tt>(i+sent-1)</tt>. This is great for non-blocking I/O, but might break some code; servers that send inappropriate 100-continue messages
<li> Improved: HTTP, SMTP, and FTP functions to accept a new field (David Burgess);
<tt>create</tt> that overrides the function used to create socket objects; <li> Fixed: sample <tt>unix.c</tt> had fallen through the
<li> Improved: <tt>smtp.message</tt> now supports multipart/alternative cracks during development (Matthew Percival);
(for the HTML messages we all love so much); <li> Fixed: error code was not being propagated correctly in
<li> Fixed: <tt>smtp.send</tt> was hanging on errors returned by LTN12 sources; ftp.lua (David Burgess).
<li> Fixed: <tt>url.absolute()</tt> to work when <tt>base_url</tt> is in <li>
parsed form;
<li> Fixed: <tt>http.request()</tt> not to redirect when the location
header is empty (naughty servers...);
<li> Fixed: <tt>tcp{client}:shutdown()</tt> to check for class instead of
group;
<li> Fixed: The manual to stop using <tt>socket.try()</tt> in place of
<tt>assert()</tt>, since it can't;
<li> Improved: Got rid of <tt>package.loaded.base = _G</tt> kludge;
<li> Fixed: Parts of the manual referred to <tt>require("http")</tt> instead of
<tt>require("socket.http")</tt>;
<li> Improved: Socket and MIME binaries are called 'core' each inside their
directory (ex. "socket/core.dll"). The 'l' prefix was just a bad idea;
<li> Improved: Using bundles in Mac OS X, instead of dylibs;
<li> Fixed: <tt>luasocket.h</tt> to export <tt>luaopen_socket_core</tt>;
<li> Fixed: <tt>udp:setpeername()</tt> so you can "disconnect" an
<tt>UDP</tt> socket;
<li> Fixed: A weird bug in HTTP support that caused some requests to
fail (Florian Berger);
<li> Fixed: Bug in <tt>socket.select()</tt> that caused sockets
with descriptor 0 to be ignored (Renato Maia);
<li> Fixed: "Bug" that caused <tt>dns.toip()</tt> to crash under uLinux
(William Trenker);
<li> Fixed: "Bug" that caused <tt>gethostbyname</tt> to crash under VMS
(Renato Maia);
<li> Fixed: <tt>tcp:send("")</tt> to return 0 bytes sent (Alexander Marinov);
<li> Improved: <tt>socket.DEBUG</tt> and <tt>socket.VERSION</tt> became <tt>socket._DEBUGs</tt> and <tt>socket._VERSION</tt> for uniformity with other libraries;
<li> Improved: <tt>socket.select</tt> now works on empty sets on Windows.
</ul>
<!-- incompatible +++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<h3 id=incompatible>Incompatibilities with previous versions</h3>
<ul>
<li> If you use the return value of <tt>tcp:send()</tt> <em>and</em> you
use the extra parameters to select only part of the string to be sent, your
code is now broken, but when you fix it, it will be much simpler;
<li> If you check <tt>socket.DEBUG</tt> or <tt>socket.VERSION</tt>,
change it to <tt>socket._DEBUG</tt> or <tt>socket._VERSION</tt>.
</ul> </ul>
<!-- old ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> <!-- old ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->

View File

@ -39,7 +39,7 @@ Installation">
<h2>Installation</h2> <h2>Installation</h2>
<p> LuaSocket 2.0 uses the new package proposal for Lua 5.1. <p> LuaSocket 2.0.1 uses the new package proposal for Lua 5.1.
All Lua library developers are encouraged to update their libraries so that All Lua library developers are encouraged to update their libraries so that
all libraries can coexist peacefully and users can benefit from the all libraries can coexist peacefully and users can benefit from the
standardization and flexibility of the standard. standardization and flexibility of the standard.
@ -123,7 +123,7 @@ it should be easy to use LuaSocket. Just fire the interpreter and use the
Lua 5.0.2 Copyright (C) 1994-2004 Tecgraf, PUC-Rio Lua 5.0.2 Copyright (C) 1994-2004 Tecgraf, PUC-Rio
&gt; socket = require("socket") &gt; socket = require("socket")
&gt; print(socket._VERSION) &gt; print(socket._VERSION)
--&gt; LuaSocket 2.0 --&gt; LuaSocket 2.0.1
</pre> </pre>
<p> Each module loads their dependencies automatically, so you only need to <p> Each module loads their dependencies automatically, so you only need to

View File

@ -1,9 +1,9 @@
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Distribution makefile # Distribution makefile
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
DIST = luasocket-2.0 DIST = luasocket-2.0.1
COMPAT = src/compat-5.1r4 COMPAT = src/compat-5.1r5
TEST = \ TEST = \
test/README \ test/README \

View File

@ -20,6 +20,7 @@ pump = {}
-- 2048 seems to be better in windows... -- 2048 seems to be better in windows...
BLOCKSIZE = 2048 BLOCKSIZE = 2048
_VERSION = "LTN12 1.0.1"
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- Filter stuff -- Filter stuff

View File

@ -13,8 +13,8 @@
/*-------------------------------------------------------------------------*\ /*-------------------------------------------------------------------------*\
* Current socket library version * Current socket library version
\*-------------------------------------------------------------------------*/ \*-------------------------------------------------------------------------*/
#define LUASOCKET_VERSION "LuaSocket 2.0" #define LUASOCKET_VERSION "LuaSocket 2.0.1"
#define LUASOCKET_COPYRIGHT "Copyright (C) 2004-2005 Diego Nehab" #define LUASOCKET_COPYRIGHT "Copyright (C) 2004-2006 Diego Nehab"
#define LUASOCKET_AUTHORS "Diego Nehab" #define LUASOCKET_AUTHORS "Diego Nehab"
/*-------------------------------------------------------------------------*\ /*-------------------------------------------------------------------------*\

View File

@ -15,8 +15,8 @@
/*-------------------------------------------------------------------------*\ /*-------------------------------------------------------------------------*\
* Current MIME library version * Current MIME library version
\*-------------------------------------------------------------------------*/ \*-------------------------------------------------------------------------*/
#define MIME_VERSION "MIME 1.0" #define MIME_VERSION "MIME 1.0.1"
#define MIME_COPYRIGHT "Copyright (C) 2004-2005 Diego Nehab" #define MIME_COPYRIGHT "Copyright (C) 2004-2006 Diego Nehab"
#define MIME_AUTHORS "Diego Nehab" #define MIME_AUTHORS "Diego Nehab"
/*-------------------------------------------------------------------------*\ /*-------------------------------------------------------------------------*\

View File

@ -16,7 +16,7 @@ module("socket.url")
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- Module version -- Module version
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
_VERSION = "URL 1.0" _VERSION = "URL 1.0.1"
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- Encodes a string into its escaped hexadecimal representation -- Encodes a string into its escaped hexadecimal representation

View File

@ -1,4 +0,0 @@
AuthName "Test Realm"
AuthType Basic
AuthUserFile /home/diego/tec/luasocket/test/auth/.htpasswd
require valid-user

View File

@ -23,7 +23,8 @@ http.TIMEOUT = 10
local t = socket.gettime() local t = socket.gettime()
--host = host or "diego.student.princeton.edu" --host = host or "diego.student.princeton.edu"
host = host or "dell-diego" --host = host or "diego.student.princeton.edu"
host = host or "localhost"
proxy = proxy or "http://localhost:3128" proxy = proxy or "http://localhost:3128"
prefix = prefix or "/luasocket-test" prefix = prefix or "/luasocket-test"
cgiprefix = cgiprefix or "/luasocket-test-cgi" cgiprefix = cgiprefix or "/luasocket-test-cgi"