Manual of Lua-URI: ftp

Manual of Lua-URI: ftp

lua-uri-ftp - FTP URI support for Lua URI library

Description

The class uri.ftp is used for URIs with the ftp scheme. It inherits from the uri._login class.

FTP URIs with a missing authority part or an empty host part are considered to be invalid. An empty path is always normalized to '/'. The default port is 21.

Methods

All the methods defined in lua-uri(3) and lua-uri-_login(3) are supported, in addition to the following:

uri:ftp_typecode(...)

Mutator for the 'type' parameter at the end of the path. If the optional argument is supplied then a new type is set, replacing the existing one, or causing the type parameter to be added to the path if it isn't there already.

local uri = assert(URI:new("ftp://host/path"))
uri:ftp_typecode("a")   -- ftp://host/path;type=a
uri:ftp_typecode(nil)   -- ftp://host/path

Passing in an empty string has the same effect as nil, removing the parameter. An empty type parameter will be returned as nil, the same as if the parameter was missing.

References

This class is based on RFC 1738 section 3.2. Unfortunately there isn't currently an RFC for FTP URIs based on the more up to date RFC 3986.