diff options
author | Diego Nehab <diego@impa.br> | 2016-03-07 01:33:08 -0300 |
---|---|---|
committer | Diego Nehab <diego@impa.br> | 2016-03-07 01:33:08 -0300 |
commit | 23ce5aeaa22b49d6649096b520b292a3626474ef (patch) | |
tree | b4d2b2a6bbaafb4a1361f9530b54b29591e4cd2b | |
parent | 916b548240b1513410b13f964d80f329aec9c13a (diff) | |
download | luasocket-23ce5aeaa22b49d6649096b520b292a3626474ef.tar.gz luasocket-23ce5aeaa22b49d6649096b520b292a3626474ef.tar.bz2 luasocket-23ce5aeaa22b49d6649096b520b292a3626474ef.zip |
Hide ftp.PORT "constant" as a local
-rw-r--r-- | doc/ftp.html | 1 | ||||
-rw-r--r-- | src/ftp.lua | 4 |
2 files changed, 2 insertions, 3 deletions
diff --git a/doc/ftp.html b/doc/ftp.html index 3f23a4a..091c88f 100644 --- a/doc/ftp.html +++ b/doc/ftp.html | |||
@@ -86,7 +86,6 @@ the FTP module: | |||
86 | 86 | ||
87 | <ul> | 87 | <ul> |
88 | <li> <tt>PASSWORD</tt>: default anonymous password. | 88 | <li> <tt>PASSWORD</tt>: default anonymous password. |
89 | <li> <tt>PORT</tt>: default port used for the control connection; | ||
90 | <li> <tt>TIMEOUT</tt>: sets the timeout for all I/O operations; | 89 | <li> <tt>TIMEOUT</tt>: sets the timeout for all I/O operations; |
91 | <li> <tt>USER</tt>: default anonymous user; | 90 | <li> <tt>USER</tt>: default anonymous user; |
92 | </ul> | 91 | </ul> |
diff --git a/src/ftp.lua b/src/ftp.lua index 11798ad..bd528ca 100644 --- a/src/ftp.lua +++ b/src/ftp.lua | |||
@@ -23,7 +23,7 @@ local _M = socket.ftp | |||
23 | -- timeout in seconds before the program gives up on a connection | 23 | -- timeout in seconds before the program gives up on a connection |
24 | _M.TIMEOUT = 60 | 24 | _M.TIMEOUT = 60 |
25 | -- default port for ftp service | 25 | -- default port for ftp service |
26 | _M.PORT = 21 | 26 | local PORT = 21 |
27 | -- this is the default anonymous password. used when no password is | 27 | -- this is the default anonymous password. used when no password is |
28 | -- provided in url. should be changed to your e-mail. | 28 | -- provided in url. should be changed to your e-mail. |
29 | _M.USER = "ftp" | 29 | _M.USER = "ftp" |
@@ -35,7 +35,7 @@ _M.PASSWORD = "anonymous@anonymous.org" | |||
35 | local metat = { __index = {} } | 35 | local metat = { __index = {} } |
36 | 36 | ||
37 | function _M.open(server, port, create) | 37 | function _M.open(server, port, create) |
38 | local tp = socket.try(tp.connect(server, port or _M.PORT, _M.TIMEOUT, create)) | 38 | local tp = socket.try(tp.connect(server, port or PORT, _M.TIMEOUT, create)) |
39 | local f = base.setmetatable({ tp = tp }, metat) | 39 | local f = base.setmetatable({ tp = tp }, metat) |
40 | -- make sure everything gets closed in an exception | 40 | -- make sure everything gets closed in an exception |
41 | f.try = socket.newtry(function() f:close() end) | 41 | f.try = socket.newtry(function() f:close() end) |