mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[ruby/uri] Make URI::regexp schemes case sensitive
(https://github.com/ruby/uri/pull/38)
0c2b6468fa
This commit is contained in:
parent
c47a92b63d
commit
f1764623db
2 changed files with 9 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue