Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
commit bb314d33479b324c73da92292ba74117f45b8dce 1 parent d68b3a3
@shugo shugo authored
Showing with 12 additions and 8 deletions.
  1. +4 −0 ChangeLog
  2. +8 −8 lib/net/ftp.rb
View
4 ChangeLog
@@ -1,3 +1,7 @@
+Mon Mar 26 23:43:04 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/ftp.rb (parse227, parse228, parse229): don't use $~.
+
Mon Mar 26 23:34:40 2012 Shugo Maeda <shugo@ruby-lang.org>
* lib/net/ftp.rb (parse227, parse228, parse229): don't use local
View
16 lib/net/ftp.rb
@@ -923,8 +923,8 @@ def parse227(resp) # :nodoc:
if resp[0, 3] != "227"
raise FTPReplyError, resp
end
- if /\((?<host>\d+(,\d+){3}),(?<port>\d+,\d+)\)/ =~ resp
- return parse_pasv_ipv4_host($~["host"]), parse_pasv_port($~["port"])
+ if m = /\((?<host>\d+(,\d+){3}),(?<port>\d+,\d+)\)/.match(resp)
+ return parse_pasv_ipv4_host(m["host"]), parse_pasv_port(m["port"])
else
raise FTPProtoError, resp
end
@@ -939,10 +939,10 @@ def parse228(resp) # :nodoc:
if resp[0, 3] != "228"
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"])
- elsif /\(6,16,(?<host>\d+(,(\d+)){15}),2,(?<port>\d+,\d+)\)/ =~ resp
- return parse_pasv_ipv6_host($~["host"]), parse_pasv_port($~["port"])
+ 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
@@ -977,8 +977,8 @@ def parse229(resp) # :nodoc:
if resp[0, 3] != "229"
raise FTPReplyError, resp
end
- if /\((?<d>[!-~])\k<d>\k<d>(?<port>\d+)\k<d>\)/ =~ resp
- return @sock.peeraddr[3], $~["port"].to_i
+ if m = /\((?<d>[!-~])\k<d>\k<d>(?<port>\d+)\k<d>\)/.match(resp)
+ return @sock.peeraddr[3], m["port"].to_i
else
raise FTPProtoError, resp
end
Please sign in to comment.
Something went wrong with that request. Please try again.