mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-12-27 04:48:21 +01:00
Manual almost there.
This commit is contained in:
parent
d46f7a09a7
commit
8e80e38f2c
@ -107,7 +107,7 @@ If the argument of the <tt>get</tt> function is a table, the function
|
|||||||
expects at least the fields <tt>host</tt>, <tt>sink</tt>, and one of
|
expects at least the fields <tt>host</tt>, <tt>sink</tt>, and one of
|
||||||
<tt>argument</tt> or <tt>path</tt> (<tt>argument</tt> takes
|
<tt>argument</tt> or <tt>path</tt> (<tt>argument</tt> takes
|
||||||
precedence). <tt>Host</tt> is the server to connect to. <tt>Sink</tt> is
|
precedence). <tt>Host</tt> is the server to connect to. <tt>Sink</tt> is
|
||||||
the LTN12 sink that will receive the downloaded data. <tt>Argument</tt> or
|
the <em>simple</em> LTN12 sink that will receive the downloaded data. <tt>Argument</tt> or
|
||||||
<tt>path</tt> give the target path to the resource in the server. The
|
<tt>path</tt> give the target path to the resource in the server. The
|
||||||
optional arguments are the following:
|
optional arguments are the following:
|
||||||
</p>
|
</p>
|
||||||
@ -184,7 +184,7 @@ If the argument of the <tt>put</tt> function is a table, the function
|
|||||||
expects at least the fields <tt>host</tt>, <tt>source</tt>, and one of
|
expects at least the fields <tt>host</tt>, <tt>source</tt>, and one of
|
||||||
<tt>argument</tt> or <tt>path</tt> (<tt>argument</tt> takes
|
<tt>argument</tt> or <tt>path</tt> (<tt>argument</tt> takes
|
||||||
precedence). <tt>Host</tt> is the server to connect to. <tt>Source</tt> is
|
precedence). <tt>Host</tt> is the server to connect to. <tt>Source</tt> is
|
||||||
the LTN12 source that will provide the contents to be uploaded.
|
the <em>simple</em> LTN12 source that will provide the contents to be uploaded.
|
||||||
<tt>Argument</tt> or
|
<tt>Argument</tt> or
|
||||||
<tt>path</tt> give the target path to the resource in the server. The
|
<tt>path</tt> give the target path to the resource in the server. The
|
||||||
optional arguments are the following:
|
optional arguments are the following:
|
||||||
|
@ -193,8 +193,7 @@ Performs the generic HTTP request, controled by a request table.
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p class=parameters>
|
<p class=parameters>
|
||||||
The most important parameters are the <tt>url</tt> and the LTN12
|
The most important parameters are the <tt>url</tt> and the <em>simple</em> LTN12 <tt>sink</tt> that will receive the downloaded content.
|
||||||
<tt>sink</tt> that will receive the downloaded content.
|
|
||||||
Any part of the <tt>url</tt> can be overriden by including
|
Any part of the <tt>url</tt> can be overriden by including
|
||||||
the appropriate field in the request table.
|
the appropriate field in the request table.
|
||||||
If authentication information is provided, the function
|
If authentication information is provided, the function
|
||||||
@ -206,7 +205,7 @@ following:
|
|||||||
<ul>
|
<ul>
|
||||||
<li><tt>method</tt>: The HTTP request method. Defaults to "GET";
|
<li><tt>method</tt>: The HTTP request method. Defaults to "GET";
|
||||||
<li><tt>headers</tt>: Any additional HTTP headers to send with the request;
|
<li><tt>headers</tt>: Any additional HTTP headers to send with the request;
|
||||||
<li><tt>source</tt>: LTN12 source to provide the request body. If there
|
<li><tt>source</tt>: <em>simple</em> LTN12 source to provide the request body. If there
|
||||||
is a body, you need to provide an appropriate "<tt>content-length</tt>"
|
is a body, you need to provide an appropriate "<tt>content-length</tt>"
|
||||||
request header field, or the function will attempt to send the body as
|
request header field, or the function will attempt to send the body as
|
||||||
"<tt>chunked</tt>" (something few servers support). Defaults to the empty source;
|
"<tt>chunked</tt>" (something few servers support). Defaults to the empty source;
|
||||||
|
@ -187,18 +187,18 @@ the changes that made it into version 2.0:
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Lots of changes in the Lua modules, too. The new MIME and LTN12 modules
|
Lots of changes in the Lua modules, too!
|
||||||
make all other modules much more powerful. The main new functionality is
|
|
||||||
the support for multipart messages in the SMTP module.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
<li> New MIME and LTN12 modules make all other modules much more powerful;
|
||||||
<li>
|
<li> Support for multipart messages in the SMTP module;
|
||||||
|
<li> The old callback mechanism of FTP and HTTP has been replaced with LTN12 sources and sinks,
|
||||||
|
with advantage;
|
||||||
|
<li> FTP, HTTP, and SMTP are implemented in multiple levels in such a way
|
||||||
|
that users will have no problems extending the functionality.
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
<!-- incompatible +++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
<!-- incompatible +++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
<h3 id=incompatible>Incompatibilities with previous versions</h3>
|
<h3 id=incompatible>Incompatibilities with previous versions</h3>
|
||||||
@ -217,7 +217,11 @@ agree the new stuff is better;
|
|||||||
<tt>sendto</tt>, <tt>setpeername</tt> and <tt>setsockname</tt>,
|
<tt>sendto</tt>, <tt>setpeername</tt> and <tt>setsockname</tt>,
|
||||||
return convention WILL break old code;
|
return convention WILL break old code;
|
||||||
|
|
||||||
<li> Interface to options has changed;
|
<li> To enable local binding before connect, the <tt>bind</tt> method
|
||||||
|
does not call <tt>listen</tt> anymore. It is the new <tt>listen</tt>
|
||||||
|
method that turns a TCP object into a server object;
|
||||||
|
|
||||||
|
<li> Interface to options has changed.
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ The sender is given by the e-mail address in the <tt>from</tt> field.
|
|||||||
<tt>Rcpt</tt> is a Lua table with one entry for each recipient e-mail
|
<tt>Rcpt</tt> is a Lua table with one entry for each recipient e-mail
|
||||||
address, or a string
|
address, or a string
|
||||||
in case there is just one recipient.
|
in case there is just one recipient.
|
||||||
The contents of the message are given by a LTN12 <tt>source</tt>. Several
|
The contents of the message are given by a <em>simple</em> LTN12 <tt>source</tt>. Several
|
||||||
arguments are optional:
|
arguments are optional:
|
||||||
<ul>
|
<ul>
|
||||||
<li> <tt>server</tt>: Server to connect to. Defaults to "localhost";
|
<li> <tt>server</tt>: Server to connect to. Defaults to "localhost";
|
||||||
@ -292,10 +292,10 @@ and an epilogue.
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p class=return>
|
<p class=return>
|
||||||
The function returns an LTN12 source that produces the message contents as
|
The function returns a <em>simple</em> LTN12 source that produces the
|
||||||
defined by <tt>mesgt</tt>. Hopefuly, the following example will make
|
message contents as defined by <tt>mesgt</tt>. Hopefuly, the following
|
||||||
things clear. When in doubt, refer to the appropriate RFC as listed in the
|
example will make things clear. When in doubt, refer to the appropriate RFC
|
||||||
introduction. </p>
|
as listed in the introduction. </p>
|
||||||
|
|
||||||
<pre class=example>
|
<pre class=example>
|
||||||
-- load the smtp support and its friends
|
-- load the smtp support and its friends
|
||||||
@ -314,7 +314,7 @@ source = smtp.message{
|
|||||||
},
|
},
|
||||||
body = {
|
body = {
|
||||||
preamble = "If your client doesn't understand attachments, \r\n" ..
|
preamble = "If your client doesn't understand attachments, \r\n" ..
|
||||||
"it will still display the preamble and the epilogue.\r\n",
|
"it will still display the preamble and the epilogue.\r\n" ..
|
||||||
"Preamble might show up even in a MIME enabled client.",
|
"Preamble might show up even in a MIME enabled client.",
|
||||||
-- first part: no headers means plain text, us-ascii.
|
-- first part: no headers means plain text, us-ascii.
|
||||||
-- The mime.eol low-level filter normalizes end-of-line markers.
|
-- The mime.eol low-level filter normalizes end-of-line markers.
|
||||||
|
@ -106,8 +106,7 @@ writable even though the socket is <em>not</em> ready for sending.
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p class=note>
|
<p class=note>
|
||||||
<b>Another important note</b>: calling select with a server socket in the receive
|
<b>Another important note</b>: calling select with a server socket in the receive parameter before a call to accept does <em>not</em> guarantee
|
||||||
parameter before a call to accept does <em>not</em> guarantee
|
|
||||||
<a href=tcp.html#accept><tt>accept</tt></a> will return immediately.
|
<a href=tcp.html#accept><tt>accept</tt></a> will return immediately.
|
||||||
Use the <a href=tcp.html#settimeout><tt>settimeout</tt></a>
|
Use the <a href=tcp.html#settimeout><tt>settimeout</tt></a>
|
||||||
method or <tt>accept</tt> might block forever.
|
method or <tt>accept</tt> might block forever.
|
||||||
|
Loading…
Reference in New Issue
Block a user