aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Nehab <diego.nehab@gmail.com>2012-04-17 01:15:26 +0800
committerDiego Nehab <diego.nehab@gmail.com>2012-04-17 01:15:26 +0800
commitf37e0260261f7691246429d227cf7124c291e8b1 (patch)
tree7e84322c8852d4227e36958af1132a4588f64795
parentb3c4f46179ed5b27ca76a824f8730fa50dbaae0b (diff)
downloadluasocket-f37e0260261f7691246429d227cf7124c291e8b1.tar.gz
luasocket-f37e0260261f7691246429d227cf7124c291e8b1.tar.bz2
luasocket-f37e0260261f7691246429d227cf7124c291e8b1.zip
First stab at documenation
Update Lua and Luasocket version in samples and in documentation Documented ipv5_v6only default option being set Documented tcp6 and udp6 Documented dns.getaddrinfo Documented zero-sized datagram change? Documented getoption
-rw-r--r--TODO79
-rw-r--r--doc/dns.html61
-rw-r--r--doc/http.html8
-rw-r--r--doc/index.html80
-rw-r--r--doc/installation.html78
-rw-r--r--doc/reference.html8
-rw-r--r--doc/tcp.html85
-rw-r--r--doc/udp.html143
-rw-r--r--doc/url.html12
-rw-r--r--makefile.dist2
-rw-r--r--src/luasocket.h4
-rw-r--r--src/mime.h4
12 files changed, 367 insertions, 197 deletions
diff --git a/TODO b/TODO
index 7ceced3..fbd5865 100644
--- a/TODO
+++ b/TODO
@@ -1,38 +1,47 @@
1 - merge luaL_typeerror into auxiliar to avoid using luaL prefix? 1- merge luaL_typeerror into auxiliar to avoid using luaL prefix?
2 - document ipv5_v6only default option being set? 2- getsockname should also support IPv6, no?
3 - document bind and connect behavior based on address? 3- remove RCSID from files?
4 - document tcp6 and udp6 4- shouldn't we instead make the code compatible to Lua 5.2
5 - document dns.getaddrinfo 5 without any compat stuff, and use a compatibility layer to
6 - check getaddrinfo's output format 6 make it work on 5.1?
7 - add functionality to query if object is ipv4 or 6? 7- why 2.1.1 rather than 2.1?
8 - normalize error messages to have all first capitals or not? 8- add what's new to manual
9 - what is this lua_Reg vs lua_reg business? 9- should there be an equivalent to tohostname for IPv6?
10 what is this putchar vs addchar business? 10- should we add service name resolution as well to
11 is this the compat-5.2 stuff? 11 getaddrinfo?
12 - why 2.1.1 rather than 2.1? 12- document bind and connect behavior based on address?
13 - update copyright date everywhere? 13
14 - what to do about author? 14- add functionality to query if object is ipv4 or 6?
15 - any chance we can do without the compat for the final release? 15- update copyright date everywhere?
16 - are only _API symbols being exported now? 16- what to do about author?
17 it used to export all externs... 17- add http POST sample to manual
18 - document zero-sized send on udp vs. tcp? 18 people keep asking stupid questions
19 - add http POST sample to manual 19- documentation of dirty/getfd/setfd is problematic because of portability
20 people keep asking stupid questions 20 same for unix and serial.
21 - document unix socket and serial socket? add raw support? 21 what to do about this? add a stronger disclaimer?
22 if so, add tests? 22- remove references to Lua 5.0 from documentation, add 5.2?
23 - make sure unix conforms to tcp and udp style 23- update lua and luasocket version in samples in documentation
24 - make sure serial conforms to tcp and udp style 24- document headers.lua?
25 does it need to use write/read instead of send/receive? 25- fix makefile with decent defaults?
26 - documentation of dirty/getfd/setfd is problematic because of portability 26
27 same for unix and serial. 27Done:
28 what to do about this? add a stronger disclaimer? 28
29 - nice getoption! 29- document ipv5_v6only default option being set?
30 prefix all setters with set_ and all getters with get_? 30- document tcp6 and udp6
31 - add what's new to manual 31- document dns.getaddrinfo
32 - remove references to Lua 5.0 from documentation, add 5.2? 32- document zero-sized send on udp vs. tcp?
33 - update lua and luasocket version in samples in documentation 33 no.
34 - document headers.lua? 34- document unix socket and serial socket? add raw support?
35 - fix makefile with decent defaults? 35 no.
36- document getoption
37
38
39
40
41
42
43
44
36 45
37 46
38replace \r\n with \0xD\0xA in everything 47replace \r\n with \0xD\0xA in everything
diff --git a/doc/dns.html b/doc/dns.html
index a38e368..c4a0472 100644
--- a/doc/dns.html
+++ b/doc/dns.html
@@ -39,12 +39,16 @@
39<h2 id=dns>DNS</h2> 39<h2 id=dns>DNS</h2>
40 40
41<p> 41<p>
42Name resolution functions return <em>all</em> information obtained from the 42IPv4 name resolution functions
43resolver in a table of the form: 43<a href=#toip><tt>dns.toip</tt></a>
44and
45<a href=#tohostname><tt>dns.tohostname</tt></a>
46return <em>all</em> information obtained from
47the resolver in a table of the form:
44</p> 48</p>
45 49
46<blockquote><tt> 50<blockquote><tt>
47resolved = {<br> 51resolved4 = {<br>
48&nbsp;&nbsp;name = <i>canonic-name</i>,<br> 52&nbsp;&nbsp;name = <i>canonic-name</i>,<br>
49&nbsp;&nbsp;alias = <i>alias-list</i>,<br> 53&nbsp;&nbsp;alias = <i>alias-list</i>,<br>
50&nbsp;&nbsp;ip = <i>ip-address-list</i><br> 54&nbsp;&nbsp;ip = <i>ip-address-list</i><br>
@@ -55,6 +59,53 @@ resolved = {<br>
55Note that the <tt>alias</tt> list can be empty. 59Note that the <tt>alias</tt> list can be empty.
56</p> 60</p>
57 61
62<p>
63The more general name resolution function
64<a href=#getaddrinfo><tt>dns.getaddrinfo</tt></a>, which
65supports both IPv6 and IPv4,
66returns <em>all</em> information obtained from
67the resolver in a table of the form:
68</p>
69
70<blockquote><tt>
71resolved6 = {<br>
72&nbsp;&nbsp;[1] = {<br>
73&nbsp;&nbsp;&nbsp;&nbsp;family = <i>family-name-1</i>,<br>
74&nbsp;&nbsp;&nbsp;&nbsp;addr = <i>address-1</i><br>
75&nbsp;&nbsp;},<br>
76&nbsp;&nbsp;...<br>
77&nbsp;&nbsp;[n] = {<br>
78&nbsp;&nbsp;&nbsp;&nbsp;family = <i>family-name-n</i>,<br>
79&nbsp;&nbsp;&nbsp;&nbsp;addr = <i>address-n</i><br>
80&nbsp;&nbsp;}<br>
81}
82</tt> </blockquote>
83
84<p>
85Here, <tt>family</tt> contains the string <tt>"inet"</tt> for IPv4
86addresses, and <tt>"inet6"</tt> for IPv6 addresses.
87</p>
88
89<!-- getaddrinfo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
90
91<p class=name id=getaddrinfo>
92socket.dns.<b>getaddrinfo(</b>address<b>)</b>
93</p>
94
95<p class=description>
96Converts from host name to address.
97</p>
98
99<p class=parameters>
100<tt>Address</tt> can be an IPv4 or IPv6 address or host name.
101</p>
102
103<p class=return>
104The function returns a table with all information returned by
105the resolver. In case of error, the function returns <b><tt>nil</tt></b>
106followed by an error message.
107</p>
108
58<!-- gethostname ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 109<!-- gethostname ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
59 110
60<p class=name id=gethostname> 111<p class=name id=gethostname>
@@ -72,7 +123,7 @@ socket.dns.<b>tohostname(</b>address<b>)</b>
72</p> 123</p>
73 124
74<p class=description> 125<p class=description>
75Converts from IP address to host name. 126Converts from IPv4 address to host name.
76</p> 127</p>
77 128
78<p class=parameters> 129<p class=parameters>
@@ -93,7 +144,7 @@ socket.dns.<b>toip(</b>address<b>)</b>
93</p> 144</p>
94 145
95<p class=description> 146<p class=description>
96Converts from host name to IP address. 147Converts from host name to IPv4 address.
97</p> 148</p>
98 149
99<p class=parameters> 150<p class=parameters>
diff --git a/doc/http.html b/doc/http.html
index 66282a4..9f3f087 100644
--- a/doc/http.html
+++ b/doc/http.html
@@ -36,7 +36,7 @@
36 36
37<!-- http +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 37<!-- http +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
38 38
39<h2 id=http>HTTP</h2> 39<h2 id="http">HTTP</h2>
40 40
41<p> 41<p>
42HTTP (Hyper Text Transfer Protocol) is the protocol used to exchange 42HTTP (Hyper Text Transfer Protocol) is the protocol used to exchange
@@ -119,7 +119,7 @@ the HTTP module:
119 119
120<!-- http.request ++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 120<!-- http.request ++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
121 121
122<p class=name id=request> 122<p class=name id="request">
123http.<b>request(</b>url [, body]<b>)</b><br> 123http.<b>request(</b>url [, body]<b>)</b><br>
124http.<b>request{</b><br> 124http.<b>request{</b><br>
125&nbsp;&nbsp;url = <i>string</i>,<br> 125&nbsp;&nbsp;url = <i>string</i>,<br>
@@ -256,7 +256,7 @@ r, c, h = http.request {
256-- } 256-- }
257</pre> 257</pre>
258 258
259<p class=note id=post> 259<p class=note id="post">
260Note: When sending a POST request, simple interface adds a 260Note: When sending a POST request, simple interface adds a
261"<tt>Content-type: application/x-www-form-urlencoded</tt>" 261"<tt>Content-type: application/x-www-form-urlencoded</tt>"
262header to the request. This is the type used by 262header to the request. This is the type used by
@@ -264,7 +264,7 @@ HTML forms. If you need another type, use the generic
264interface. 264interface.
265</p> 265</p>
266 266
267<p class=note id=authentication> 267<p class=note id="authentication">
268Note: Some URLs are protected by their 268Note: Some URLs are protected by their
269servers from anonymous download. For those URLs, the server must receive 269servers from anonymous download. For those URLs, the server must receive
270some sort of authentication along with the request or it will deny 270some sort of authentication along with the request or it will deny
diff --git a/doc/index.html b/doc/index.html
index 665b97b..9da0f3c 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -78,8 +78,8 @@ LuaSocket.
78</p> 78</p>
79 79
80<p> 80<p>
81Copyright &copy; 2004-2007 Diego Nehab. All rights reserved. <br> 81Copyright &copy; 1999-2012 Diego Nehab. All rights reserved. <br>
82Author: <A href="http://www.cs.princeton.edu/~diego">Diego Nehab</a> 82Author: <A href="http://www.impa.br/~diego">Diego Nehab</a>
83</p> 83</p>
84 84
85<!-- download +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 85<!-- download +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
@@ -87,25 +87,18 @@ Author: <A href="http://www.cs.princeton.edu/~diego">Diego Nehab</a>
87<h2 id=download>Download</h2> 87<h2 id=download>Download</h2>
88 88
89<p> 89<p>
90LuaSocket version 2.0.3 is now available for download! It is 90LuaSocket version 2.1.1-rc1 is now available for download!
91compatible with Lua&nbsp;5.1, and has 91It is compatible with Lua&nbsp;5.1 and 5.2, and has
92been tested on Windows&nbsp;XP, Linux, and Mac OS X. Chances 92been tested on Windows&nbsp;XP, Linux, and Mac OS X. Chances
93are it works well on most UNIX distributions and Windows flavors. 93are it works well on most UNIX distributions and Windows flavors.
94</p> 94</p>
95 95
96<p> 96<p>
97The library can be downloaded in source code from the 97The library can be downloaded in source code from the
98<a href=http://luaforge.net/projects/luasocket/>LuaSocket 98<a href="https://github.com/diegonehab/luasocket/downloads">LuaSocket
99project page</a> at LuaForge. 99project page</a> at GitHub. Besides the full C and Lua source code
100Besides the full C and Lua source code for the library, the distribution 100for the library, the distribution contains several examples,
101contains several examples, this user's manual and basic test procedures. 101this user's manual and basic test procedures.
102</p>
103
104<p>
105Danilo Tuler is maintaining Win32 binaries for LuaSocket, which are also
106available from LuaForge. These are compatible with the
107<a href=http://luaforge.net/projects/luabinaries>LuaBinaries</a>,
108also available from LuaForge.
109</p> 102</p>
110 103
111<p> Take a look at the <a 104<p> Take a look at the <a
@@ -118,15 +111,13 @@ manual to find out how to properly install the library.
118<h2 id=thanks>Special thanks</h2> 111<h2 id=thanks>Special thanks</h2>
119 112
120<p> 113<p>
121Throughout LuaSocket's history, many people gave suggestions 114This marks the first release of LuaSocket that
122that helped improve it. For that, I thank the Lua community. 115wholeheartedly embraces the open-source development
123Special thanks go to David Burgess, who has helped push the 116philosophy. After a long hiatus, Matthew Wild finally
124library to a new level of quality and from whom I have 117convinced me it was time for a release including IPv6
125learned a lot of stuff that doesn't show up in RFCs. 118and Lua 5.2 support. Special thanks to Sam Roberts, Florian
126Special thanks also to Carlos Cassino, who played a big part 119Zeitz, and Paul Aurich, Liam Devine, and everybody else that
127in the extensible design seen in the C core of LuaSocket 120has helped bring this library back to life.
1282.0. Mike Pall has been helping a lot too! Thanks to you
129all!
130</p> 121</p>
131 122
132<!-- whatsnew +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 123<!-- whatsnew +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
@@ -134,30 +125,25 @@ all!
134<h2 id=new>What's New</h2> 125<h2 id=new>What's New</h2>
135 126
136<p> 127<p>
1372.0.3 is just a bug-fix/update release. 128Main changes for LuaSocket&nbsp;2.1.1-rc1 are IPv6 support
129and Lua&nbsp;5.2 compatibility.
138</p> 130</p>
139 131
140<ul> 132<ul>
141<li> Fixed: manual sample of HTTP authentication now uses correct 133<li> Added: Compatible with Lua&nbsp;5.2 (using <tt>LUA_COMPAT_MODULE</tt>);
142 "authorization" header (Alexandre Ittner); 134<li> Added: IPv6 support;
143<li> Fixed: receive() returns immediatelly if prefix can satisfy 135<ul>
144 bytes requested (M Joonas Pihlaja); 136<li> <tt>Socket.connect</tt> and <tt>socket.bind</tt> support IPv6 addresses;
145<li> Fixed: multicast didn't work on Windows, or anywhere 137<li> <tt>Getpeername</tt> and <tt>getsockname</tt> support IPv6 addresses;
146 else for that matter (Herbert Leuwer, Adrian Sietsma); 138<li> New <tt>socket.tcp6</tt> and <tt>socket.udp6</tt> functions;
147<li> Fixed: select() now reports an error when called with more 139<li> New <tt>socket.dns.getaddrinfo</tt> function;
148 sockets than FD_SETSIZE (Lorenzo Leonini); 140</ul>
149<li> Fixed: manual links to home.html changed to index.html (Robert Hahn); 141<li> Added: <tt>getoption</tt> method;
150<li> Fixed: mime.unb64() would return an empty string on results that started 142<li> Fixed: <tt>url.unescape</tt> was returning additional values;
151 with a null character (Robert Raschke); 143<li> Fixed: Receiving zero-length datagram is now possible;
152<li> Fixed: HTTP now automatically redirects on 303 and 307 (Jonathan Gray); 144<li> Improved: Hidden all internal library symbols;
153<li> Fixed: calling sleep() with negative numbers could 145<li> Improved: Better error messages;
154 block forever, wasting CPU. Now it returns immediately (MPB); 146<li> Improved: Better documentation of socket options.
155<li> Improved: FTP commands are now sent in upper case to
156 help buggy servers (Anders Eurenius);
157<li> Improved: known headers now sent in canonic
158 capitalization to help buggy servers (Joseph Stewart);
159<li> Improved: Clarified tcp:receive() in the manual (MPB);
160<li> Improved: Decent makefiles (LHF).
161</ul> 147</ul>
162 148
163<!-- old ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 149<!-- old ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
@@ -166,7 +152,7 @@ all!
166 152
167<p> 153<p>
168All previous versions of the LuaSocket library can be downloaded <a 154All previous versions of the LuaSocket library can be downloaded <a
169href="http://www.cs.princeton.edu/~diego/professional/luasocket/old"> 155href="http://www.impa.br/~diego/software/luasocket/old">
170here</a>. Although these versions are no longer supported, they are 156here</a>. Although these versions are no longer supported, they are
171still available for those that have compatibility issues. 157still available for those that have compatibility issues.
172</p> 158</p>
@@ -185,7 +171,7 @@ still available for those that have compatibility issues.
185<p> 171<p>
186<small> 172<small>
187Last modified by Diego Nehab on <br> 173Last modified by Diego Nehab on <br>
188Wed Oct 3 02:07:59 BRT 2007 174Mon Apr 16 21:58:56 HKT 2012
189</small> 175</small>
190</p> 176</p>
191</center> 177</center>
diff --git a/doc/installation.html b/doc/installation.html
index bb9a5bb..00b2db0 100644
--- a/doc/installation.html
+++ b/doc/installation.html
@@ -39,24 +39,16 @@ Installation">
39 39
40<h2>Installation</h2> 40<h2>Installation</h2>
41 41
42<p> LuaSocket 2.0.2 uses the new package system for Lua 5.1. 42<p> LuaSocket 2.1.1-rc still uses Lua&nbsp;5.1's package
43All Lua library developers are encouraged to update their libraries so that 43system. Users that have already made the switch to
44all libraries can coexist peacefully and users can benefit from the 44Lua&nbsp;5.2 should leave the default
45standardization and flexibility of the standard. 45<tt>LUA_COMPAT_MODULE</tt> defined when compiling their Lua
46</p> 46distribution for compatibility with LuaSocket. </p>
47
48<p>
49Those stuck with Lua 5.0 will need the
50<a href=http://www.keplerproject.org/compat/>compat-5.1</a>
51module. It is maintained by
52<a href=http://www.keplerproject.org/>The Kepler
53Project</a>'s team, and implements the Lua 5.1 package proposal
54on top of Lua 5.0. </p>
55 47
56<p> Here we will only describe the standard distribution. 48<p> Here we describe the standard distribution. If the
57If the standard doesn't meet your needs, we refer you to the 49standard doesn't meet your needs, we refer you to the Lua
58Lua discussion list, where any question about the package 50discussion list, where any question about the package scheme
59scheme will likely already have been answered. </p> 51will likely already have been answered. </p>
60 52
61<h3>Directory structure</h3> 53<h3>Directory structure</h3>
62 54
@@ -64,14 +56,19 @@ scheme will likely already have been answered. </p>
64directories, one for system dependent files, and another for system 56directories, one for system dependent files, and another for system
65independent files. Let's call these directories <tt>&lt;CDIR&gt;</tt> 57independent files. Let's call these directories <tt>&lt;CDIR&gt;</tt>
66and <tt>&lt;LDIR&gt;</tt>, respectively. 58and <tt>&lt;LDIR&gt;</tt>, respectively.
67For instance, in my laptop, I use '<tt>/usr/local/lib/lua/5.0</tt>' for 59For example, in my laptp, Lua&nbsp;5.1 is configured to
68<tt>&lt;CDIR&gt;</tt> and '<tt>/usr/local/share/lua/5.0</tt>' for 60use '<tt>/usr/local/lib/lua/5.1</tt>' for
69<tt>&lt;LDIR&gt;</tt>. On Windows, sometimes only one directory is used, say 61<tt>&lt;CDIR&gt;</tt> and '<tt>/usr/local/share/lua/5.1</tt>' for
70'<tt>c:\program files\lua\5.0</tt>'. Here is the standard LuaSocket 62<tt>&lt;LDIR&gt;</tt>. On Windows, <tt>&lt;CDIR&gt;</tt>
63usually points to the directory where the Lua executable is
64found, and <tt>&lt;LDIR&gt;</tt> points to a
65<tt>lua/</tt> directory inside <tt>&lt;CDIR&gt;</tt>. (These
66settings can be overridden by environment variables
67<tt>LUA_PATH</tt> and <tt>LUA_CPATH</tt>. See the Lua
68documentation for details.) Here is the standard LuaSocket
71distribution directory structure:</p> 69distribution directory structure:</p>
72 70
73<pre class=example> 71<pre class=example>
74&lt;LDIR&gt;/compat-5.1.lua
75&lt;LDIR&gt;/ltn12.lua 72&lt;LDIR&gt;/ltn12.lua
76&lt;LDIR&gt;/socket.lua 73&lt;LDIR&gt;/socket.lua
77&lt;CDIR&gt;/socket/core.dll 74&lt;CDIR&gt;/socket/core.dll
@@ -88,33 +85,6 @@ distribution directory structure:</p>
88would be replaced by <tt>core.so</tt>. 85would be replaced by <tt>core.so</tt>.
89</p> 86</p>
90 87
91<p> In order for the interpreter to find all LuaSocket components, three
92environment variables need to be set. The first environment variable tells
93the interpreter to load the <tt>compat-5.1.lua</tt> module at startup: </p>
94
95<pre class=example>
96LUA_INIT=@&lt;LDIR&gt;/compat-5.1.lua
97</pre>
98
99<p>
100This is only need for Lua&nbsp;5.0! Lua&nbsp;5.1 comes with
101the package system built in, of course.
102</p>
103
104<p>
105The other two environment variables instruct the compatibility module to
106look for dynamic libraries and extension modules in the appropriate
107directories and with the appropriate filename extensions.
108</p>
109
110<pre class=example>
111LUA_PATH=&lt;LDIR&gt;/?.lua;?.lua
112LUA_CPATH=&lt;CDIR&gt;/?.dll;?.dll
113</pre>
114
115<p> Again, naturally, on Unix systems the shared library extension would be
116<tt>.so</tt> instead of <tt>.dll</tt>.</p>
117
118<h3>Using LuaSocket</h3> 88<h3>Using LuaSocket</h3>
119 89
120<p> With the above setup, and an interpreter with shared library support, 90<p> With the above setup, and an interpreter with shared library support,
@@ -122,19 +92,19 @@ it should be easy to use LuaSocket. Just fire the interpreter and use the
122<tt>require</tt> function to gain access to whatever module you need:</p> 92<tt>require</tt> function to gain access to whatever module you need:</p>
123 93
124<pre class=example> 94<pre class=example>
125Lua 5.1.2 Copyright (C) 1994-2007 Lua.org, PUC-Rio 95Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
126&gt; socket = require("socket") 96&gt; socket = require("socket")
127&gt; print(socket._VERSION) 97&gt; print(socket._VERSION)
128--&gt; LuaSocket 2.0.2 98--&gt; LuaSocket 2.1.1-rc1
129</pre> 99</pre>
130 100
131<p> Each module loads their dependencies automatically, so you only need to 101<p> Each module loads their dependencies automatically, so you only need to
132load the modules you directly depend upon: </p> 102load the modules you directly depend upon: </p>
133 103
134<pre class=example> 104<pre class=example>
135Lua 5.1.2 Copyright (C) 1994-2007 Lua.org, PUC-Rio 105Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
136&gt; http = require("socket.http") 106&gt; http = require("socket.http")
137&gt; print(http.request("http://www.cs.princeton.edu/~diego/professional/luasocket")) 107&gt; print(http.request("http://www.impa.br/~diego/software/luasocket"))
138--&gt; homepage gets dumped to terminal 108--&gt; homepage gets dumped to terminal
139</pre> 109</pre>
140 110
@@ -153,7 +123,7 @@ Lua 5.1.2 Copyright (C) 1994-2007 Lua.org, PUC-Rio
153<p> 123<p>
154<small> 124<small>
155Last modified by Diego Nehab on <br> 125Last modified by Diego Nehab on <br>
156Thu Apr 20 00:25:30 EDT 2006 126Mon Apr 16 21:01:42 HKT 2012
157</small> 127</small>
158</p> 128</p>
159</center> 129</center>
diff --git a/doc/reference.html b/doc/reference.html
index 8da3956..d1043d4 100644
--- a/doc/reference.html
+++ b/doc/reference.html
@@ -42,6 +42,7 @@ Support, Manual">
42<blockquote> 42<blockquote>
43<a href="dns.html">DNS (in socket)</a> 43<a href="dns.html">DNS (in socket)</a>
44<blockquote> 44<blockquote>
45<a href="dns.html#getaddrinfo">getaddrinfo</a>,
45<a href="dns.html#gethostname">gethostname</a>, 46<a href="dns.html#gethostname">gethostname</a>,
46<a href="dns.html#tohostname">tohostname</a>, 47<a href="dns.html#tohostname">tohostname</a>,
47<a href="dns.html#toip">toip</a>. 48<a href="dns.html#toip">toip</a>.
@@ -155,9 +156,11 @@ Support, Manual">
155<a href="socket.html#sleep">sleep</a>, 156<a href="socket.html#sleep">sleep</a>,
156<a href="socket.html#setsize">_SETSIZE</a>, 157<a href="socket.html#setsize">_SETSIZE</a>,
157<a href="socket.html#source">source</a>, 158<a href="socket.html#source">source</a>,
158<a href="tcp.html#tcp">tcp</a>, 159<a href="tcp.html#socket.tcp">tcp</a>,
160<a href="tcp.html#socket.tcp6">tcp6</a>,
159<a href="socket.html#try">try</a>, 161<a href="socket.html#try">try</a>,
160<a href="udp.html#udp">udp</a>, 162<a href="udp.html#socket.udp">udp</a>,
163<a href="udp.html#socket.udp6">udp6</a>,
161<a href="socket.html#version">_VERSION</a>. 164<a href="socket.html#version">_VERSION</a>.
162</blockquote> 165</blockquote>
163</blockquote> 166</blockquote>
@@ -194,6 +197,7 @@ Support, Manual">
194<a href="udp.html">UDP (in socket)</a> 197<a href="udp.html">UDP (in socket)</a>
195<blockquote> 198<blockquote>
196<a href="udp.html#close">close</a>, 199<a href="udp.html#close">close</a>,
200<a href="udp.html#getoption">getoption</a>,
197<a href="udp.html#getpeername">getpeername</a>, 201<a href="udp.html#getpeername">getpeername</a>,
198<a href="udp.html#getsockname">getsockname</a>, 202<a href="udp.html#getsockname">getsockname</a>,
199<a href="udp.html#receive">receive</a>, 203<a href="udp.html#receive">receive</a>,
diff --git a/doc/tcp.html b/doc/tcp.html
index f59d7ac..dc1a0b6 100644
--- a/doc/tcp.html
+++ b/doc/tcp.html
@@ -36,16 +36,16 @@
36 36
37<!-- tcp ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 37<!-- tcp ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
38 38
39<h2 id=tcp>TCP</h2> 39<h2 id="tcp">TCP</h2>
40 40
41<!-- socket.tcp +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 41<!-- socket.tcp +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
42 42
43<p class=name id=socket.tcp> 43<p class=name id="socket.tcp">
44socket.<b>tcp()</b> 44socket.<b>tcp()</b>
45</p> 45</p>
46 46
47<p class=description> 47<p class=description>
48Creates and returns a TCP master object. A master object can 48Creates and returns an IPv4 TCP master object. A master object can
49be transformed into a server object with the method 49be transformed into a server object with the method
50<a href=#listen><tt>listen</tt></a> (after a call to <a 50<a href=#listen><tt>listen</tt></a> (after a call to <a
51href=#bind><tt>bind</tt></a>) or into a client object with 51href=#bind><tt>bind</tt></a>) or into a client object with
@@ -58,9 +58,34 @@ In case of success, a new master object is returned. In case of error,
58<b><tt>nil</tt></b> is returned, followed by an error message. 58<b><tt>nil</tt></b> is returned, followed by an error message.
59</p> 59</p>
60 60
61<!-- socket.tcp6 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
62
63<p class=name id="socket.tcp6">
64socket.<b>tcp6()</b>
65</p>
66
67<p class=description>
68Creates and returns an IPv6 TCP master object. A master object can
69be transformed into a server object with the method
70<a href=#listen><tt>listen</tt></a> (after a call to <a
71href=#bind><tt>bind</tt></a>) or into a client object with
72the method <a href=#connect><tt>connect</tt></a>. The only other
73method supported by a master object is the
74<a href=#close><tt>close</tt></a> method.</p>
75
76<p class=return>
77In case of success, a new master object is returned. In case of error,
78<b><tt>nil</tt></b> is returned, followed by an error message.
79</p>
80
81<p class=note>
82Note: The TCP object returned will have the option
83"<tt>ipv6-v6only</tt>" set to <tt><b>true</b></tt>.
84</p>
85
61<!-- accept +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 86<!-- accept +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
62 87
63<p class=name id=accept> 88<p class=name id="accept">
64server:<b>accept()</b> 89server:<b>accept()</b>
65</p> 90</p>
66 91
@@ -87,7 +112,7 @@ might block until <em>another</em> client shows up.
87 112
88<!-- bind +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 113<!-- bind +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
89 114
90<p class=name id=bind> 115<p class=name id="bind">
91master:<b>bind(</b>address, port<b>)</b> 116master:<b>bind(</b>address, port<b>)</b>
92</p> 117</p>
93 118
@@ -116,7 +141,7 @@ is available and is a shortcut for the creation of server sockets.
116 141
117<!-- close ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 142<!-- close ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
118 143
119<p class=name id=close> 144<p class=name id="close">
120master:<b>close()</b><br> 145master:<b>close()</b><br>
121client:<b>close()</b><br> 146client:<b>close()</b><br>
122server:<b>close()</b> 147server:<b>close()</b>
@@ -139,7 +164,7 @@ automatically closed before destruction, though.
139 164
140<!-- connect ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 165<!-- connect ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
141 166
142<p class=name id=connect> 167<p class=name id="connect">
143master:<b>connect(</b>address, port<b>)</b> 168master:<b>connect(</b>address, port<b>)</b>
144</p> 169</p>
145 170
@@ -180,9 +205,18 @@ href=socket.html#select><tt>socket.select</tt></a> with the socket in the
180established. 205established.
181</p> 206</p>
182 207
208<p class=note>
209Note: Starting with LuaSocket 2.1, the host name resolution
210depends on whether the socket was created by <a
211href=#socket.tcp><tt>socket.tcp</tt></a> or <a
212href=#socket.tcp6><tt>socket.tcp6</tt></a>. Addresses from
213the appropriate family are tried in succession until the
214first success or until the last failure.
215</p>
216
183<!-- getpeername ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 217<!-- getpeername ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
184 218
185<p class=name id=getpeername> 219<p class=name id="getpeername">
186client:<b>getpeername()</b> 220client:<b>getpeername()</b>
187</p> 221</p>
188 222
@@ -202,7 +236,7 @@ Note: It makes no sense to call this method on server objects.
202 236
203<!-- getsockname ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 237<!-- getsockname ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
204 238
205<p class=name id=getsockname> 239<p class=name id="getsockname">
206master:<b>getsockname()</b><br> 240master:<b>getsockname()</b><br>
207client:<b>getsockname()</b><br> 241client:<b>getsockname()</b><br>
208server:<b>getsockname()</b> 242server:<b>getsockname()</b>
@@ -219,7 +253,7 @@ the port. In case of error, the method returns <b><tt>nil</tt></b>.
219 253
220<!-- getstats +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 254<!-- getstats +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
221 255
222<p class=name id=getstats> 256<p class=name id="getstats">
223master:<b>getstats()</b><br> 257master:<b>getstats()</b><br>
224client:<b>getstats()</b><br> 258client:<b>getstats()</b><br>
225server:<b>getstats()</b><br> 259server:<b>getstats()</b><br>
@@ -237,7 +271,7 @@ and the age of the socket object in seconds.
237 271
238<!-- listen ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 272<!-- listen ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
239 273
240<p class=name id=listen> 274<p class=name id="listen">
241master:<b>listen(</b>backlog<b>)</b> 275master:<b>listen(</b>backlog<b>)</b>
242</p> 276</p>
243 277
@@ -265,7 +299,7 @@ method returns <b><tt>nil</tt></b> followed by an error message.
265 299
266<!-- receive ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 300<!-- receive ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
267 301
268<p class=name id=receive> 302<p class=name id="receive">
269client:<b>receive(</b>[pattern [, prefix]]<b>)</b> 303client:<b>receive(</b>[pattern [, prefix]]<b>)</b>
270</p> 304</p>
271 305
@@ -316,7 +350,7 @@ too.
316 350
317<!-- send +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 351<!-- send +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
318 352
319<p class=name id=send> 353<p class=name id="send">
320client:<b>send(</b>data [, i [, j]]<b>)</b> 354client:<b>send(</b>data [, i [, j]]<b>)</b>
321</p> 355</p>
322 356
@@ -354,7 +388,7 @@ instead of calling the method several times.
354 388
355<!-- setoption ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 389<!-- setoption ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
356 390
357<p class=name id=setoption> 391<p class=name id="setoption">
358client:<b>setoption(</b>option [, value]<b>)</b><br> 392client:<b>setoption(</b>option [, value]<b>)</b><br>
359server:<b>setoption(</b>option [, value]<b>)</b> 393server:<b>setoption(</b>option [, value]<b>)</b>
360</p> 394</p>
@@ -392,8 +426,11 @@ used in validating addresses supplied in a call to
392<a href=#bind><tt>bind</tt></a> should allow reuse of local addresses; 426<a href=#bind><tt>bind</tt></a> should allow reuse of local addresses;
393 427
394<li> '<tt>tcp-nodelay</tt>': Setting this option to <tt>true</tt> 428<li> '<tt>tcp-nodelay</tt>': Setting this option to <tt>true</tt>
395disables the Nagle's algorithm for the connection. 429disables the Nagle's algorithm for the connection;
396 430
431<li> '<tt>ipv6-v6only</tt>':
432Setting this option to <tt>true</tt> restricts an <tt>inet6</tt> socket to
433sending and receiving only IPv6 packets.
397</ul> 434</ul>
398 435
399<p class=return> 436<p class=return>
@@ -407,7 +444,7 @@ Note: The descriptions above come from the man pages.
407 444
408<!-- getoption ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 445<!-- getoption ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
409 446
410<p class=name id=getoption> 447<p class=name id="getoption">
411client:<b>getoption(</b>option)</b><br> 448client:<b>getoption(</b>option)</b><br>
412server:<b>getoption(</b>option)</b> 449server:<b>getoption(</b>option)</b>
413</p> 450</p>
@@ -433,13 +470,9 @@ The method returns the option <tt>value</tt> in case of success, or
433<b><tt>nil</tt></b> followed by an error message otherwise. 470<b><tt>nil</tt></b> followed by an error message otherwise.
434</p> 471</p>
435 472
436<p class=note>
437Note: The descriptions above come from the man pages.
438</p>
439
440<!-- setstats +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 473<!-- setstats +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
441 474
442<p class=name id=setstats> 475<p class=name id="setstats">
443master:<b>setstats(</b>received, sent, age<b>)</b><br> 476master:<b>setstats(</b>received, sent, age<b>)</b><br>
444client:<b>setstats(</b>received, sent, age<b>)</b><br> 477client:<b>setstats(</b>received, sent, age<b>)</b><br>
445server:<b>setstats(</b>received, sent, age<b>)</b><br> 478server:<b>setstats(</b>received, sent, age<b>)</b><br>
@@ -462,7 +495,7 @@ The method returns 1 in case of success and <tt><b>nil</b></tt> otherwise.
462 495
463<!-- settimeout +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 496<!-- settimeout +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
464 497
465<p class=name id=settimeout> 498<p class=name id="settimeout">
466master:<b>settimeout(</b>value [, mode]<b>)</b><br> 499master:<b>settimeout(</b>value [, mode]<b>)</b><br>
467client:<b>settimeout(</b>value [, mode]<b>)</b><br> 500client:<b>settimeout(</b>value [, mode]<b>)</b><br>
468server:<b>settimeout(</b>value [, mode]<b>)</b> 501server:<b>settimeout(</b>value [, mode]<b>)</b>
@@ -519,7 +552,7 @@ contained verbs making their imperative nature obvious.
519 552
520<!-- shutdown +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 553<!-- shutdown +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
521 554
522<p class=name id=shutdown> 555<p class=name id="shutdown">
523client:<b>shutdown(</b>mode<b>)</b><br> 556client:<b>shutdown(</b>mode<b>)</b><br>
524</p> 557</p>
525 558
@@ -543,7 +576,7 @@ This function returns 1.
543 576
544<!-- dirty +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 577<!-- dirty +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
545 578
546<p class=name id=dirty> 579<p class=name id="dirty">
547master:<b>dirty()</b><br> 580master:<b>dirty()</b><br>
548client:<b>dirty()</b><br> 581client:<b>dirty()</b><br>
549server:<b>dirty()</b> 582server:<b>dirty()</b>
@@ -563,7 +596,7 @@ Note: <b>This is an internal method, any use is unlikely to be portable.</b>
563 596
564<!-- getfd +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 597<!-- getfd +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
565 598
566<p class=name id=getfd> 599<p class=name id="getfd">
567master:<b>getfd()</b><br> 600master:<b>getfd()</b><br>
568client:<b>getfd()</b><br> 601client:<b>getfd()</b><br>
569server:<b>getfd()</b> 602server:<b>getfd()</b>
@@ -583,7 +616,7 @@ Note: <b>This is an internal method, any use is unlikely to be portable.</b>
583 616
584<!-- setfd +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 617<!-- setfd +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
585 618
586<p class=name id=setfd> 619<p class=name id="setfd">
587master:<b>setfd(</b>fd<b>)</b><br> 620master:<b>setfd(</b>fd<b>)</b><br>
588client:<b>setfd(</b>fd<b>)</b><br> 621client:<b>setfd(</b>fd<b>)</b><br>
589server:<b>setfd(</b>fd<b>)</b> 622server:<b>setfd(</b>fd<b>)</b>
diff --git a/doc/udp.html b/doc/udp.html
index eca881d..4a334b7 100644
--- a/doc/udp.html
+++ b/doc/udp.html
@@ -37,7 +37,7 @@
37 37
38<!-- udp ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 38<!-- udp ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
39 39
40<h2 id=udp>UDP</h2> 40<h2 id="udp">UDP</h2>
41 41
42<!-- socket.udp ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 42<!-- socket.udp ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
43 43
@@ -46,10 +46,12 @@ socket.<b>udp()</b>
46</p> 46</p>
47 47
48<p class="description"> 48<p class="description">
49Creates and returns an unconnected UDP object. Unconnected objects support the 49Creates and returns an unconnected IPv4 UDP object.
50Unconnected objects support the
50<a href="#sendto"><tt>sendto</tt></a>, 51<a href="#sendto"><tt>sendto</tt></a>,
51<a href="#receive"><tt>receive</tt></a>, 52<a href="#receive"><tt>receive</tt></a>,
52<a href="#receivefrom"><tt>receivefrom</tt></a>, 53<a href="#receivefrom"><tt>receivefrom</tt></a>,
54<a href="#getoption"><tt>getoption</tt></a>,
53<a href="#getsockname"><tt>getsockname</tt></a>, 55<a href="#getsockname"><tt>getsockname</tt></a>,
54<a href="#setoption"><tt>setoption</tt></a>, 56<a href="#setoption"><tt>setoption</tt></a>,
55<a href="#settimeout"><tt>settimeout</tt></a>, 57<a href="#settimeout"><tt>settimeout</tt></a>,
@@ -66,6 +68,44 @@ returned. In case of error, <b><tt>nil</tt></b> is returned, followed by
66an error message. 68an error message.
67</p> 69</p>
68 70
71<!-- socket.udp ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
72
73<p class="name" id="socket.udp6">
74socket.<b>udp6()</b>
75</p>
76
77<p class="description">
78Creates and returns an unconnected IPv6 UDP object.
79Unconnected objects support the
80<a href="#sendto"><tt>sendto</tt></a>,
81<a href="#receive"><tt>receive</tt></a>,
82<a href="#receivefrom"><tt>receivefrom</tt></a>,
83<a href="#getoption"><tt>getoption</tt></a>,
84<a href="#getsockname"><tt>getsockname</tt></a>,
85<a href="#setoption"><tt>setoption</tt></a>,
86<a href="#settimeout"><tt>settimeout</tt></a>,
87<a href="#setpeername"><tt>setpeername</tt></a>,
88<a href="#setsockname"><tt>setsockname</tt></a>, and
89<a href="#close"><tt>close</tt></a>.
90The <a href="#setpeername"><tt>setpeername</tt></a>
91is used to connect the object.
92</p>
93
94<p class="return">
95In case of success, a new unconnected UDP object
96returned. In case of error, <b><tt>nil</tt></b> is returned, followed by
97an error message.
98</p>
99
100<p class=note>
101Note: The TCP object returned will have the option
102"<tt>ipv6-v6only</tt>" set to <tt><b>true</b></tt>.
103</p>
104
105
106
107<!-- close +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
108
69<!-- close +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 109<!-- close +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
70 110
71<p class="name" id="close"> 111<p class="name" id="close">
@@ -177,6 +217,40 @@ address and port as extra return values (and is therefore slightly less
177efficient). 217efficient).
178</p> 218</p>
179 219
220<!-- getoption +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
221
222<p class="name" id="getoption">
223connected:<b>getoption()</b><br>
224unconnected:<b>getoption()</b>
225</p>
226
227<p class="description">
228Gets an option value from the UDP object.
229See <a href=#setoption><tt>setoption</tt></a> for
230description of the option names and values.
231</p>
232
233<p class="parameters"><tt>Option</tt> is a string with the option name.
234<ul>
235<li> '<tt>dontroute</tt>'
236<li> '<tt>broadcast</tt>'
237<li> '<tt>reuseaddr</tt>'
238<li> '<tt>reuseport</tt>'
239<li> '<tt>ip-multicast-loop</tt>'
240<li> '<tt>ipv6-v6only</tt>'
241<li> '<tt>ip-multicast-if</tt>'
242<li> '<tt>ip-multicast-ttl</tt>'
243<li> '<tt>ip-add-membership</tt>'
244<li> '<tt>ip-drop-membership</tt>'
245</ul>
246</p>
247
248<p class=return>
249The method returns the option <tt>value</tt> in case of
250success, or
251<b><tt>nil</tt></b> followed by an error message otherwise.
252</p>
253
180<!-- send ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 254<!-- send ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
181 255
182<p class="name" id="send"> 256<p class="name" id="send">
@@ -284,6 +358,15 @@ is recommended when the same peer is used for several transmissions
284and can result in up to 30% performance gains. 358and can result in up to 30% performance gains.
285</p> 359</p>
286 360
361<p class=note>
362Note: Starting with LuaSocket 2.1, the host name resolution
363depends on whether the socket was created by <a
364href=#socket.udp><tt>socket.udp</tt></a> or <a
365href=#socket.udp6><tt>socket.udp6</tt></a>. Addresses from
366the appropriate family are tried in succession until the
367first success or until the last failure.
368</p>
369
287<!-- setsockname +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 370<!-- setsockname +++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
288 371
289<p class="name" id="setsockname"> 372<p class="name" id="setsockname">
@@ -332,23 +415,57 @@ only modify an option if you are sure you need it.</p>
332name, and <tt>value</tt> depends on the option being set: 415name, and <tt>value</tt> depends on the option being set:
333</p> 416</p>
334 417
335<ul> 418<ul>
336<li>'<tt>dontroute</tt>': Setting this option to <tt>true</tt> 419<li> '<tt>dontroute</tt>': Indicates that outgoing
337indicates that outgoing messages should bypass the standard routing 420messages should bypass the standard routing facilities.
338facilities;</li> 421Receives a boolean value;
339<li>'<tt>broadcast</tt>': Setting this option to <tt>true</tt> 422<li> '<tt>broadcast</tt>': Requests permission to send
340requests permission to send broadcast datagrams on the 423broadcast datagrams on the socket.
341socket.</li> 424Receives a boolean value;
342</ul> 425<li> '<tt>reuseaddr</tt>': Indicates that the rules used in
426validating addresses supplied in a <tt>bind()</tt> call
427should allow reuse of local addresses.
428Receives a boolean value;
429<li> '<tt>reuseport</tt>': Allows completely duplicate
430bindings by multiple processes if they all set
431'<tt>reuseport</tt>' before binding the port.
432Receives a boolean value;
433<li> '<tt>ip-multicast-loop</tt>':
434Specifies whether or not a copy of an outgoing multicast
435datagram is delivered to the sending host as long as it is a
436member of the multicast group.
437Receives a boolean value;
438<li> '<tt>ipv6-v6only</tt>':
439Specifies whether to restrict <tt>inet6</tt> sockets to
440sending and receiving only IPv6 packets.
441Receive a boolean value;
442<li> '<tt>ip-multicast-if</tt>':
443Sets the interface over which outgoing multicast datagrams
444are sent.
445Receives an IP address;
446<li> '<tt>ip-multicast-ttl</tt>':
447Sets the Time To Live in the IP header for outgoing
448multicast datagrams.
449Receives a number;
450<li> '<tt>ip-add-membership</tt>':
451Joins the multicast group specified.
452Receives a table with fields
453<tt>multiaddr</tt> and <tt>interface</tt>, each containing an
454IP address;
455<li> '<tt>ip-drop-membership</tt>': Leaves the multicast
456group specified.
457Receives a table with fields
458<tt>multiaddr</tt> and <tt>interface</tt>, each containing an
459IP address.
460</ul>
343 461
344<p class="return"> 462<p class="return">
345The method returns 1 in case of success, or 463The method returns 1 in case of success, or
346<b><tt>nil</tt></b> followed by an error message otherwise. 464<b><tt>nil</tt></b> followed by an error message otherwise.
347</p> 465</p>
348 466
349<p class="note"> 467<p class=note>
350Note: The descriptions above come from the man 468Note: The descriptions above come from the man pages.
351pages.
352</p> 469</p>
353 470
354<!-- settimeout +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 471<!-- settimeout +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
diff --git a/doc/url.html b/doc/url.html
index 9f234d9..6ff673d 100644
--- a/doc/url.html
+++ b/doc/url.html
@@ -36,7 +36,7 @@
36 36
37<!-- url ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 37<!-- url ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
38 38
39<h2 id=url>URL</h2> 39<h2 id="url">URL</h2>
40 40
41<p> 41<p>
42The <tt>url</tt> namespace provides functions to parse, protect, 42The <tt>url</tt> namespace provides functions to parse, protect,
@@ -69,7 +69,7 @@ An URL is defined by the following grammar:
69 69
70<!-- absolute +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 70<!-- absolute +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
71 71
72<p class=name id=absolute> 72<p class=name id="absolute">
73url.<b>absolute(</b>base, relative<b>)</b> 73url.<b>absolute(</b>base, relative<b>)</b>
74</p> 74</p>
75 75
@@ -125,7 +125,7 @@ g;x?y#s = http://a/b/c/g;x?y#s
125 125
126<!-- build ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 126<!-- build ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
127 127
128<p class=name id=build> 128<p class=name id="build">
129url.<b>build(</b>parsed_url<b>)</b> 129url.<b>build(</b>parsed_url<b>)</b>
130</p> 130</p>
131 131
@@ -146,7 +146,7 @@ The function returns a string with the built URL.
146 146
147<!-- build_path +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 147<!-- build_path +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
148 148
149<p class=name id=build_path> 149<p class=name id="build_path">
150url.<b>build_path(</b>segments, unsafe<b>)</b> 150url.<b>build_path(</b>segments, unsafe<b>)</b>
151</p> 151</p>
152 152
@@ -200,7 +200,7 @@ code = url.escape("/#?;")
200 200
201<!-- parse ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 201<!-- parse ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
202 202
203<p class=name id=parse> 203<p class=name id="parse">
204url.<b>parse(</b>url, default<b>)</b> 204url.<b>parse(</b>url, default<b>)</b>
205</p> 205</p>
206 206
@@ -265,7 +265,7 @@ parsed_url = url.parse("ftp://root:passwd@unsafe.org/pub/virus.exe;type=i")
265 265
266<!-- parse_path +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 266<!-- parse_path +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
267 267
268<p class=name id=parse_path> 268<p class=name id="parse_path">
269url.<b>parse_path(</b>path<b>)</b> 269url.<b>parse_path(</b>path<b>)</b>
270</p> 270</p>
271 271
diff --git a/makefile.dist b/makefile.dist
index e4f8da8..fbd6681 100644
--- a/makefile.dist
+++ b/makefile.dist
@@ -1,7 +1,7 @@
1#-------------------------------------------------------------------------- 1#--------------------------------------------------------------------------
2# Distribution makefile 2# Distribution makefile
3#-------------------------------------------------------------------------- 3#--------------------------------------------------------------------------
4DIST = luasocket-2.0.3 4DIST = luasocket-2.1.1-rc1
5 5
6TEST = \ 6TEST = \
7 test/README \ 7 test/README \
diff --git a/src/luasocket.h b/src/luasocket.h
index 608ff7b..09e758d 100644
--- a/src/luasocket.h
+++ b/src/luasocket.h
@@ -11,8 +11,8 @@
11/*-------------------------------------------------------------------------*\ 11/*-------------------------------------------------------------------------*\
12* Current socket library version 12* Current socket library version
13\*-------------------------------------------------------------------------*/ 13\*-------------------------------------------------------------------------*/
14#define LUASOCKET_VERSION "LuaSocket 2.1.1" 14#define LUASOCKET_VERSION "LuaSocket 2.1.1-rc1"
15#define LUASOCKET_COPYRIGHT "Copyright (C) 1999-2011 Diego Nehab" 15#define LUASOCKET_COPYRIGHT "Copyright (C) 1999-2012 Diego Nehab"
16#define LUASOCKET_AUTHORS "Diego Nehab" 16#define LUASOCKET_AUTHORS "Diego Nehab"
17 17
18/*-------------------------------------------------------------------------*\ 18/*-------------------------------------------------------------------------*\
diff --git a/src/mime.h b/src/mime.h
index 37f370f..150e7ad 100644
--- a/src/mime.h
+++ b/src/mime.h
@@ -13,8 +13,8 @@
13/*-------------------------------------------------------------------------*\ 13/*-------------------------------------------------------------------------*\
14* Current MIME library version 14* Current MIME library version
15\*-------------------------------------------------------------------------*/ 15\*-------------------------------------------------------------------------*/
16#define MIME_VERSION "MIME 1.0.3" 16#define MIME_VERSION "MIME 1.0.3-rc1"
17#define MIME_COPYRIGHT "Copyright (C) 2004-2009 Diego Nehab" 17#define MIME_COPYRIGHT "Copyright (C) 2004-2012 Diego Nehab"
18#define MIME_AUTHORS "Diego Nehab" 18#define MIME_AUTHORS "Diego Nehab"
19 19
20/*-------------------------------------------------------------------------*\ 20/*-------------------------------------------------------------------------*\