Sha256: 25163f72d5b7ca8135a92d4b1154f83a06d7be7fa1cfd40eb53df493164cef98

Contents?: true

Size: 585 Bytes

Versions: 5

Compression:

Stored size: 585 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 '504 Invalid type code'
      end
      case argument
      when /^A( [NT])?$/
        self.data_type = 'A'
      when /^(I|L 8)$/
        self.data_type = 'I'
      else
        error '504 Type not implemented'
      end
      reply "200 Type set to #{data_type}"
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ftpd-0.16.0 lib/ftpd/cmd_type.rb
ftpd-0.15.0 lib/ftpd/cmd_type.rb
ftpd-0.14.0 lib/ftpd/cmd_type.rb
ftpd-0.13.0 lib/ftpd/cmd_type.rb
ftpd-0.12.0 lib/ftpd/cmd_type.rb