Method: Ftpd::CmdType#cmd_type

Defined in:
lib/ftpd/cmd_type.rb

#cmd_type(argument) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ftpd/cmd_type.rb', line 9

def cmd_type(argument)
  ensure_logged_in
  syntax_error unless argument =~ /^\S(?: \S+)?$/
  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