mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-12-26 04:28:20 +01:00
Hide ftp.PORT "constant" as a local
This commit is contained in:
parent
916b548240
commit
23ce5aeaa2
@ -86,7 +86,6 @@ the FTP module:
|
|||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li> <tt>PASSWORD</tt>: default anonymous password.
|
<li> <tt>PASSWORD</tt>: default anonymous password.
|
||||||
<li> <tt>PORT</tt>: default port used for the control connection;
|
|
||||||
<li> <tt>TIMEOUT</tt>: sets the timeout for all I/O operations;
|
<li> <tt>TIMEOUT</tt>: sets the timeout for all I/O operations;
|
||||||
<li> <tt>USER</tt>: default anonymous user;
|
<li> <tt>USER</tt>: default anonymous user;
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -23,7 +23,7 @@ local _M = socket.ftp
|
|||||||
-- timeout in seconds before the program gives up on a connection
|
-- timeout in seconds before the program gives up on a connection
|
||||||
_M.TIMEOUT = 60
|
_M.TIMEOUT = 60
|
||||||
-- default port for ftp service
|
-- default port for ftp service
|
||||||
_M.PORT = 21
|
local PORT = 21
|
||||||
-- this is the default anonymous password. used when no password is
|
-- this is the default anonymous password. used when no password is
|
||||||
-- provided in url. should be changed to your e-mail.
|
-- provided in url. should be changed to your e-mail.
|
||||||
_M.USER = "ftp"
|
_M.USER = "ftp"
|
||||||
@ -35,7 +35,7 @@ _M.PASSWORD = "anonymous@anonymous.org"
|
|||||||
local metat = { __index = {} }
|
local metat = { __index = {} }
|
||||||
|
|
||||||
function _M.open(server, port, create)
|
function _M.open(server, port, create)
|
||||||
local tp = socket.try(tp.connect(server, port or _M.PORT, _M.TIMEOUT, create))
|
local tp = socket.try(tp.connect(server, port or PORT, _M.TIMEOUT, create))
|
||||||
local f = base.setmetatable({ tp = tp }, metat)
|
local f = base.setmetatable({ tp = tp }, metat)
|
||||||
-- make sure everything gets closed in an exception
|
-- make sure everything gets closed in an exception
|
||||||
f.try = socket.newtry(function() f:close() end)
|
f.try = socket.newtry(function() f:close() end)
|
||||||
|
Loading…
Reference in New Issue
Block a user