* lib/net/ftp.rb (parse227, parse228, parse229): don't use local

variables defined by named capture for other Ruby implementations
  such as Rubinius.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shugo 2012-03-26 14:39:21 +00:00
Родитель 422c8baeb9
Коммит d68b3a38e9
2 изменённых файлов: 10 добавлений и 4 удалений

Просмотреть файл

@ -1,3 +1,9 @@
Mon Mar 26 23:34:40 2012 Shugo Maeda <shugo@ruby-lang.org>
* lib/net/ftp.rb (parse227, parse228, parse229): don't use local
variables defined by named capture for other Ruby implementations
such as Rubinius.
Mon Mar 26 23:19:03 2012 Shugo Maeda <shugo@ruby-lang.org>
* lib/net/ftp.rb (parse_pasv_port): refactored.

Просмотреть файл

@ -924,7 +924,7 @@ module Net
raise FTPReplyError, resp
end
if /\((?<host>\d+(,\d+){3}),(?<port>\d+,\d+)\)/ =~ resp
return parse_pasv_ipv4_host(host), parse_pasv_port(port)
return parse_pasv_ipv4_host($~["host"]), parse_pasv_port($~["port"])
else
raise FTPProtoError, resp
end
@ -940,9 +940,9 @@ module Net
raise FTPReplyError, resp
end
if /\(4,4,(?<host>\d+(,\d+){3}),2,(?<port>\d+,\d+)\)/ =~ resp
return parse_pasv_ipv4_host(host), parse_pasv_port(port)
return parse_pasv_ipv4_host($~["host"]), parse_pasv_port($~["port"])
elsif /\(6,16,(?<host>\d+(,(\d+)){15}),2,(?<port>\d+,\d+)\)/ =~ resp
return parse_pasv_ipv6_host(host), parse_pasv_port(port)
return parse_pasv_ipv6_host($~["host"]), parse_pasv_port($~["port"])
else
raise FTPProtoError, resp
end
@ -978,7 +978,7 @@ module Net
raise FTPReplyError, resp
end
if /\((?<d>[!-~])\k<d>\k<d>(?<port>\d+)\k<d>\)/ =~ resp
return @sock.peeraddr[3], port.to_i
return @sock.peeraddr[3], $~["port"].to_i
else
raise FTPProtoError, resp
end