Sha256: 121e7f9847b2a3c809cfa1d304e1d1d35000f44a43665061d05d82c73893e2ee

Contents?: true

Size: 587 Bytes

Versions: 6

Compression:

Stored size: 587 Bytes

Contents

require_relative 'command_handler'

module Ftpd

  class CmdType < CommandHandler

    def cmd_type(argument)
      ensure_logged_in
      syntax_error unless argument =~ /^(\S)(?: (\S+))?$/
      type_code = $1
      format_code = $2
      unless argument =~ /^([AEI]( [NTC])?|L .*)$/
        error 'Invalid type code', 504
      end
      case argument
      when /^A( [NT])?$/
        self.data_type = 'A'
      when /^(I|L 8)$/
        self.data_type = 'I'
      else
        error 'Type not implemented', 504
      end
      reply "200 Type set to #{data_type}"
    end

  end

end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
ftpd-1.1.1 lib/ftpd/cmd_type.rb
ftpd-1.1.0 lib/ftpd/cmd_type.rb
investtools-ftpd-1.0.1 lib/ftpd/cmd_type.rb
ftpd-1.0.1 lib/ftpd/cmd_type.rb
ftpd-1.0.0 lib/ftpd/cmd_type.rb
ftpd-0.17.0 lib/ftpd/cmd_type.rb