Class: FakeFtp::ServerCommands::Pasv

Inherits:
Object
  • Object
show all
Defined in:
lib/fake_ftp/server_commands/pasv.rb

Instance Method Summary collapse

Instance Method Details

#run(ctx) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/fake_ftp/server_commands/pasv.rb', line 6

def run(ctx, *)
  return '502 Aww hell no, use Active' if ctx.passive_port.nil?
  ctx.mode = :passive
  p1 = (ctx.passive_port / 256).to_i
  p2 = ctx.passive_port % 256
  "227 Entering Passive Mode (127,0,0,1,#{p1},#{p2})"
end