aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2004-06-16 20:41:03 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2004-06-16 20:41:03 +0000
commitba2f0b8c6ba7fb3a26fa6d9676ee1aefe6d873cc (patch)
tree1a49ac4a3c74b9d3bf8e4220d4bf9c48641f3dbc
parent0a4c1534f39511894728da193ab8225ad6022de9 (diff)
downloadluasocket-ba2f0b8c6ba7fb3a26fa6d9676ee1aefe6d873cc.tar.gz
luasocket-ba2f0b8c6ba7fb3a26fa6d9676ee1aefe6d873cc.tar.bz2
luasocket-ba2f0b8c6ba7fb3a26fa6d9676ee1aefe6d873cc.zip
Fine tuning the manual...
-rw-r--r--doc/ftp.html23
-rw-r--r--doc/http.html28
-rw-r--r--doc/index.html18
-rw-r--r--doc/introduction.html2
-rw-r--r--doc/ltn12.html3
-rw-r--r--doc/mime.html19
-rw-r--r--doc/smtp.html77
-rw-r--r--doc/socket.html42
8 files changed, 129 insertions, 83 deletions
diff --git a/doc/ftp.html b/doc/ftp.html
index 9fda02b..7ad5e4d 100644
--- a/doc/ftp.html
+++ b/doc/ftp.html
@@ -54,7 +54,8 @@ To really benefit from this module, a good understanding of
54LTN012, Filters sources and sinks</a> is necessary. 54LTN012, Filters sources and sinks</a> is necessary.
55</p> 55</p>
56 56
57<p class=description> To obtain the <tt>ftp</tt> namespace, run: 57<p>
58To obtain the <tt>ftp</tt> namespace, run:
58</p> 59</p>
59 60
60<pre class=example> 61<pre class=example>
@@ -99,7 +100,7 @@ ftp.<b>get{</b><br>
99&nbsp;&nbsp;[command = <i>string</i>,]<br> 100&nbsp;&nbsp;[command = <i>string</i>,]<br>
100&nbsp;&nbsp;[port = <i>number</i>,]<br> 101&nbsp;&nbsp;[port = <i>number</i>,]<br>
101&nbsp;&nbsp;[type = <i>string</i>,]<br> 102&nbsp;&nbsp;[type = <i>string</i>,]<br>
102&nbsp;&nbsp;[step = <i>LTN12 pump step</i>],<br> 103&nbsp;&nbsp;[step = <i>LTN12 pump step</i>,]<br>
103<b>}</b> 104<b>}</b>
104</p> 105</p>
105 106
@@ -115,7 +116,9 @@ If the argument of the <tt>get</tt> function is a table, the function
115expects at least the fields <tt>host</tt>, <tt>sink</tt>, and one of 116expects at least the fields <tt>host</tt>, <tt>sink</tt>, and one of
116<tt>argument</tt> or <tt>path</tt> (<tt>argument</tt> takes 117<tt>argument</tt> or <tt>path</tt> (<tt>argument</tt> takes
117precedence). <tt>Host</tt> is the server to connect to. <tt>Sink</tt> is 118precedence). <tt>Host</tt> is the server to connect to. <tt>Sink</tt> is
118the <em>simple</em> LTN12 sink that will receive the downloaded data. <tt>Argument</tt> or 119the <em>simple</em>
120<a href="http://lua-users.org/wiki/FiltersSourcesAndSinks">LTN12</a>
121sink that will receive the downloaded data. <tt>Argument</tt> or
119<tt>path</tt> give the target path to the resource in the server. The 122<tt>path</tt> give the target path to the resource in the server. The
120optional arguments are the following: 123optional arguments are the following:
121</p> 124</p>
@@ -127,7 +130,9 @@ authentication. Defaults to "<tt>ftp:anonymous@anonymous.org</tt>";
127<li><tt>port</tt>: The port to used for the control connection. Defaults to 21; 130<li><tt>port</tt>: The port to used for the control connection. Defaults to 21;
128<li><tt>type</tt>: The transfer mode. Can take values "<tt>i</tt>" or 131<li><tt>type</tt>: The transfer mode. Can take values "<tt>i</tt>" or
129"<tt>a</tt>". Defaults to whatever is the server default; 132"<tt>a</tt>". Defaults to whatever is the server default;
130<li><tt>step</tt>: LTN12 pump step function used to pass data from the 133<li><tt>step</tt>:
134<a href="http://lua-users.org/wiki/FiltersSourcesAndSinks">LTN12</a>
135pump step function used to pass data from the
131server to the sink. Defaults to the LTN12 <tt>pump.step</tt> function. 136server to the sink. Defaults to the LTN12 <tt>pump.step</tt> function.
132</ul> 137</ul>
133 138
@@ -177,7 +182,7 @@ ftp.<b>put{</b><br>
177&nbsp;&nbsp;[command = <i>string</i>,]<br> 182&nbsp;&nbsp;[command = <i>string</i>,]<br>
178&nbsp;&nbsp;[port = <i>number</i>,]<br> 183&nbsp;&nbsp;[port = <i>number</i>,]<br>
179&nbsp;&nbsp;[type = <i>string</i>,]<br> 184&nbsp;&nbsp;[type = <i>string</i>,]<br>
180&nbsp;&nbsp;[step = <i>LTN12 pump step</i>],<br> 185&nbsp;&nbsp;[step = <i>LTN12 pump step</i>,]<br>
181<b>}</b> 186<b>}</b>
182</p> 187</p>
183 188
@@ -192,7 +197,9 @@ If the argument of the <tt>put</tt> function is a table, the function
192expects at least the fields <tt>host</tt>, <tt>source</tt>, and one of 197expects at least the fields <tt>host</tt>, <tt>source</tt>, and one of
193<tt>argument</tt> or <tt>path</tt> (<tt>argument</tt> takes 198<tt>argument</tt> or <tt>path</tt> (<tt>argument</tt> takes
194precedence). <tt>Host</tt> is the server to connect to. <tt>Source</tt> is 199precedence). <tt>Host</tt> is the server to connect to. <tt>Source</tt> is
195the <em>simple</em> LTN12 source that will provide the contents to be uploaded. 200the <em>simple</em>
201<a href="http://lua-users.org/wiki/FiltersSourcesAndSinks">LTN12</a>
202source that will provide the contents to be uploaded.
196<tt>Argument</tt> or 203<tt>Argument</tt> or
197<tt>path</tt> give the target path to the resource in the server. The 204<tt>path</tt> give the target path to the resource in the server. The
198optional arguments are the following: 205optional arguments are the following:
@@ -205,7 +212,9 @@ authentication. Defaults to "<tt>ftp:anonymous@anonymous.org</tt>";
205<li><tt>port</tt>: The port to used for the control connection. Defaults to 21; 212<li><tt>port</tt>: The port to used for the control connection. Defaults to 21;
206<li><tt>type</tt>: The transfer mode. Can take values "<tt>i</tt>" or 213<li><tt>type</tt>: The transfer mode. Can take values "<tt>i</tt>" or
207"<tt>a</tt>". Defaults to whatever is the server default; 214"<tt>a</tt>". Defaults to whatever is the server default;
208<li><tt>step</tt>: LTN12 pump step function used to pass data from the 215<li><tt>step</tt>:
216<a href="http://lua-users.org/wiki/FiltersSourcesAndSinks">LTN12</a>
217pump step function used to pass data from the
209server to the sink. Defaults to the LTN12 <tt>pump.step</tt> function. 218server to the sink. Defaults to the LTN12 <tt>pump.step</tt> function.
210</ul> 219</ul>
211 220
diff --git a/doc/http.html b/doc/http.html
index 0fc04cd..a621ec7 100644
--- a/doc/http.html
+++ b/doc/http.html
@@ -50,11 +50,13 @@ implementation conforms to the HTTP/1.1 standard,
50The module exports functions that provide HTTP functionality in different 50The module exports functions that provide HTTP functionality in different
51levels of abstraction, from the simple 51levels of abstraction, from the simple
52<a href="#get"><tt>get</tt></a> function, through the generic 52<a href="#get"><tt>get</tt></a> function, through the generic
53LTN12 based <a href="#request"><tt>request</tt></a> function, down to 53<a href="http://lua-users.org/wiki/FiltersSourcesAndSinks">LTN12</a> based
54<a href="#request"><tt>request</tt></a> function, down to
54even lower-level if you bother to look through the source code. 55even lower-level if you bother to look through the source code.
55</p> 56</p>
56 57
57<p class=description> To obtain the <tt>ftp</tt> namespace, run: 58<p>
59To obtain the <tt>http</tt> namespace, run:
58</p> 60</p>
59 61
60<pre class=example> 62<pre class=example>
@@ -85,12 +87,8 @@ MIME headers are represented as a Lua table in the form:
85headers = {<br> 87headers = {<br>
86&nbsp;&nbsp;field-1-name = <i>field-1-value</i>,<br> 88&nbsp;&nbsp;field-1-name = <i>field-1-value</i>,<br>
87&nbsp;&nbsp;field-2-name = <i>field-2-value</i>,<br> 89&nbsp;&nbsp;field-2-name = <i>field-2-value</i>,<br>
88&nbsp;&nbsp;field-3-name = <i>field-3-value</i>, 90&nbsp;&nbsp;field-3-name = <i>field-3-value</i>,<br>
89</tt></td></tr> 91&nbsp;&nbsp;...<br>
90<tr><td align=center><tt>
91&nbsp;&nbsp;...
92</tt></td></tr>
93<tr><td><tt>
94&nbsp;&nbsp;field-n-name = <i>field-n-value</i><br> 92&nbsp;&nbsp;field-n-name = <i>field-n-value</i><br>
95} 93}
96</tt></td></tr> 94</tt></td></tr>
@@ -188,7 +186,7 @@ Note: This function is also trivially implemented with the use of the
188<p class=name id=request> 186<p class=name id=request>
189http.<b>request{</b><br> 187http.<b>request{</b><br>
190&nbsp;&nbsp;url = <i>string</i>,<br> 188&nbsp;&nbsp;url = <i>string</i>,<br>
191&nbsp;&nbsp;[sink = <i>LTN12 sink</i>],]<br> 189&nbsp;&nbsp;[sink = <i>LTN12 sink</i>,]<br>
192&nbsp;&nbsp;[method = <i>string</i>,]<br> 190&nbsp;&nbsp;[method = <i>string</i>,]<br>
193&nbsp;&nbsp;[headers = <i>header-table</i>,]<br> 191&nbsp;&nbsp;[headers = <i>header-table</i>,]<br>
194&nbsp;&nbsp;[source = <i>LTN12 source</i>],<br> 192&nbsp;&nbsp;[source = <i>LTN12 source</i>],<br>
@@ -203,7 +201,9 @@ Performs the generic HTTP request, controlled by a request table.
203</p> 201</p>
204 202
205<p class=parameters> 203<p class=parameters>
206The most important parameters are the <tt>url</tt> and the <em>simple</em> LTN12 <tt>sink</tt> that will receive the downloaded content. 204The most important parameters are the <tt>url</tt> and the <em>simple</em>
205<a href="http://lua-users.org/wiki/FiltersSourcesAndSinks">LTN12</a>
206<tt>sink</tt> that will receive the downloaded content.
207Any part of the <tt>url</tt> can be overridden by including 207Any part of the <tt>url</tt> can be overridden by including
208the appropriate field in the request table. 208the appropriate field in the request table.
209If authentication information is provided, the function 209If authentication information is provided, the function
@@ -215,11 +215,15 @@ following:
215<ul> 215<ul>
216<li><tt>method</tt>: The HTTP request method. Defaults to "GET"; 216<li><tt>method</tt>: The HTTP request method. Defaults to "GET";
217<li><tt>headers</tt>: Any additional HTTP headers to send with the request; 217<li><tt>headers</tt>: Any additional HTTP headers to send with the request;
218<li><tt>source</tt>: <em>simple</em> LTN12 source to provide the request body. If there 218<li><tt>source</tt>: <em>simple</em>
219<a href="http://lua-users.org/wiki/FiltersSourcesAndSinks">LTN12</a>
220source to provide the request body. If there
219is a body, you need to provide an appropriate "<tt>content-length</tt>" 221is a body, you need to provide an appropriate "<tt>content-length</tt>"
220request header field, or the function will attempt to send the body as 222request header field, or the function will attempt to send the body as
221"<tt>chunked</tt>" (something few servers support). Defaults to the empty source; 223"<tt>chunked</tt>" (something few servers support). Defaults to the empty source;
222<li><tt>step</tt>: LTN12 pump step function used to move data. 224<li><tt>step</tt>:
225<a href="http://lua-users.org/wiki/FiltersSourcesAndSinks">LTN12</a>
226pump step function used to move data.
223Defaults to the LTN12 <tt>pump.step</tt> function. 227Defaults to the LTN12 <tt>pump.step</tt> function.
224<li><tt>proxy</tt>: The URL of a proxy server to use. Defaults to no proxy; 228<li><tt>proxy</tt>: The URL of a proxy server to use. Defaults to no proxy;
225<li><tt>redirect</tt>: Set to <tt><b>false</b></tt> to prevent the 229<li><tt>redirect</tt>: Set to <tt><b>false</b></tt> to prevent the
diff --git a/doc/index.html b/doc/index.html
index 888bc92..f6d37ac 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -51,13 +51,21 @@ and Unix platforms.
51</p> 51</p>
52 52
53<p> 53<p>
54The most used modules implement the SMTP (sending e-mails), HTTP 54The most used modules implement the
55(WWW access) and FTP (uploading and downloading files) client 55<a href=smtp.html>SMTP</a>
56(sending e-mails),
57<a href=http.html>HTTP</a>
58(WWW access) and
59<a href=ftp.html>FTP</a>
60(uploading and downloading files) client
56protocols. These provide a very natural and generic interface to the e 61protocols. These provide a very natural and generic interface to the e
57functionality covered by the protocols. 62functionality covered by the protocols.
58In addition, you will find that the MIME (common encodings), URL (anything you 63In addition, you will find that the
59could possible want to do with one) and LTN12 (filters, sinks, sources 64<a href=mime.html>MIME</a> (common encodings),
60and pumps) modules can be very handy. 65<a href=url.html>URL</a>
66(anything you could possible want to do with one) and
67<a href=ltn12.html>LTN12</a>
68(filters, sinks, sources and pumps) modules can be very handy.
61</p> 69</p>
62 70
63<p> 71<p>
diff --git a/doc/introduction.html b/doc/introduction.html
index 59d1956..63a7d84 100644
--- a/doc/introduction.html
+++ b/doc/introduction.html
@@ -122,7 +122,7 @@ from the "<tt>socket</tt>" namespace.
122<pre class="example"> 122<pre class="example">
123socket = require("socket") 123socket = require("socket")
124print(socket.VERSION) 124print(socket.VERSION)
125-- LuaSocket 2.0 125--&gt; LuaSocket 2.0
126</pre> 126</pre>
127 127
128<!-- tcp ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 128<!-- tcp ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
diff --git a/doc/ltn12.html b/doc/ltn12.html
index 7b379c2..9029b9c 100644
--- a/doc/ltn12.html
+++ b/doc/ltn12.html
@@ -42,7 +42,8 @@ functions. Please refer to the LTN for a deeper explanation of the
42functionality provided by this module. 42functionality provided by this module.
43</p> 43</p>
44 44
45<p class=description> To obtain the <tt>ltn12</tt> namespace, run: 45<p>
46To obtain the <tt>ltn12</tt> namespace, run:
46</p> 47</p>
47 48
48<pre class=example> 49<pre class=example>
diff --git a/doc/mime.html b/doc/mime.html
index 791861e..e7211fa 100644
--- a/doc/mime.html
+++ b/doc/mime.html
@@ -55,7 +55,8 @@ follows the ideas presented in
55LTN012, Filters sources and sinks</a>. 55LTN012, Filters sources and sinks</a>.
56</p> 56</p>
57 57
58<p class=description> To obtain the <tt>mime</tt> namespace, run: 58<p>
59To obtain the <tt>mime</tt> namespace, run:
59</p> 60</p>
60 61
61<pre class=example> 62<pre class=example>
@@ -109,10 +110,6 @@ Returns a filter that decodes data from a given transfer content
109encoding. 110encoding.
110</p> 111</p>
111 112
112<p class=return>
113The function returns the created filter.
114</p>
115
116<!-- encode +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 113<!-- encode +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
117 114
118<p class=name id="encode"> 115<p class=name id="encode">
@@ -131,10 +128,6 @@ textual or binary, by passing the <tt>mode</tt> strings "<tt>text</tt>" or
131"<tt>binary</tt>". <tt>Mode</tt> defaults to "<tt>text</tt>". 128"<tt>binary</tt>". <tt>Mode</tt> defaults to "<tt>text</tt>".
132</p> 129</p>
133 130
134<p class=return>
135The function returns the created filter.
136</p>
137
138<p class=note> 131<p class=note>
139Although both transfer content encodings specify a limit for the line 132Although both transfer content encodings specify a limit for the line
140length, the encoding filters do <em>not</em> break text into lines (for 133length, the encoding filters do <em>not</em> break text into lines (for
@@ -186,10 +179,6 @@ not to break lines in the middle of an escaped character. In that case, the
186line length is fixed at 76. 179line length is fixed at 76.
187</p> 180</p>
188 181
189<p class=return>
190The function returns the created filter.
191</p>
192
193<p class=note> 182<p class=note>
194For example, to create an encoding filter for the Quoted-Printable transfer content encoding of text data, do the following: 183For example, to create an encoding filter for the Quoted-Printable transfer content encoding of text data, do the following:
195</p> 184</p>
@@ -260,9 +249,7 @@ the context is returned after each new chunk.
260ASCII value of the last character of the previous chunk, if it was a 249ASCII value of the last character of the previous chunk, if it was a
261candidate for line break, or 0 otherwise. 250candidate for line break, or 0 otherwise.
262<tt>B</tt> is the same as <tt>C</tt>, but for the current 251<tt>B</tt> is the same as <tt>C</tt>, but for the current
263chunk. If <tt>D</tt> is <tt><b>nil</b></tt>, <tt>A</tt> includes a 252chunk. <tt>Marker</tt> gives the new end-of-line marker and defaults to CRLF.
264new end-of-line marker, depending on <tt>C</tt>.
265<tt>Marker</tt> gives the new end-of-line marker and defaults to CRLF.
266</p> 253</p>
267 254
268<pre class=example> 255<pre class=example>
diff --git a/doc/smtp.html b/doc/smtp.html
index 0fdc4a4..6b348e0 100644
--- a/doc/smtp.html
+++ b/doc/smtp.html
@@ -35,8 +35,15 @@
35 35
36<h2 id=smtp>SMTP</h2> 36<h2 id=smtp>SMTP</h2>
37 37
38<p> The <tt>smtp.lua</tt> module provides functionality to send e-mail 38<p> The <tt>smtp</tt> namespace provides functionality to send e-mail
39messages. The implementation conforms to the Simple Mail Transfer Protocol, 39messages. The high-level API consists of two functions: one to
40define an e-mail message, and another to actually send the message.
41Although almost all users will find that these functions provide more than
42enough functionality, the underlying implementation allows for even more
43control (if you bother to read the code).
44</p>
45
46<p>The implementation conforms to the Simple Mail Transfer Protocol,
40<a href="http://www.cs.princeton.edu/~diego/rfc/rfc2821.txt">RFC 2821</a>. 47<a href="http://www.cs.princeton.edu/~diego/rfc/rfc2821.txt">RFC 2821</a>.
41Another RFC of interest is <a 48Another RFC of interest is <a
42href="http://www.cs.princeton.edu/~diego/rfc/rfc2822.txt">RFC 2822</a>, 49href="http://www.cs.princeton.edu/~diego/rfc/rfc2822.txt">RFC 2822</a>,
@@ -52,6 +59,15 @@ sources and sinks</a> and the <a href=mime.html>MIME</a> module is
52assumed. In fact, the SMTP module was the main reason for their 59assumed. In fact, the SMTP module was the main reason for their
53creation. </p> 60creation. </p>
54 61
62<p>
63To obtain the <tt>smtp</tt> namespace, run:
64</p>
65
66<pre class=example>
67-- loads the SMTP module and everything it requires
68local smtp = require("smtp")
69</pre>
70
55<p> 71<p>
56MIME headers are represented as a Lua table in the form: 72MIME headers are represented as a Lua table in the form:
57</p> 73</p>
@@ -62,12 +78,8 @@ MIME headers are represented as a Lua table in the form:
62headers = {<br> 78headers = {<br>
63&nbsp;&nbsp;field-1-name = <i>field-1-value</i>,<br> 79&nbsp;&nbsp;field-1-name = <i>field-1-value</i>,<br>
64&nbsp;&nbsp;field-2-name = <i>field-2-value</i>,<br> 80&nbsp;&nbsp;field-2-name = <i>field-2-value</i>,<br>
65&nbsp;&nbsp;field-3-name = <i>field-3-value</i>, 81&nbsp;&nbsp;field-3-name = <i>field-3-value</i>,<br>
66</tt></td></tr> 82&nbsp;&nbsp;...<br>
67<tr><td align=center><tt>
68&nbsp;&nbsp;...
69</tt></td></tr>
70<tr><td><tt>
71&nbsp;&nbsp;field-n-name = <i>field-n-value</i><br> 83&nbsp;&nbsp;field-n-name = <i>field-n-value</i><br>
72} 84}
73</tt></td></tr> 85</tt></td></tr>
@@ -105,12 +117,12 @@ smtp.<b>send{</b><br>
105&nbsp;&nbsp;from = <i>string</i>,<br> 117&nbsp;&nbsp;from = <i>string</i>,<br>
106&nbsp;&nbsp;rcpt = <i>string</i> or <i>string-table</i>,<br> 118&nbsp;&nbsp;rcpt = <i>string</i> or <i>string-table</i>,<br>
107&nbsp;&nbsp;source = <i>LTN12 source</i>,<br> 119&nbsp;&nbsp;source = <i>LTN12 source</i>,<br>
108&nbsp;&nbsp;[user = <i>string</i>],<br> 120&nbsp;&nbsp;[user = <i>string</i>,]<br>
109&nbsp;&nbsp;[password = <i>string</i>],<br> 121&nbsp;&nbsp;[password = <i>string</i>,]<br>
110&nbsp;&nbsp;[server = <i>string</i>],<br> 122&nbsp;&nbsp;[server = <i>string</i>,]<br>
111&nbsp;&nbsp;[port = <i>string</i>]<br> 123&nbsp;&nbsp;[port = <i>string</i>,]<br>
112&nbsp;&nbsp;[domain = <i>string</i>],<br> 124&nbsp;&nbsp;[domain = <i>string</i>,]<br>
113&nbsp;&nbsp;[step = <i>LTN12 pump step</i>],<br> 125&nbsp;&nbsp;[step = <i>LTN12 pump step</i>,]<br>
114<b>}</b> 126<b>}</b>
115</p> 127</p>
116 128
@@ -127,8 +139,9 @@ The sender is given by the e-mail address in the <tt>from</tt> field.
127<tt>Rcpt</tt> is a Lua table with one entry for each recipient e-mail 139<tt>Rcpt</tt> is a Lua table with one entry for each recipient e-mail
128address, or a string 140address, or a string
129in case there is just one recipient. 141in case there is just one recipient.
130The contents of the message are given by a <em>simple</em> LTN12 <tt>source</tt>. Several 142The contents of the message are given by a <em>simple</em>
131arguments are optional: 143<a href="http://lua-users.org/wiki/FiltersSourcesAndSinks">LTN12</a>
144<tt>source</tt>. Several arguments are optional:
132</p> 145</p>
133<ul> 146<ul>
134<li> <tt>user</tt>, <tt>password</tt>: User and password for 147<li> <tt>user</tt>, <tt>password</tt>: User and password for
@@ -138,7 +151,9 @@ methods if supported by the server (both are unsafe);
138<li> <tt>port</tt>: Port to connect to. Defaults to 25; 151<li> <tt>port</tt>: Port to connect to. Defaults to 25;
139<li> <tt>domain</tt>: Domain name used to greet the server; Defaults to the 152<li> <tt>domain</tt>: Domain name used to greet the server; Defaults to the
140local machine host name; 153local machine host name;
141<li> <tt>step</tt>: LTN12 pump step function used to pass data from the 154<li> <tt>step</tt>:
155<a href="http://lua-users.org/wiki/FiltersSourcesAndSinks">LTN12</a>
156pump step function used to pass data from the
142source to the server. Defaults to the LTN12 <tt>pump.step</tt> function. 157source to the server. Defaults to the LTN12 <tt>pump.step</tt> function.
143</ul> 158</ul>
144 159
@@ -166,7 +181,8 @@ exact opposite of what you expect.
166Only recipients specified in the <tt>rcpt</tt> list will receive a copy of the 181Only recipients specified in the <tt>rcpt</tt> list will receive a copy of the
167message. Each recipient of an SMTP mail message receives a copy of the 182message. Each recipient of an SMTP mail message receives a copy of the
168message body along with the headers, and nothing more. The headers 183message body along with the headers, and nothing more. The headers
169<em>are</em> part of the message and should be produced by the LTN12 184<em>are</em> part of the message and should be produced by the
185<a href="http://lua-users.org/wiki/FiltersSourcesAndSinks">LTN12</a>
170<tt>source</tt> function. The <tt>rcpt</tt> list is <em>not</em> 186<tt>source</tt> function. The <tt>rcpt</tt> list is <em>not</em>
171part of the message and will not be sent to anyone. 187part of the message and will not be sent to anyone.
172</p> 188</p>
@@ -258,8 +274,8 @@ smtp.<b>message(</b>mesgt<b>)</b>
258</p> 274</p>
259 275
260<p class=description> 276<p class=description>
261Returns a LTN12 source that sends an SMTP message body, possibly multipart 277Returns a <em>simple</em>
262(arbitrarily deep). 278<a href="http://lua-users.org/wiki/FiltersSourcesAndSinks">LTN12</a> source that sends an SMTP message body, possibly multipart (arbitrarily deep).
263</p> 279</p>
264 280
265<p class=parameters> 281<p class=parameters>
@@ -277,12 +293,12 @@ mesgt = {<br>
277}<br> 293}<br>
278&nbsp;<br> 294&nbsp;<br>
279multipart-mesgt = {<br> 295multipart-mesgt = {<br>
280&nbsp;&nbsp;preamble = <i>string</i><br> 296&nbsp;&nbsp;[preamble = <i>string</i>,]<br>
281&nbsp;&nbsp;[1] = <i>mesgt</i>,<br> 297&nbsp;&nbsp;[1] = <i>mesgt</i>,<br>
282&nbsp;&nbsp;[2] = <i>mesgt</i>,<br> 298&nbsp;&nbsp;[2] = <i>mesgt</i>,<br>
283&nbsp;&nbsp;...<br> 299&nbsp;&nbsp;...<br>
284&nbsp;&nbsp;[<i>n</i>] = <i>mesgt</i>,<br> 300&nbsp;&nbsp;[<i>n</i>] = <i>mesgt</i>,<br>
285&nbsp;&nbsp;epilogue = <i>string</i>,<br> 301&nbsp;&nbsp;[epilogue = <i>string</i>,]<br>
286}<br> 302}<br>
287</tt></td></tr> 303</tt></td></tr>
288</table> 304</table>
@@ -291,14 +307,19 @@ multipart-mesgt = {<br>
291<p class=parameters> 307<p class=parameters>
292For a simple message, all that is needed is a set of <tt>headers</tt> 308For a simple message, all that is needed is a set of <tt>headers</tt>
293and the <tt>body</tt>. The message <tt>body</tt> can be given as a string 309and the <tt>body</tt>. The message <tt>body</tt> can be given as a string
294or as a LTN12 source. For multipart messages, the body is a table that 310or as a <em>simple</em>
295recursively defines each part as an independent message, plus a preamble 311<a href="http://lua-users.org/wiki/FiltersSourcesAndSinks">LTN12</a>
296and an epilogue. 312source. For multipart messages, the body is a table that
313recursively defines each part as an independent message, plus an optional
314<tt>preamble</tt> and <tt>epilogue</tt>.
297</p> 315</p>
298 316
299<p class=return> 317<p class=return>
300The function returns a <em>simple</em> LTN12 source that produces the 318The function returns a <em>simple</em>
301message contents as defined by <tt>mesgt</tt>. Hopefully, the following 319<a href="http://lua-users.org/wiki/FiltersSourcesAndSinks">LTN12</a>
320source that produces the
321message contents as defined by <tt>mesgt</tt>, chunk by chunk.
322Hopefully, the following
302example will make things clear. When in doubt, refer to the appropriate RFC 323example will make things clear. When in doubt, refer to the appropriate RFC
303as listed in the introduction. </p> 324as listed in the introduction. </p>
304 325
@@ -320,7 +341,7 @@ source = smtp.message{
320 body = { 341 body = {
321 preamble = "If your client doesn't understand attachments, \r\n" .. 342 preamble = "If your client doesn't understand attachments, \r\n" ..
322 "it will still display the preamble and the epilogue.\r\n" .. 343 "it will still display the preamble and the epilogue.\r\n" ..
323 "Preamble might show up even in a MIME enabled client.", 344 "Preamble will probably appear even in a MIME enabled client.",
324 -- first part: no headers means plain text, us-ascii. 345 -- first part: no headers means plain text, us-ascii.
325 -- The mime.eol low-level filter normalizes end-of-line markers. 346 -- The mime.eol low-level filter normalizes end-of-line markers.
326 [1] = { 347 [1] = {
diff --git a/doc/socket.html b/doc/socket.html
index b3fbb6e..8b92a3f 100644
--- a/doc/socket.html
+++ b/doc/socket.html
@@ -39,6 +39,16 @@
39The <tt>socket</tt> namespace contains the core functionality of LuaSocket. 39The <tt>socket</tt> namespace contains the core functionality of LuaSocket.
40</p> 40</p>
41 41
42<p>
43To obtain the <tt>socket</tt> namespace, run:
44</p>
45
46<pre class=example>
47-- loads the socket module
48local socket = require("socket")
49</pre>
50
51
42<!-- debug ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 52<!-- debug ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
43 53
44<p class=name id=debug> 54<p class=name id=debug>
@@ -62,8 +72,9 @@ Converts a function that throws exceptions into a safe function.
62</p> 72</p>
63 73
64<p class=parameters> 74<p class=parameters>
65<tt>Funct</tt> is a function that calls 75<tt>Func</tt> is a function that calls
66<a href=#try><tt>try</tt></a> to throw exceptions. 76<a href=#try><tt>try</tt></a> (or <tt>assert</tt>, or <tt>error</tt>)
77to throw exceptions.
67</p> 78</p>
68 79
69<p class=return> 80<p class=return>
@@ -71,6 +82,13 @@ Returns an equivalent function that instead of throwing exceptions,
71returns <tt><b>nil</b></tt> followed by an error message. 82returns <tt><b>nil</b></tt> followed by an error message.
72</p> 83</p>
73 84
85<p class=note>
86Note: Beware that if your function performs some illegal operation that
87raises an error, the protected function will catch the error and return it
88as a string. This is because the <a href=#try><tt>try</tt></a> function
89uses errors as the mechanism to throw exceptions.
90</p>
91
74<!-- select +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 92<!-- select +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
75 93
76<p class=name id=select> 94<p class=name id=select>
@@ -88,8 +106,8 @@ see if it is OK to immediately write on them. <tt>Timeout</tt> is the
88maximum amount of time (in seconds) to wait for a change in status. A 106maximum amount of time (in seconds) to wait for a change in status. A
89<tt><b>nil</b></tt>, negative or omitted <tt>timeout</tt> value allows the 107<tt><b>nil</b></tt>, negative or omitted <tt>timeout</tt> value allows the
90function to block indefinitely. <tt>Recvt</tt> and <tt>sendt</tt> can also 108function to block indefinitely. <tt>Recvt</tt> and <tt>sendt</tt> can also
91be empty tables or <tt><b>nil</b></tt>. Non-socket values in the arrays 109be empty tables or <tt><b>nil</b></tt>. Non-socket values (or values with
92will be silently ignored. 110non-numeric indices) in the arrays will be silently ignored.
93</p> 111</p>
94 112
95<p class=return> The function returns a table with the sockets ready for 113<p class=return> The function returns a table with the sockets ready for
@@ -186,7 +204,7 @@ The function returns a source with the appropriate behavior.
186<!-- try ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 204<!-- try ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
187 205
188<p class=name id=try> 206<p class=name id=try>
189socket.<b>try(</b>ret<sub>1</sub>, ret<sub>2</sub> ... ret<sub>N</sub><b>)</b> 207socket.<b>try(</b>ret<sub>1</sub> [, ret<sub>2</sub> ... ret<sub>N</sub>]<b>)</b>
190</p> 208</p>
191 209
192<p class=description> 210<p class=description>
@@ -194,16 +212,14 @@ Throws an exception in case of error.
194</p> 212</p>
195 213
196<p class=parameters> 214<p class=parameters>
197<tt>Ret</tt><sub>1</sub>, <tt>ret</tt><sub>2</sub> ... <tt>ret</tt><sub>N</sub> can be arbitrary 215<tt>Ret</tt><sub>1</sub> to <tt>ret</tt><sub>N</sub> can be arbitrary
198arguments, but are usually the return values of a function call that 216arguments, but are usually the return values of a function call
199nested with the call to <tt>try</tt>. 217nested with <tt>try</tt>.
200</p> 218</p>
201 219
202<p class=return> 220<p class=return>
203The function returns <tt>ret</tt><sub>1</sub>, <tt>ret</tt><sub>2</sub> ... 221The function returns <tt>ret</tt><sub>1</sub> to <tt>ret</tt><sub>N</sub> if
204<tt>ret</tt><sub>N</sub> if 222<tt>ret</tt><sub>1</sub> is not <tt><b>nil</b></tt>. Otherwise, it calls <tt>error</tt> passing <tt>ret</tt><sub>2</sub>.
205<tt>ret</tt><sub>1</sub> is not <tt><b>nil</b></tt>. Otherwise, calls <tt>error</tt>
206passing <tt>ret</tt><sub>2</sub>.
207</p> 223</p>
208 224
209<pre class=example> 225<pre class=example>
@@ -211,7 +227,7 @@ passing <tt>ret</tt><sub>2</sub>.
211c = socket.try(socket.connect("localhost", 80)) 227c = socket.try(socket.connect("localhost", 80))
212</pre> 228</pre>
213 229
214<!-- version ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 230<!-- version ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
215 231
216<p class=name id=version> 232<p class=name id=version>
217socket.<b>VERSION</b> 233socket.<b>VERSION</b>