diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-06-16 04:28:21 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-06-16 04:28:21 +0000 |
commit | 0a4c1534f39511894728da193ab8225ad6022de9 (patch) | |
tree | 683b711accf64eca486b138cbc034c609f93a53a /doc/ftp.html | |
parent | 8e80e38f2c3121242b3b2f7a45a960c9af4d1a68 (diff) | |
download | luasocket-0a4c1534f39511894728da193ab8225ad6022de9.tar.gz luasocket-0a4c1534f39511894728da193ab8225ad6022de9.tar.bz2 luasocket-0a4c1534f39511894728da193ab8225ad6022de9.zip |
Still work to do in the manual...
Diffstat (limited to 'doc/ftp.html')
-rw-r--r-- | doc/ftp.html | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/doc/ftp.html b/doc/ftp.html index e834f07..9fda02b 100644 --- a/doc/ftp.html +++ b/doc/ftp.html | |||
@@ -35,39 +35,46 @@ | |||
35 | 35 | ||
36 | <p> | 36 | <p> |
37 | FTP (File Transfer Protocol) is a protocol used to transfer files | 37 | FTP (File Transfer Protocol) is a protocol used to transfer files |
38 | between hosts. The module <tt>ftp.lua</tt> offers simple FTP support. | 38 | between hosts. The <tt>ftp</tt> namespace offers thorough support |
39 | Applications can easily download and upload files. | 39 | to FTP, under a simple interface. The implementation conforms to |
40 | The implementation conforms to | ||
41 | <a href="http://www.cs.princeton.edu/~diego/rfc/rfc0959.txt">RFC 959</a>. | 40 | <a href="http://www.cs.princeton.edu/~diego/rfc/rfc0959.txt">RFC 959</a>. |
42 | </p> | 41 | </p> |
43 | 42 | ||
44 | <p> | 43 | <p> |
45 | URLs MUST conform to | ||
46 | <a href="http://www.cs.princeton.edu/~diego/rfc/rfc1738.txt">RFC | ||
47 | 1738</a>, that is, an URL is a string in the form: | ||
48 | </p> | ||
49 | |||
50 | <blockquote> | ||
51 | <tt> | ||
52 | [ftp://][<user>[:<password>]@]<host>[:<port>][/<path>][<i>type</i>=a|i]</tt> | ||
53 | </blockquote> | ||
54 | |||
55 | <p> | ||
56 | High level functions are provided supporting the most common operations. | 44 | High level functions are provided supporting the most common operations. |
57 | These high level functions are implemented on top of a lower level | 45 | These high level functions are implemented on top of a lower level |
58 | interface. By using the low-level interface, users can easily create their | 46 | interface. Using the low-level interface, users can easily create their |
59 | own functions to access <em>any</em> operation supported by the FTP | 47 | own functions to access <em>any</em> operation supported by the FTP |
60 | protocol. For that, check the implementation. | 48 | protocol. For that, check the implementation. |
61 | </p> | 49 | </p> |
62 | 50 | ||
63 | <p> | 51 | <p> |
64 | To use some of the functions in this module, a good understanding of | 52 | To really benefit from this module, a good understanding of |
65 | <a href="http://lua-users.org/wiki/FiltersSourcesAndSinks"> | 53 | <a href="http://lua-users.org/wiki/FiltersSourcesAndSinks"> |
66 | LTN012, Filters sources and sinks</a> is necessary. | 54 | LTN012, Filters sources and sinks</a> is necessary. |
67 | </p> | 55 | </p> |
68 | 56 | ||
57 | <p class=description> To obtain the <tt>ftp</tt> namespace, run: | ||
58 | </p> | ||
59 | |||
60 | <pre class=example> | ||
61 | -- loads the FTP module and any libraries it requires | ||
62 | local ftp = require("ftp") | ||
63 | </pre> | ||
64 | |||
69 | <p> | 65 | <p> |
70 | The following constants can be set to control the default behaviour of | 66 | URLs MUST conform to |
67 | <a href="http://www.cs.princeton.edu/~diego/rfc/rfc1738.txt">RFC | ||
68 | 1738</a>, that is, an URL is a string in the form: | ||
69 | </p> | ||
70 | |||
71 | <blockquote> | ||
72 | <tt> | ||
73 | [ftp://][<user>[:<password>]@]<host>[:<port>][/<path>][<i>type</i>=a|i]</tt> | ||
74 | </blockquote> | ||
75 | |||
76 | <p> | ||
77 | The following constants in the namespace can be set to control the default behavior of | ||
71 | the FTP module: | 78 | the FTP module: |
72 | </p> | 79 | </p> |
73 | 80 | ||
@@ -78,6 +85,7 @@ the FTP module: | |||
78 | <li> <tt>USER</tt>: default anonymous user; | 85 | <li> <tt>USER</tt>: default anonymous user; |
79 | </ul> | 86 | </ul> |
80 | 87 | ||
88 | |||
81 | <!-- ftp.get ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 89 | <!-- ftp.get ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
82 | 90 | ||
83 | <p class=name id=get> | 91 | <p class=name id=get> |
@@ -116,7 +124,7 @@ optional arguments are the following: | |||
116 | authentication. Defaults to "<tt>ftp:anonymous@anonymous.org</tt>"; | 124 | authentication. Defaults to "<tt>ftp:anonymous@anonymous.org</tt>"; |
117 | <li><tt>command</tt>: The FTP command used to obtain data. Defaults to | 125 | <li><tt>command</tt>: The FTP command used to obtain data. Defaults to |
118 | "<tt>retr</tt>", but see example below; | 126 | "<tt>retr</tt>", but see example below; |
119 | <li><tt>port</tt>: The port to contacct the server at. Defaults to 21; | 127 | <li><tt>port</tt>: The port to used for the control connection. Defaults to 21; |
120 | <li><tt>type</tt>: The transfer mode. Can take values "<tt>i</tt>" or | 128 | <li><tt>type</tt>: The transfer mode. Can take values "<tt>i</tt>" or |
121 | "<tt>a</tt>". Defaults to whatever is the server default; | 129 | "<tt>a</tt>". Defaults to whatever is the server default; |
122 | <li><tt>step</tt>: LTN12 pump step function used to pass data from the | 130 | <li><tt>step</tt>: LTN12 pump step function used to pass data from the |
@@ -192,9 +200,9 @@ optional arguments are the following: | |||
192 | <ul> | 200 | <ul> |
193 | <li><tt>user</tt>, <tt>password</tt>: User name and password used for | 201 | <li><tt>user</tt>, <tt>password</tt>: User name and password used for |
194 | authentication. Defaults to "<tt>ftp:anonymous@anonymous.org</tt>"; | 202 | authentication. Defaults to "<tt>ftp:anonymous@anonymous.org</tt>"; |
195 | <li><tt>command</tt>: The FTP command used to obtain data. Defaults to | 203 | <li><tt>command</tt>: The FTP command used to send data. Defaults to |
196 | "<tt>retr</tt>", but see example below; | 204 | "<tt>stor</tt>", but see example below; |
197 | <li><tt>port</tt>: The port to contacct the server at. Defaults to 21; | 205 | <li><tt>port</tt>: The port to used for the control connection. Defaults to 21; |
198 | <li><tt>type</tt>: The transfer mode. Can take values "<tt>i</tt>" or | 206 | <li><tt>type</tt>: The transfer mode. Can take values "<tt>i</tt>" or |
199 | "<tt>a</tt>". Defaults to whatever is the server default; | 207 | "<tt>a</tt>". Defaults to whatever is the server default; |
200 | <li><tt>step</tt>: LTN12 pump step function used to pass data from the | 208 | <li><tt>step</tt>: LTN12 pump step function used to pass data from the |
@@ -213,7 +221,8 @@ local ftp = require("ftp") | |||
213 | -- Log as user "diego" on server "ftp.tecgraf.puc-rio.br", | 221 | -- Log as user "diego" on server "ftp.tecgraf.puc-rio.br", |
214 | -- using password "nehab", and store a file "README" with contents | 222 | -- using password "nehab", and store a file "README" with contents |
215 | -- "wrong password, of course" | 223 | -- "wrong password, of course" |
216 | f, e = ftp.put("ftp://diego:nehab@ftp.tecgraf.puc-rio.br/README", "wrong password, of course") | 224 | f, e = ftp.put("ftp://diego:nehab@ftp.tecgraf.puc-rio.br/README", |
225 | "wrong password, of course") | ||
217 | </pre> | 226 | </pre> |
218 | 227 | ||
219 | <pre class=example> | 228 | <pre class=example> |
@@ -222,8 +231,8 @@ local ftp = require("ftp") | |||
222 | local ltn12 = require("ltn12") | 231 | local ltn12 = require("ltn12") |
223 | 232 | ||
224 | -- Log as user "diego" on server "ftp.tecgraf.puc-rio.br", | 233 | -- Log as user "diego" on server "ftp.tecgraf.puc-rio.br", |
225 | -- using password "nehab", and append to the file "LOG", sending the | 234 | -- using password "nehab", and append to the remote file "LOG", sending the |
226 | -- contents of a local file | 235 | -- contents of the local file "LOCAL-LOG" |
227 | f, e = ftp.put{ | 236 | f, e = ftp.put{ |
228 | host = "ftp.tecgraf.puc-rio.br", | 237 | host = "ftp.tecgraf.puc-rio.br", |
229 | user = "diego", | 238 | user = "diego", |