aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2004-01-24 02:47:24 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2004-01-24 02:47:24 +0000
commit62a4c505e488c714e8795ea85564504562d30301 (patch)
treef270f53f26905b7275cea172e52ebc269a41c695 /doc
parent0c9f420a3549df3fb331bb24157b65a3301641d4 (diff)
downloadluasocket-62a4c505e488c714e8795ea85564504562d30301.tar.gz
luasocket-62a4c505e488c714e8795ea85564504562d30301.tar.bz2
luasocket-62a4c505e488c714e8795ea85564504562d30301.zip
Working on the manual...
Making better tests for error messages. Changed a few names. Moved gethostname to inet.c.
Diffstat (limited to 'doc')
-rw-r--r--doc/callback.html160
-rw-r--r--doc/code.html2
-rw-r--r--doc/dns.html4
-rw-r--r--doc/ftp.html4
-rw-r--r--doc/http.html4
-rw-r--r--doc/reference.css14
-rw-r--r--doc/reference.html298
-rw-r--r--doc/smtp.html2
-rw-r--r--doc/stream.html8
-rw-r--r--doc/tcp.html22
-rw-r--r--doc/udp.html18
-rw-r--r--doc/url.html2
12 files changed, 276 insertions, 262 deletions
diff --git a/doc/callback.html b/doc/callback.html
index 2c7ecd5..94af8ff 100644
--- a/doc/callback.html
+++ b/doc/callback.html
@@ -45,113 +45,72 @@ callback mechanism outlined below.
45</p> 45</p>
46 46
47<p> 47<p>
48Instead of returning the entire contents of an entity 48Instead of returning the received contents
49as strings to the Lua application, the library allows the user to 49as a big to the Lua application, the library allows the user to
50provide a <em>receive callback</em> that will be called with successive 50provide a <em>receive callback</em> that will be called with successive
51chunks of data, as the data becomes available. Conversely, the <em>send 51chunks of data, as the data becomes available. Conversely, the <em>send
52callbacks</em> can be used when the application wants to incrementally 52callback</em> mechanism can be used when the application wants to incrementally provide LuaSocket with the data to be sent.
53provide LuaSocket with the data to be sent.
54</p> 53</p>
55 54
56<!-- tohostname +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 55<!-- tohostname +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
57 56
58<p class=name id=receive_cb> 57<p class=name id=receive>
59ret, err_or_f = <b>receive_cb(</b>chunk, err<b>)</b> 58<b>receive_cb(</b>chunk, err<b>)</b>
60</p> 59</p>
61 60
62<p class=description> 61<p class=description>
63The callback provided by the user will be repeatedly called by the 62A receive callback will be repeatedly called by
64library whenever new data is available. Each time it is called, the 63LuaSocket wheneve new data is available. Each time it is called, the
65callback receives successive chunks of downloaded data. 64callback receives successive chunks of downloaded data.
66</p> 65</p>
67 66
68<p class=parameters> 67<p class=parameters>
69<tt>Chunk</tt> contains the current chunk of data. 68<tt>Chunk</tt> contains the latest downloaded chunk of data.
70When the transmission is over, the function is called with an 69When the transmission is over, the function is called with an
71empty string (i.e.&nbsp;<tt>""</tt>) as the <tt>chunk</tt>. 70empty string (i.e.&nbsp;<tt>""</tt>) in <tt>chunk</tt>.
72If an error occurs, the function receives <tt>nil</tt> 71If an error occurs, the function receives a <b><tt>nil</tt></b>
73as <tt>chunk</tt> and an error message in <tt>err</tt>. 72<tt>chunk</tt> and an error message in <tt>err</tt>.
74</p> 73</p>
75 74
76<p class=return> 75<p class=return>
77The callback can abort transmission by returning <tt>nil</tt> as its first 76The callback can abort transmission by returning <b><tt>nil</tt></b> as its first
78return value, and an optional error message as the 77return value, and an optional error message as the
79second return value. If the application wants to continue receiving 78second return value. To continue receiving
80data, the function should return non-<tt>nil</tt> as it's first return 79data, the function should return non-<b><tt>nil</tt></b> as its first return
81value. In this case, the function can optionally return a 80value. Optionally, in this case, it may return a
82new callback function, to replace itself, as the second return value. 81second return value, with a new callback function to take its place.
83</p>
84
85<p class=note>
86Note: The <tt>callback</tt> module provides several standard receive callbacks, including the following:
87</p>
88
89<pre class=example>
90function receive.concat(concat)
91 concat = concat or socket.concat.create()
92 local callback = function(chunk, err)
93 -- if not finished, add chunk
94 if chunk and chunk ~= "" then
95 concat:addstring(chunk)
96 return 1
97 end
98 end
99 return callback, concat
100end
101</pre>
102
103<p class=note>
104This function creates a new receive callback that concatenates all
105received chunks into a the same concat object, which can later be
106queried for its contents.
107</p> 82</p>
108 83
109<!-- send_cb ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 84<!-- send_cb ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
110 85
111<p class=name> 86<p class=name id=send>
112chunk, err_or_r = <b>send_cb()</b> 87<b>send_cb()</b>
113</p> 88</p>
114 89
115<p class=description> 90<p class=description>
116The callback provided by the user will be repeatedly called whenever the 91A send callback will be called whenever LuaSocket
117library needs more data to be sent. 92needs more data to be sent.
118</p> 93</p>
119 94
120<p class=return> 95<p class=return>
121Each time the callback is called, it should return the next chunk of data. It 96Each time the callback is called, it should return the next chunk of data. It
122can optionally return, as it's second return value, a new callback to replace 97can optionally return, as it's second return value, a new callback to replace
123itself. The callback can abort the process at any time by returning 98itself. The callback can abort the process at any time by returning
124<tt>nil</tt> followed by an optional error message. 99<b><tt>nil</tt></b> followed by an optional error message.
125</p>
126
127<p class=note>
128Note: Below is the implementation of the <tt>callback.send.file</tt>
129function. Given an open file handle, it returns a send callback that will send the contents of that file, chunk by chunk.
130</p> 100</p>
131 101
132<pre class=example>
133function send.file(file, io_err)
134 -- if successful, return the callback that reads from the file
135 if file then
136 return function()
137 -- send next block of data
138 return (file:read(BLOCKSIZE)) or ""
139 end
140 -- else, return a callback that just aborts the transfer
141 else return fail(io_err or "unable to open file") end
142end
143</pre>
144
145<!-- predefined +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 102<!-- predefined +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
146 103
147<h2 id=predefined>Predefined Callbacks</h2> 104<h2 id=predefined>Predefined Callbacks</h2>
148 105
149<p> 106<p>
150The module <tt>callback.lua</tt> provides several predefined callbacks to 107The Callback module provides several predefined callbacks to
151perform the most common input/output operations. Callbacks are provided 108perform the most common input/output operations. Callbacks are provided
152that send and receive contents of files and strings. Furthermore, 109that send and receive contents of files and strings. Furthermore,
153composition functions are provided to chain callbacks with filters, such as 110composition functions are provided to chain callbacks with filters, such as
154the filters defined in the <tt>mime.lua</tt> module. 111the filters defined in the <a href=mime.html>MIME</a> module.
112Together, these two modules provide a powerful interface to send and
113receive information.
155</p> 114</p>
156 115
157<!-- send.file ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 116<!-- send.file ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
@@ -161,15 +120,16 @@ the filters defined in the <tt>mime.lua</tt> module.
161</p> 120</p>
162 121
163<p class=description> 122<p class=description>
164This function creates a send callback that will return the contents 123This function creates a send callback that returns the contents
165of a the file, until the file has been entirely sent. When done, the 124of a file, chunk by chunk, until the file has been entirely sent.
166callback closes the file. 125When done, the callback closes the file.
167</p> 126</p>
168 127
169<p class=parameters> 128<p class=parameters>
170<tt>File</tt> is a file open for reading. If <tt>file</tt> is 129<tt>File</tt> is a file opened for reading. If <tt>file</tt> is
171<tt>nil</tt>, <tt>io_err</tt> can contain an error message and the 130<b><tt>nil</tt></b>, <tt>io_err</tt> can contain an error message. In this
172returned callback just aborts transmission with the error message. 131case, the function returns a callback that just aborts
132transmission with the error message.
173</p> 133</p>
174 134
175<p class=return> 135<p class=return>
@@ -177,14 +137,14 @@ Returns a send callback for the file.
177</p> 137</p>
178 138
179<p class=note> 139<p class=note>
180Note: The function is designed so that it directly accepts the return 140Note: This function is designed so that it directly accepts the return
181values of the <tt>io.open</tt> function. 141values of the <tt>io.open</tt> function.
182</p> 142</p>
183 143
184<!-- send.string ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 144<!-- send.string ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
185 145
186<p class=name id=send.string> 146<p class=name id=send.string>
187<b>send.string(</b>str<b>)</b> 147<b>send.string(</b>str, err<b>)</b>
188</p> 148</p>
189 149
190<p class=description> 150<p class=description>
@@ -193,29 +153,33 @@ the contents of a string.
193</p> 153</p>
194 154
195<p class=parameters> 155<p class=parameters>
196<tt>Str</tt> is the string to be sent. 156<tt>Str</tt> is the string to be sent.
157<!--
158If <tt>str</tt> is
159<b><tt>nil</tt></b>, <tt>err</tt> can optionally contain an error message.
160-->
197</p> 161</p>
198 162
199<p class=return> 163<p class=return>
200Returns a send callback for the string, or <tt>nil</tt> if the string is 164Returns a send callback for the string, or <b><tt>nil</tt></b> if the string is
201<tt>nil</tt>. 165<b><tt>nil</tt></b>.
202</p> 166</p>
203 167
204<p class=note> 168<p class=note>
205Note: If any function in the LuaSocket API receives a <tt>nil</tt> 169Note: A <tt>nil</tt></b>
206send callback, it assumes there is nothing to be sent. 170send callback is equivalent to a callback that returns the empty string.
207</p> 171</p>
208 172
209<!-- send.chain ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 173<!-- send.chain ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
210 174
211<p class=name id=send.string> 175<p class=name id=send.chain>
212<b>send.chain(</b>send_cb, filter<b>)</b> 176<b>send.chain(</b>send_cb, filter<b>)</b>
213</p> 177</p>
214 178
215<p class=description> 179<p class=description>
216This function creates a send callback that will send 180This function creates a send callback that will filter
217all data that it gets from another callback, 181all the data it receives from another send callback, before
218after passing the data through a filter. 182sending it through.
219</p> 183</p>
220 184
221<p class=parameters> 185<p class=parameters>
@@ -226,7 +190,29 @@ after passing the data through a filter.
226Returns a callback chained with the filter. 190Returns a callback chained with the filter.
227</p> 191</p>
228 192
229(write a note!) 193<p class=note>
194Note: Several filters are defined in the <a href=mime.html>MIME</a>
195module. Below is an example that creates a send callback that sends
196a file's contents encoded in the Base64 transfer content encoding.
197</p>
198
199<pre class=example>
200send_cb = socket.callback.send.chain(
201 socket.callback.send.file(io.open("input.bin"))
202 socket.mime.chain(
203 socket.mime.encode("base64"),
204 socket.mime.wrap("base64")
205 )
206)
207</pre>
208
209<p class=note>
210The call to <a href=mime.html#chain><tt>socket.mime.chain</tt></a>
211creates a chained filter that encodes it's input and then breaks it
212into lines. The call to <tt>socket.callback.chain</tt> creates a chained
213send callback that reads the file from disk and passes it through the
214filter before sending it.
215</p>
230 216
231<!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 217<!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
232 218
diff --git a/doc/code.html b/doc/code.html
index 45fd21a..4668b7a 100644
--- a/doc/code.html
+++ b/doc/code.html
@@ -59,7 +59,7 @@ Applies the Base 64 content coding to a string.
59<p class=parameters> 59<p class=parameters>
60<tt>Content</tt> is the string to be encoded. 60<tt>Content</tt> is the string to be encoded.
61If <tt>single</tt> is set to anything 61If <tt>single</tt> is set to anything
62but <tt>nil</tt>, the output is returned as a single 62but <b><tt>nil</tt></b>, the output is returned as a single
63line, otherwise the function splits the content into 76 character long 63line, otherwise the function splits the content into 76 character long
64lines after encoding. 64lines after encoding.
65</p> 65</p>
diff --git a/doc/dns.html b/doc/dns.html
index 6abf341..17cee45 100644
--- a/doc/dns.html
+++ b/doc/dns.html
@@ -70,7 +70,7 @@ Converts from IP address to host name.
70<p class=return> 70<p class=return>
71The function a string with the canonic host name of the given 71The function a string with the canonic host name of the given
72<tt>address</tt>, followed by a table with all information returned by 72<tt>address</tt>, followed by a table with all information returned by
73the resolver. In case of error, the function returns <tt>nil</tt> 73the resolver. In case of error, the function returns <b><tt>nil</tt></b>
74followed by an error message. 74followed by an error message.
75</p> 75</p>
76 76
@@ -92,7 +92,7 @@ Converts from host name to IP address.
92<p class=return> 92<p class=return>
93Returns a string with the first IP address found for <tt>address</tt>, 93Returns a string with the first IP address found for <tt>address</tt>,
94followed by a table with all information returned by the resolver. 94followed by a table with all information returned by the resolver.
95In case of error, the function returns <tt>nil</tt> followed by an error 95In case of error, the function returns <b><tt>nil</tt></b> followed by an error
96message. 96message.
97</p> 97</p>
98 98
diff --git a/doc/ftp.html b/doc/ftp.html
index 8072afe..6776a17 100644
--- a/doc/ftp.html
+++ b/doc/ftp.html
@@ -88,7 +88,7 @@ determines the transfer type. If <tt>&lt;path&gt;</tt> ends with a
88<p class=return> 88<p class=return>
89If successful, the function returns 89If successful, the function returns
90the file content as a string. In case of error, the function returns 90the file content as a string. In case of error, the function returns
91<tt>nil</tt> and an error message describing the error. 91<b><tt>nil</tt></b> and an error message describing the error.
92</p> 92</p>
93 93
94<pre class=example> 94<pre class=example>
@@ -165,7 +165,7 @@ function tries to log in as '<tt>anonymous</tt>'.
165 165
166<p class=return> 166<p class=return>
167If successful, the function returns 1. In case of error, the 167If successful, the function returns 1. In case of error, the
168function returns <tt>nil</tt> followed by a string describing the error. 168function returns <b><tt>nil</tt></b> followed by a string describing the error.
169</p> 169</p>
170 170
171<pre class=example> 171<pre class=example>
diff --git a/doc/http.html b/doc/http.html
index b7469a4..f977ea9 100644
--- a/doc/http.html
+++ b/doc/http.html
@@ -203,7 +203,7 @@ request message. If authentication information is provided, the function
203uses the Basic Authentication Scheme (see <a href="#authentication">note</a>) 203uses the Basic Authentication Scheme (see <a href="#authentication">note</a>)
204to retrieve the document. <tt>User</tt> and <tt>password</tt> provided 204to retrieve the document. <tt>User</tt> and <tt>password</tt> provided
205explicitly override those given by the <tt>url</tt>. The <tt>stay</tt> 205explicitly override those given by the <tt>url</tt>. The <tt>stay</tt>
206parameter, when set to anything but <tt>nil</tt>, prevents the function 206parameter, when set to anything but <b><tt>nil</tt></b>, prevents the function
207from automatically following 301 or 302 server redirect messages. 207from automatically following 301 or 302 server redirect messages.
208</p> 208</p>
209 209
@@ -333,7 +333,7 @@ Authentication Scheme (see <a href="#authentication">note</a>) to
333retrieve the document. <tt>Request.user</tt> and 333retrieve the document. <tt>Request.user</tt> and
334<tt>request.password</tt> override those given by the 334<tt>request.password</tt> override those given by the
335<tt>request.url</tt>. The <tt>request.stay</tt> parameter, when set to 335<tt>request.url</tt>. The <tt>request.stay</tt> parameter, when set to
336anything but <tt>nil</tt>, prevents the function from automatically 336anything but <b><tt>nil</tt></b>, prevents the function from automatically
337following 301 or 302 server redirect messages. 337following 301 or 302 server redirect messages.
338</p> 338</p>
339 339
diff --git a/doc/reference.css b/doc/reference.css
index 2a8987e..607ac4f 100644
--- a/doc/reference.css
+++ b/doc/reference.css
@@ -1,11 +1,19 @@
1body { margin-left: 1em; margin-right: 1em; } 1body {
2 margin-left: 1em;
3 margin-right: 1em;
4 font-family: "Verdana";
5}
6
7tt {
8 font-family: "Andale Mono", monospace;
9}
2 10
3h1, h2, h3, h4 { margin-left: 0em; } 11h1, h2, h3, h4 { margin-left: 0em; }
4 12
5p { margin-left: 1em; } 13p { margin-left: 1em; }
6 14
7p.name { 15p.name {
8 font-family: monospace; 16 font-family: "Andale Mono", monospace;
9 padding-top: 1em; 17 padding-top: 1em;
10 margin-left: 0em; 18 margin-left: 0em;
11} 19}
@@ -18,6 +26,8 @@ pre.example {
18 background: #ccc; 26 background: #ccc;
19 padding: 1em; 27 padding: 1em;
20 margin-left: 1em; 28 margin-left: 1em;
29 font-family: "Andale Mono", monospace;
30 font-size: small;
21} 31}
22 32
23hr { 33hr {
diff --git a/doc/reference.html b/doc/reference.html
index 99b1ea7..0bfd378 100644
--- a/doc/reference.html
+++ b/doc/reference.html
@@ -35,155 +35,173 @@
35 35
36<h2>Reference</h2> 36<h2>Reference</h2>
37 37
38<!-- tcp +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 38<!-- callback +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
39 39
40<table summary="TCP Index" class=index width=100%> 40<blockquote>
41<colgroup> <col width="50%"> <col width="50%"> </colgroup> 41<a href="callback.html">Callbacks (socket.callback)</a>
42<tr> 42<blockquote>
43<td><ul> 43<a href="callback.html#send">send</a>:
44<li><a href="tcp.html">TCP (socket.tcp)</a> 44<a href="callback.html#send.chain">chain</a>,
45 <ul> 45<a href="callback.html#send.file">file</a>,
46 <li><a href="tcp.html#accept">accept</a> 46<a href="callback.html#send.string">string</a>.
47 <li><a href="tcp.html#bind">bind</a> 47</blockquote>
48 <li><a href="tcp.html#close">close</a> 48<blockquote>
49 <li><a href="tcp.html#connect">connect</a> 49<a href="callback.html#receive">receive</a>:
50 <li><a href="tcp.html#getpeername">getpeername</a> 50<a href="callback.html#receive.chain">chain</a>,
51 </ul> 51<a href="callback.html#receive.file">file</a>,
52</ul></td> 52<a href="callback.html#receive.concat">concat</a>.
53<td valign=top><ul> 53</blockquote>
54 <li><a href="tcp.html#getsockname">getsockname</a> 54</blockquote>
55 <li><a href="tcp.html#receive">receive</a>
56 <li><a href="tcp.html#send">send</a>
57 <li><a href="tcp.html#setoption">setoption</a>
58 <li><a href="tcp.html#settimeout">settimeout</a>
59</ul></td>
60</tr>
61</table> 55</table>
62 56
63<hr> 57<!-- dns ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
64 58
65<!-- udp +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 59<blockquote>
66 60<a href="dns.html">DNS services (socket.dns)</a>
67<table summary="UDP Index" class=index width=100%> 61<blockquote>
68<colgroup> <col width="50%"> <col width="50%"> </colgroup> 62<a href="dns.html#toip">toip</a>,
69<tr> 63<a href="dns.html#tohostname">tohostname</a>,
70<td><ul> 64<a href="dns.html#gethostname">gethostname</a>.
71<li><a href="udp.html">UDP (socket.udp)</a> 65</blockquote>
72 <ul> 66</blockquote>
73 <li><a href="udp.html#close">close</a> 67
74 <li><a href="udp.html#getpeername">getpeername</a> 68<!-- ftp ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
75 <li><a href="udp.html#getsockname">getsockname</a> 69
76 <li><a href="udp.html#receive">receive</a> 70<blockquote>
77 <li><a href="udp.html#receivefrom">receivefrom</a> 71<a href="ftp.html">FTP (socket.ftp)</a>
78 </ul> 72<blockquote>
79</ul></td> 73<a href="ftp.html#get">get</a>,
80<td><ul> 74<a href="ftp.html#get_cb">get_cb</a>,
81 <li><a href="udp.html#send">send</a> 75<a href="ftp.html#put">put</a>,
82 <li><a href="udp.html#sendto">sendto</a> 76<a href="ftp.html#put_cb">put_cb</a>.
83 <li><a href="udp.html#setpeername">setpeername</a> 77</blockquote>
84 <li><a href="udp.html#setsockname">setsockname</a> 78</blockquote>
85 <li><a href="udp.html#setoption">setoption</a> 79
86 <li><a href="udp.html#settimeout">settimeout</a> 80<!-- misc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
87</ul></td> 81
88</tr> 82<blockquote>
89</table> 83<a href="global.html">Globals (socket)</a>
90 84<blockquote>
91<hr> 85<a href="global.html#bind">bind</a>,
92 86<a href="global.html#callback">callback</a>,
93<!-- http & ftp ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 87<a href="global.html#concat">concat</a>,
94 88<a href="global.html#connect">connect</a>,
95<table summary="HTTP and FTP Index" class=index width=100%> 89<a href="global.html#debug">debug</a>,
96<colgroup> <col width="50%"> <col width="50%"> </colgroup> 90<a href="global.html#dns">dns</a>,
97<tr> 91<a href="global.html#ftp">ftp</a>,
98<td valign=top><ul> 92<a href="global.html#http">http</a>,
99<li><a href="http.html">HTTP (socket.http)</a> 93<a href="global.html#mime">mime</a>,
100 <ul> 94<a href="global.html#select">select</a>,
101 <li><a href="http.html#get">get</a> 95<a href="global.html#sleep">sleep</a>,
102 <li><a href="http.html#post">post</a> 96<a href="global.html#smtp">smtp</a>,
103 <li><a href="http.html#request">request</a> 97<a href="global.html#time">time</a>,
104 <li><a href="http.html#request_cb">request_cb</a> 98<a href="global.html#tcp">tcp</a>.
105 </ul> 99<a href="global.html#udp">udp</a>,
106</ul></td> 100<a href="global.html#url">url</a>,
107<td valign=top><ul> 101<a href="global.html#version">version</a>.
108<li><a href="ftp.html">FTP (socket.ftp)</a> 102</blockquote>
109 <ul> 103</blockquote>
110 <li><a href="ftp.html#get">get</a>
111 <li><a href="ftp.html#get_cb">get_cb</a>
112 <li><a href="ftp.html#put">put</a>
113 <li><a href="ftp.html#put_cb">put_cb</a>
114 </ul>
115</ul></td>
116</tr>
117</table> 104</table>
118 105
119<hr>
120 106
121<!-- http & ftp ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 107<!-- http +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
122 108
123<table summary="Streaming Index" class=index width=100%> 109<blockquote>
124<colgroup> <col width="50%"> <col width="50%"> </colgroup> 110<a href="http.html">HTTP (socket.http)</a>
125<tr><td valign=top><ul> 111<blockquote>
126<li><a href="stream.html">Streaming with Callbacks</a> 112<a href="http.html#get">get</a>,
127 <ul> 113<a href="http.html#post">post</a>,
128 <li><a href="stream.html#receive_cb">receive_cb</a> 114<a href="http.html#request">request</a>,
129 <li><a href="stream.html#send_cb">send_cb</a> 115<a href="http.html#request_cb">request_cb</a>.
130 </ul> 116</blockquote>
131</ul></td></tr> 117</blockquote>
132</table> 118
119<!-- mime +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
120
121<blockquote>
122<a href="mime.html">MIME (socket.mime) </a>
123<blockquote>
124<a href="mime.html#filters">filters</a>:
125<a href="mime.html#decode">canonic</a>,
126<a href="mime.html#chain">chain</a>,
127<a href="mime.html#decode">decode</a>,
128<a href="mime.html#encode">encode</a>,
129<a href="mime.html#wrap">wrap</a>.
130</blockquote>
131<blockquote>
132<a href="mime.html#low-level">low-level</a>:
133<a href="mime.html#b64">b64</a>,
134<a href="mime.html#unb64">unb64</a>,
135<a href="mime.html#eol">eol</a>,
136<a href="mime.html#qp">qp</a>,
137<a href="mime.html#unqp">unqp</a>,
138<a href="mime.html#wrp">wrp</a>,
139<a href="mime.html#qpwrp">qpwrp</a>.
140</blockquote>
141</blockquote>
142
143<!-- smtp +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
144
145<blockquote>
146<a href="smtp.html">SMTP (socket.smtp)</a>
147<blockquote>
148<a href="smtp.html#mail">mail</a>
149</blockquote>
150</blockquote>
133 151
134<hr> 152<!-- tcp +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
135 153
136<!-- smtp & dns ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 154<blockquote>
137 155<a href="tcp.html">TCP (socket.tcp)</a>
138<table summary="SMTP and DNS Index" class=index width=100%> 156<blockquote>
139<colgroup> <col width="50%"> <col width="50%"> </colgroup> 157<a href="tcp.html#accept">accept</a>,
140<tr> 158<a href="tcp.html#bind">bind</a>,
141<td><ul> 159<a href="tcp.html#close">close</a>,
142<li><a href="smtp.html">SMTP (socket.smtp)</a> 160<a href="tcp.html#connect">connect</a>,
143 <ul> 161<a href="tcp.html#getpeername">getpeername</a>,
144 <li> <a href="smtp.html#mail">mail</a> 162<a href="tcp.html#getsockname">getsockname</a>,
145 </ul> 163<a href="tcp.html#receive">receive</a>,
146</ul></td> 164<a href="tcp.html#send">send</a>,
147<td><ul> 165<a href="tcp.html#setoption">setoption</a>,
148<li><a href="dns.html">DNS services (socket.dns)</a> 166<a href="tcp.html#settimeout">settimeout</a>,
149 <ul> 167<a href="tcp.html#shutdown">shutdown</a>.
150 <li><a href="dns.html#toip">toip</a> 168</blockquote>
151 <li><a href="dns.html#tohostname">tohostname</a> 169</blockquote>
152 </ul>
153</ul></td>
154</tr>
155</table>
156 170
157<hr> 171<!-- udp +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
158 172
159<!-- url & code ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 173<blockquote>
160 174<a href="udp.html">UDP (socket.udp)</a>
161<table summary="URL and Code Index" class=index width=100%> 175<blockquote>
162<colgroup> <col width="50%"> <col width="50%"> </colgroup> 176<a href="udp.html#close">close</a>,
163<tr> 177<a href="udp.html#getpeername">getpeername</a>,
164<td valign=top><ul> 178<a href="udp.html#getsockname">getsockname</a>,
165<li><a href="url.html">URL (socket.url) </a> 179<a href="udp.html#receive">receive</a>,
166 <ul> 180<a href="udp.html#receivefrom">receivefrom</a>,
167 <li> <a href="url.html#absolute">absolute</a> 181<a href="udp.html#send">send</a>,
168 <li> <a href="url.html#build">build</a> 182<a href="udp.html#sendto">sendto</a>,
169 <li> <a href="url.html#build_path">build_path</a> 183<a href="udp.html#setpeername">setpeername</a>,
170 <li> <a href="url.html#parse">parse</a> 184<a href="udp.html#setsockname">setsockname</a>,
171 <li> <a href="url.html#parse_path">parse_path</a> 185<a href="udp.html#setoption">setoption</a>,
172 </ul> 186<a href="udp.html#settimeout">settimeout</a>,
173</ul></td> 187<a href="udp.html#settimeout">shutdown</a>.
174<td valign=top><ul> 188</blockquote>
175<li> <a href="code.html">Code (socket.code) </a> 189</blockquote>
176 <ul> 190
177 <li> <a href="code.html#base64">base64</a> 191<!-- url ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
178 <li> <a href="code.html#unbase64">unbase64</a> 192
179 <li> <a href="code.html#escape">escape</a> 193<blockquote>
180 <li> <a href="code.html#unescape">unescape</a> 194<a href="url.html">URL (socket.url) </a>
181 <li> <a href="code.html#hexa">hexa</a> 195<blockquote>
182 <li> <a href="code.html#unhexa">unhexa</a> 196<a href="url.html#absolute">absolute</a>,
183 </ul> 197<a href="url.html#build">build</a>,
184</ul></td> 198<a href="url.html#build_path">build_path</a>,
185</tr> 199<a href="url.html#quote">quote</a>,
186</table> 200<a href="url.html#parse">parse</a>,
201<a href="url.html#parse_path">parse_path</a>,
202<a href="url.html#quote">unquote</a>.
203</blockquote>
204</blockquote>
187 205
188<!-- footer ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 206<!-- footer ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
189 207
diff --git a/doc/smtp.html b/doc/smtp.html
index aa92149..0862de0 100644
--- a/doc/smtp.html
+++ b/doc/smtp.html
@@ -105,7 +105,7 @@ and text <tt>body</tt>. The message is sent using the server
105 105
106<p class=return> 106<p class=return>
107If successful, the function returns 1. Otherwise, the function returns 107If successful, the function returns 1. Otherwise, the function returns
108<tt>nil</tt> followed by an error message. 108<b><tt>nil</tt></b> followed by an error message.
109</p> 109</p>
110 110
111<p class=note> 111<p class=note>
diff --git a/doc/stream.html b/doc/stream.html
index b88cbb5..585ad18 100644
--- a/doc/stream.html
+++ b/doc/stream.html
@@ -69,15 +69,15 @@ callback receives successive chunks of downloaded data.
69<tt>Chunk</tt> contains the current chunk of data. 69<tt>Chunk</tt> contains the current chunk of data.
70When the transmission is over, the function is called with an 70When the transmission is over, the function is called with an
71empty string (i.e.&nbsp;<tt>""</tt>) as the <tt>chunk</tt>. 71empty string (i.e.&nbsp;<tt>""</tt>) as the <tt>chunk</tt>.
72If an error occurs, the function receives <tt>nil</tt> 72If an error occurs, the function receives <b><tt>nil</tt></b>
73as <tt>chunk</tt> and an error message in <tt>err</tt>. 73as <tt>chunk</tt> and an error message in <tt>err</tt>.
74</p> 74</p>
75 75
76<p class=return> 76<p class=return>
77The callback can abort transmission by returning <tt>nil</tt> as its first 77The callback can abort transmission by returning <b><tt>nil</tt></b> as its first
78return value, and an optional error message as the 78return value, and an optional error message as the
79second return value. If the application wants to continue receiving 79second return value. If the application wants to continue receiving
80data, the function should return non-<tt>nil</tt> as it's first return 80data, the function should return non-<b><tt>nil</tt></b> as it's first return
81value. In this case, the function can optionally return a 81value. In this case, the function can optionally return a
82new callback function, to replace itself, as the second return value. 82new callback function, to replace itself, as the second return value.
83</p> 83</p>
@@ -121,7 +121,7 @@ library needs more data to be sent.
121Each time the callback is called, it should return the next chunk of data. It 121Each time the callback is called, it should return the next chunk of data. It
122can optionally return, as it's second return value, a new callback to replace 122can optionally return, as it's second return value, a new callback to replace
123itself. The callback can abort the process at any time by returning 123itself. The callback can abort the process at any time by returning
124<tt>nil</tt> followed by an optional error message. 124<b><tt>nil</tt></b> followed by an optional error message.
125</p> 125</p>
126 126
127<p class=note> 127<p class=note>
diff --git a/doc/tcp.html b/doc/tcp.html
index 0be535a..eb4cdfa 100644
--- a/doc/tcp.html
+++ b/doc/tcp.html
@@ -51,7 +51,7 @@ method.</p>
51 51
52<p class=return> 52<p class=return>
53In case of success, a new master object is returned. In case of error, 53In case of success, a new master object is returned. In case of error,
54<tt>nil</tt> is returned, followed by an error message. 54<b><tt>nil</tt></b> is returned, followed by an error message.
55</p> 55</p>
56 56
57<!-- accept +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 57<!-- accept +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
@@ -67,7 +67,7 @@ object and returns a client object representing that connection.
67 67
68<p class=return> 68<p class=return>
69If a connection is successfully initiated, a client object is returned. 69If a connection is successfully initiated, a client object is returned.
70If a timeout condition is met, the method returns <tt>nil</tt> followed 70If a timeout condition is met, the method returns <b><tt>nil</tt></b> followed
71by the error string '<tt>timeout</tt>'. 71by the error string '<tt>timeout</tt>'.
72</p> 72</p>
73 73
@@ -111,7 +111,7 @@ attempts connection, the connection is refused.
111 111
112<p class=return> 112<p class=return>
113In case of success, the method returns 1. In case of error, the 113In case of success, the method returns 1. In case of error, the
114method returns <tt>nil</tt> followed by an error message. 114method returns <b><tt>nil</tt></b> followed by an error message.
115</p> 115</p>
116 116
117<p class=note> 117<p class=note>
@@ -165,7 +165,7 @@ and <a href=#close><tt>close</tt></a>.
165</p> 165</p>
166 166
167<p class=return> 167<p class=return>
168In case of error, the method returns <tt>nil</tt> followed by a string 168In case of error, the method returns <b><tt>nil</tt></b> followed by a string
169describing the error. In case of success, the method returns 1. 169describing the error. In case of success, the method returns 1.
170</p> 170</p>
171 171
@@ -187,7 +187,7 @@ Returns information about the remote side of a connected client object.
187<p class=return> 187<p class=return>
188Returns a string with the IP address of the peer, followed by the 188Returns a string with the IP address of the peer, followed by the
189port number that peer is using for the connection. 189port number that peer is using for the connection.
190In case of error, the method returns <tt>nil</tt>. 190In case of error, the method returns <b><tt>nil</tt></b>.
191</p> 191</p>
192 192
193<p class=note> 193<p class=note>
@@ -207,7 +207,7 @@ Returns the local address information associated to the object.
207 207
208<p class=return> 208<p class=return>
209The method returns a string with local IP address and a number with 209The method returns a string with local IP address and a number with
210the port. In case of error, the method returns <tt>nil</tt>. 210the port. In case of error, the method returns <b><tt>nil</tt></b>.
211</p> 211</p>
212 212
213<p class=note> 213<p class=note>
@@ -248,7 +248,7 @@ bytes from the socket.
248 248
249<p class=return> 249<p class=return>
250The method returns one value for each pattern, followed by a single 250The method returns one value for each pattern, followed by a single
251error code that can be <tt>nil</tt> in case of success, the string 251error code that can be <b><tt>nil</tt></b> in case of success, the string
252'<tt>closed</tt>' in case the connection was closed before the 252'<tt>closed</tt>' in case the connection was closed before the
253transmission was completed or the string '<tt>timeout</tt>' in case 253transmission was completed or the string '<tt>timeout</tt>' in case
254there was a timeout during the operation. 254there was a timeout during the operation.
@@ -278,7 +278,7 @@ result to LuaSocket instead of passing several independent strings.
278 278
279<p class=return> 279<p class=return>
280The method returns the number of bytes accepted by the transport layer, 280The method returns the number of bytes accepted by the transport layer,
281followed by an error code. The error code is <tt>nil</tt> if the operation 281followed by an error code. The error code is <b><tt>nil</tt></b> if the operation
282completed with no errors, the string '<tt>closed</tt>' in case 282completed with no errors, the string '<tt>closed</tt>' in case
283the connection was closed before the transmission was completed or the 283the connection was closed before the transmission was completed or the
284string '<tt>timeout</tt>' in case there was a timeout during the 284string '<tt>timeout</tt>' in case there was a timeout during the
@@ -288,7 +288,7 @@ operation.
288<p class=note> 288<p class=note>
289Note: The return values for the <tt>send</tt> method have been changed in 289Note: The return values for the <tt>send</tt> method have been changed in
290LuaSocket 2.0! In previous versions, the method returned only the 290LuaSocket 2.0! In previous versions, the method returned only the
291error message. Since returning <tt>nil</tt> in case of success goes 291error message. Since returning <b><tt>nil</tt></b> in case of success goes
292against all other LuaSocket methods and functions, the 292against all other LuaSocket methods and functions, the
293<tt>send</tt> method been changed for the sake of uniformity. 293<tt>send</tt> method been changed for the sake of uniformity.
294</p> 294</p>
@@ -330,7 +330,7 @@ considered broken and processes using the socket are notified.
330</ul> 330</ul>
331 331
332<p class=return> 332<p class=return>
333The method returns 1 in case of success, or <tt>nil</tt> otherwise. 333The method returns 1 in case of success, or <b><tt>nil</tt></b> otherwise.
334</p> 334</p>
335 335
336<p class=note> 336<p class=note>
@@ -374,7 +374,7 @@ a call.</li>
374</ul> 374</ul>
375 375
376<p class=parameters> 376<p class=parameters>
377The <tt>nil</tt> timeout <tt>value</tt> allows operations to block 377The <b><tt>nil</tt></b> timeout <tt>value</tt> allows operations to block
378indefinitely. Negative timeout values have the same effect. 378indefinitely. Negative timeout values have the same effect.
379</p> 379</p>
380 380
diff --git a/doc/udp.html b/doc/udp.html
index 7f2ecce..9f5cf8f 100644
--- a/doc/udp.html
+++ b/doc/udp.html
@@ -52,7 +52,7 @@ is used to connect the object.
52 52
53<p class="return"> 53<p class="return">
54In case of success, a new unconnected UDP object 54In case of success, a new unconnected UDP object
55returned. In case of error, <tt>nil</tt> is returned, followed by 55returned. In case of error, <b><tt>nil</tt></b> is returned, followed by
56an error message. 56an error message.
57</p> 57</p>
58 58
@@ -112,7 +112,7 @@ Returns the local address information associated to the object.
112<p class="return"> 112<p class="return">
113The method returns a string with local IP 113The method returns a string with local IP
114address and a number with the port. In case of error, the method 114address and a number with the port. In case of error, the method
115returns <tt>nil</tt>. 115returns <b><tt>nil</tt></b>.
116</p> 116</p>
117 117
118<p class="note"> 118<p class="note">
@@ -150,7 +150,7 @@ maximum datagram size is used.
150<p class="return"> 150<p class="return">
151In case of success, the method return the 151In case of success, the method return the
152received datagram. In case of timeout, the method returns 152received datagram. In case of timeout, the method returns
153<tt>nil</tt> followed by the string '<tt>timeout</tt>'. 153<b><tt>nil</tt></b> followed by the string '<tt>timeout</tt>'.
154</p> 154</p>
155 155
156<!-- receivefrom +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 156<!-- receivefrom +++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
@@ -183,7 +183,7 @@ Beware that the maximum datagram size for UDP is 576 bytes.
183 183
184<p class="return"> 184<p class="return">
185If successful, the method returns 1. In case of 185If successful, the method returns 1. In case of
186error, the method returns <tt>nil</tt> followed by the 186error, the method returns <b><tt>nil</tt></b> followed by the
187'<tt>refused</tt>' message. 187'<tt>refused</tt>' message.
188</p> 188</p>
189 189
@@ -214,7 +214,7 @@ names are <em>not</em> allowed for performance reasons.
214 214
215<p class="return"> 215<p class="return">
216If successful, the method returns 1. In case of 216If successful, the method returns 1. In case of
217error, the method returns <tt>nil</tt> followed by the 217error, the method returns <b><tt>nil</tt></b> followed by the
218'<tt>refused</tt>' message. 218'<tt>refused</tt>' message.
219</p> 219</p>
220 220
@@ -258,7 +258,7 @@ case, the <tt>port</tt> argument is ignored.
258 258
259<p class="return"> 259<p class="return">
260In case of error the method returns 260In case of error the method returns
261<tt>nil</tt> followed by an error message. In case of success, the 261<b><tt>nil</tt></b> followed by an error message. In case of success, the
262method returns 1. 262method returns 1.
263</p> 263</p>
264 264
@@ -288,7 +288,7 @@ all local interfaces using the constant <tt>INADDR_ANY</tt>. If
288 288
289<p class="return"> 289<p class="return">
290If successful, the method returns 1. In case of 290If successful, the method returns 1. In case of
291error, the method returns <tt>nil</tt> followed by an error 291error, the method returns <b><tt>nil</tt></b> followed by an error
292message. 292message.
293</p> 293</p>
294 294
@@ -328,7 +328,7 @@ socket.</li>
328 328
329<p class="return"> 329<p class="return">
330The method returns 1 in case of success, or 330The method returns 1 in case of success, or
331<tt>nil</tt> followed by an error message otherwise. 331<b><tt>nil</tt></b> followed by an error message otherwise.
332</p> 332</p>
333 333
334<p class="note"> 334<p class="note">
@@ -356,7 +356,7 @@ give up and fail with an error code.
356 356
357<p class="parameters"> 357<p class="parameters">
358The amount of time to wait is specified as 358The amount of time to wait is specified as
359the <tt>value</tt> parameter, in seconds. The <tt>nil</tt> timeout 359the <tt>value</tt> parameter, in seconds. The <b><tt>nil</tt></b> timeout
360<tt>value</tt> allows operations to block indefinitely. Negative 360<tt>value</tt> allows operations to block indefinitely. Negative
361timeout values have the same effect. 361timeout values have the same effect.
362</p> 362</p>
diff --git a/doc/url.html b/doc/url.html
index e67ea13..0eafafa 100644
--- a/doc/url.html
+++ b/doc/url.html
@@ -148,7 +148,7 @@ component.
148 148
149<p class=parameters> 149<p class=parameters>
150<tt>Segments</tt> is a list of strings with the <tt>&lt;segment&gt;</tt> 150<tt>Segments</tt> is a list of strings with the <tt>&lt;segment&gt;</tt>
151parts. If <tt>unsafe</tt> is anything but <tt>nil</tt>, reserved 151parts. If <tt>unsafe</tt> is anything but <b><tt>nil</tt></b>, reserved
152characters are left untouched. 152characters are left untouched.
153</p> 153</p>
154 154