mirror of
https://github.com/ruby/ruby.git
synced 2026-01-26 12:14:51 +00:00
[ruby/uri] Make URI::regexp schemes case sensitive
(https://github.com/ruby/uri/pull/38) https://github.com/ruby/uri/commit/0c2b6468fa
This commit is contained in:
parent
c47a92b63d
commit
f1764623db
@ -263,7 +263,7 @@ module URI
|
||||
unless schemes
|
||||
@regexp[:ABS_URI_REF]
|
||||
else
|
||||
/(?=#{Regexp.union(*schemes)}:)#{@pattern[:X_ABS_URI]}/x
|
||||
/(?=(?i:#{Regexp.union(*schemes).source}):)#{@pattern[:X_ABS_URI]}/x
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -113,4 +113,12 @@ class URI::TestParser < Test::Unit::TestCase
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_rfc2822_make_regexp
|
||||
parser = URI::RFC2396_Parser.new
|
||||
regexp = parser.make_regexp("HTTP")
|
||||
assert_match(regexp, "HTTP://EXAMPLE.COM/")
|
||||
assert_match(regexp, "http://example.com/")
|
||||
refute_match(regexp, "https://example.com/")
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user