aboutsummaryrefslogtreecommitdiffstats
path: root/lib/uri
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-14 01:11:28 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-14 01:11:28 +0000
commitffb265ed1b21b2292fe7a9b05293a62bae8aff30 (patch)
tree086880e77cbc13daa1b12cd83b4e55c6f30fc003 /lib/uri
parente3e162a24cb924b79f7f91e67dbf92079dc60644 (diff)
downloadruby-ffb265ed1b21b2292fe7a9b05293a62bae8aff30.tar.gz
Allow empty path components in a URI [Bug #8352]
* generic.rb (URI::Generic#merge, URI::Generic#route_to): Fix a bug where a sequence of slashes in the path part gets collapsed to a single slash. According to the relevant RFCs and WHATWG URL Standard, empty path components are simply valid and there is no special treatment defined for them, so we just keep them as they are. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/uri')
-rw-r--r--lib/uri/generic.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb
index dc4f9c4c30..629323e80e 100644
--- a/lib/uri/generic.rb
+++ b/lib/uri/generic.rb
@@ -979,7 +979,7 @@ module URI
# returns an Array of the path split on '/'
#
def split_path(path)
- path.split(%r{/+}, -1)
+ path.split(%r{/}, -1)
end
private :split_path
@@ -1154,8 +1154,8 @@ module URI
return dst.dup
end
- src_path = src.scan(%r{(?:\A|[^/]+)/})
- dst_path = dst.scan(%r{(?:\A|[^/]+)/?})
+ src_path = src.scan(%r{[^/]*/})
+ dst_path = dst.scan(%r{[^/]*/?})
# discard same parts
while !dst_path.empty? && dst_path.first == src_path.first