diff options
Diffstat (limited to 'lib/net/ftp.rb')
-rw-r--r-- | lib/net/ftp.rb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb index 757daa9224..d125c2c0f7 100644 --- a/lib/net/ftp.rb +++ b/lib/net/ftp.rb @@ -1298,6 +1298,41 @@ module Net end # + # Issues a FEAT command + # + # Returns an array of supported optional features + # + def features + resp = sendcmd("FEAT") + if !resp.start_with?("211") + raise FTPReplyError, resp + end + + feats = [] + resp.split("\n").each do |line| + next if !line.start_with?(' ') # skip status lines + + feats << line.strip + end + + return feats + end + + # + # Issues an OPTS command + # - name Should be the name of the option to set + # - params is any optional parameters to supply with the option + # + # example: option('UTF8', 'ON') => 'OPTS UTF8 ON' + # + def option(name, params = nil) + cmd = "OPTS #{name}" + cmd += " #{params}" if params + + voidcmd(cmd) + end + + # # Closes the connection. Further operations are impossible until you open # a new connection with #connect. # |