File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -497,8 +497,8 @@ def initialize_regexp(pattern)
497
497
ret = { }
498
498
499
499
# for URI::split
500
- ret [ :ABS_URI ] = Regexp . new ( '\A\s*' + pattern [ :X_ABS_URI ] + '\s*\z' , Regexp ::EXTENDED )
501
- ret [ :REL_URI ] = Regexp . new ( '\A\s*' + pattern [ :X_REL_URI ] + '\s*\z' , Regexp ::EXTENDED )
500
+ ret [ :ABS_URI ] = Regexp . new ( '\A\s*+ ' + pattern [ :X_ABS_URI ] + '\s*\z' , Regexp ::EXTENDED )
501
+ ret [ :REL_URI ] = Regexp . new ( '\A\s*+ ' + pattern [ :X_REL_URI ] + '\s*\z' , Regexp ::EXTENDED )
502
502
503
503
# for URI::extract
504
504
ret [ :URI_REF ] = Regexp . new ( pattern [ :URI_REF ] )
Original file line number Diff line number Diff line change @@ -87,4 +87,16 @@ def test_split
87
87
URI . parse ( "foo@example:foo" )
88
88
end
89
89
end
90
+
91
+ def test_rfc2822_parse_relative_uri
92
+ pre = -> ( length ) {
93
+ " " * length + "\0 "
94
+ }
95
+ parser = URI ::RFC2396_Parser . new
96
+ assert_linear_performance ( ( 1 ..5 ) . map { |i | 10 **i } , pre : pre ) do |uri |
97
+ assert_raise ( URI ::InvalidURIError ) do
98
+ parser . split ( uri )
99
+ end
100
+ end
101
+ end
90
102
end
You can’t perform that action at this time.
0 commit comments