class FakeFtp::ServerCommands::Pasv

Public Instance Methods

run(ctx, *) click to toggle source
# 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