summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-11 02:28:53 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-11 02:28:53 +0000
commitdbab45654393ad38e9fcb6210308e5b044f15bd5 (patch)
tree5576e8cb64d9687850a5a07d53664d8e4b7064a0
parentd8cf72f4189e701172878836becef3f047a57dc5 (diff)
merge revision(s) 39299,39300: [Backport #7477]
* lib/ipaddr.rb (IPAddr#in6_addr): Fix the parser so that it can recognize IPv6 addresses with only one edge 16-bit piece compressed, like [::2:3:4:5:6:7:8] or [1:2:3:4:5:6:7::]. [Bug #7477] * lib/ipaddr.rb (IPAddr#in6_addr): Fix a typo with the closing parenthesis. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@40230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog12
-rw-r--r--lib/ipaddr.rb7
-rw-r--r--version.h2
3 files changed, 19 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 9c2ef9ccd9..6711d7a615 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Thu Apr 11 11:24:42 2013 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/ipaddr.rb (IPAddr#in6_addr): Fix a typo with the closing
+ parenthesis.
+
+Thu Apr 11 11:24:42 2013 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/ipaddr.rb (IPAddr#in6_addr): Fix the parser so that it can
+ recognize IPv6 addresses with only one edge 16-bit piece
+ compressed, like [::2:3:4:5:6:7:8] or [1:2:3:4:5:6:7::].
+ [Bug #7477]
+
Thu Apr 11 11:22:32 2013 Naohisa Goto <ngoto@gen-info.osaka-u.ac.jp>
* string.c (rb_str_concat): set array element after definition
diff --git a/lib/ipaddr.rb b/lib/ipaddr.rb
index b6bea19832..4d5e3f419f 100644
--- a/lib/ipaddr.rb
+++ b/lib/ipaddr.rb
@@ -534,7 +534,8 @@ class IPAddr
left = $1
right = $3 + '0:0'
else
- left.count(':') <= 7 or raise ArgumentError, "invalid address"
+ left.count(':') <= ($1.empty? || $2.empty? ? 8 : 7) or
+ raise InvalidAddressError, "invalid address"
left = $1
right = $2
addr = 0
@@ -656,6 +657,8 @@ class TC_IPAddr < Test::Unit::TestCase
["0:0:0:1::"],
["2001:200:300::/48"],
["2001:200:300::192.168.1.2/48"],
+ ["1:2:3:4:5:6:7::"],
+ ["::2:3:4:5:6:7:8"],
].each { |args|
assert_nothing_raised {
IPAddr.new(*args)
@@ -712,6 +715,8 @@ class TC_IPAddr < Test::Unit::TestCase
assert_equal("2001:200:300::", IPAddr.new("2001:200:300::/48").to_s)
assert_equal("2001:200:300::", IPAddr.new("[2001:200:300::]/48").to_s)
+ assert_equal("1:2:3:4:5:6:7:0", IPAddr.new("1:2:3:4:5:6:7::").to_s)
+ assert_equal("0:2:3:4:5:6:7:8", IPAddr.new("::2:3:4:5:6:7:8").to_s)
[
["192.168.0.256"],
diff --git a/version.h b/version.h
index b989fdece9..42b30cc0e2 100644
--- a/version.h
+++ b/version.h
@@ -1,5 +1,5 @@
#define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 414
+#define RUBY_PATCHLEVEL 415
#define RUBY_RELEASE_DATE "2013-04-11"
#define RUBY_RELEASE_YEAR 2013