parse228(resp)
private
handler for response code 228 (Entering Long Passive Mode)
Returns host and port.
Show source
def parse228(resp)
if !resp.start_with?("228")
raise FTPReplyError, resp
end
if m = /\(4,4,(?<host>\d+(,\d+){3}),2,(?<port>\d+,\d+)\)/.match(resp)
return parse_pasv_ipv4_host(m["host"]), parse_pasv_port(m["port"])
elsif m = /\(6,16,(?<host>\d+(,(\d+)){15}),2,(?<port>\d+,\d+)\)/.match(resp)
return parse_pasv_ipv6_host(m["host"]), parse_pasv_port(m["port"])
else
raise FTPProtoError, resp
end
end