1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/webrick] Remove the squishing of whitespace in header values

While the stripping of header values is required by RFC 2616 4.2 and
RFC 7230 3.2.4, the squishing is not and can break things, such as
when one header contains an HMAC of another header.

Fixes Ruby Bug 7021.

https://github.com/ruby/webrick/commit/8b96088a86
This commit is contained in:
Jeremy Evans 2019-08-06 15:48:18 -07:00 committed by Hiroshi SHIBATA
parent 84ed4c3d59
commit 37c266aa57
2 changed files with 2 additions and 5 deletions

View file

@ -162,10 +162,7 @@ module WEBrick
end
}
header.each{|key, values|
values.each{|value|
value.strip!
value.gsub!(/\s+/, " ")
}
values.each(&:strip!)
}
header
end

View file

@ -135,7 +135,7 @@ GET /
assert_equal("", req.script_name)
assert_equal("/foo/baz", req.path_info)
assert_equal("9", req['content-length'])
assert_equal("FOO BAR BAZ", req['user-agent'])
assert_equal("FOO BAR BAZ", req['user-agent'])
assert_equal("hogehoge\n", req.body)
end