mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-12-26 04:28:20 +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
|
||||
<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
|
||||
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
|
||||
optional arguments are the following:
|
||||
</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
|
||||
<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
|
||||
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>path</tt> give the target path to the resource in the server. The
|
||||
optional arguments are the following:
|
||||
|
@ -193,8 +193,7 @@ Performs the generic HTTP request, controled by a request table.
|
||||
</p>
|
||||
|
||||
<p class=parameters>
|
||||
The most important parameters are the <tt>url</tt> and the LTN12
|
||||
<tt>sink</tt> that will receive the downloaded content.
|
||||
The most important parameters are the <tt>url</tt> and the <em>simple</em> LTN12 <tt>sink</tt> that will receive the downloaded content.
|
||||
Any part of the <tt>url</tt> can be overriden by including
|
||||
the appropriate field in the request table.
|
||||
If authentication information is provided, the function
|
||||
@ -206,7 +205,7 @@ following:
|
||||
<ul>
|
||||
<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>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>"
|
||||
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;
|
||||
|
@ -187,18 +187,18 @@ the changes that made it into version 2.0:
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
Lots of changes in the Lua modules, too. The new MIME and LTN12 modules
|
||||
make all other modules much more powerful. The main new functionality is
|
||||
the support for multipart messages in the SMTP module.
|
||||
Lots of changes in the Lua modules, too!
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
|
||||
<li> New MIME and LTN12 modules make all other modules much more powerful;
|
||||
<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>
|
||||
|
||||
|
||||
<!-- incompatible +++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||
|
||||
<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>,
|
||||
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>
|
||||
|
||||
|
@ -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
|
||||
address, or a string
|
||||
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:
|
||||
<ul>
|
||||
<li> <tt>server</tt>: Server to connect to. Defaults to "localhost";
|
||||
@ -292,10 +292,10 @@ and an epilogue.
|
||||
</p>
|
||||
|
||||
<p class=return>
|
||||
The function returns an LTN12 source that produces the message contents as
|
||||
defined by <tt>mesgt</tt>. Hopefuly, the following example will make
|
||||
things clear. When in doubt, refer to the appropriate RFC as listed in the
|
||||
introduction. </p>
|
||||
The function returns a <em>simple</em> LTN12 source that produces the
|
||||
message contents as defined by <tt>mesgt</tt>. Hopefuly, the following
|
||||
example will make things clear. When in doubt, refer to the appropriate RFC
|
||||
as listed in the introduction. </p>
|
||||
|
||||
<pre class=example>
|
||||
-- load the smtp support and its friends
|
||||
@ -314,7 +314,7 @@ source = smtp.message{
|
||||
},
|
||||
body = {
|
||||
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.",
|
||||
-- first part: no headers means plain text, us-ascii.
|
||||
-- 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 class=note>
|
||||
<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
|
||||
<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
|
||||
<a href=tcp.html#accept><tt>accept</tt></a> will return immediately.
|
||||
Use the <a href=tcp.html#settimeout><tt>settimeout</tt></a>
|
||||
method or <tt>accept</tt> might block forever.
|
||||
|
Loading…
Reference in New Issue
Block a user