From 6cf00e15f87236d79eff6092b91bb71a77f2c590 Mon Sep 17 00:00:00 2001 From: akr Date: Wed, 31 Dec 2014 08:50:10 +0000 Subject: * lib/resolv.rb (Resolv::DNS::Label::Str#initialize): Set encoding ASCII-8BIT before downcase. case insensivity of DNS labels doesn't apply non-ASCII characters. [RFC 4343] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/resolv.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/resolv.rb') diff --git a/lib/resolv.rb b/lib/resolv.rb index 3f3ed41a47..08bfde583b 100644 --- a/lib/resolv.rb +++ b/lib/resolv.rb @@ -1170,7 +1170,9 @@ class Resolv class Str # :nodoc: def initialize(string) @string = string - @downcase = string.downcase + # case insensivity of DNS labels doesn't apply non-ASCII characters. [RFC 4343] + # This assumes @string is given in ASCII compatible encoding. + @downcase = string.dup.force_encoding('ASCII-8BIT').downcase end attr_reader :string, :downcase -- cgit v1.2.3