[ruby/webrick] Make it more strict to interpret some headers
Some regexps were too tolerant. https://github.com/ruby/webrick/commit/8946bb38b4
This commit is contained in:
parent
dcb705ace7
commit
d23d2f3f6f
@ -227,9 +227,9 @@ module WEBrick
|
|||||||
raise HTTPStatus::BadRequest, "bad URI `#{@unparsed_uri}'."
|
raise HTTPStatus::BadRequest, "bad URI `#{@unparsed_uri}'."
|
||||||
end
|
end
|
||||||
|
|
||||||
if /close/io =~ self["connection"]
|
if /\Aclose\z/io =~ self["connection"]
|
||||||
@keep_alive = false
|
@keep_alive = false
|
||||||
elsif /keep-alive/io =~ self["connection"]
|
elsif /\Akeep-alive\z/io =~ self["connection"]
|
||||||
@keep_alive = true
|
@keep_alive = true
|
||||||
elsif @http_version < "1.1"
|
elsif @http_version < "1.1"
|
||||||
@keep_alive = false
|
@keep_alive = false
|
||||||
@ -508,7 +508,7 @@ module WEBrick
|
|||||||
return unless socket
|
return unless socket
|
||||||
if tc = self['transfer-encoding']
|
if tc = self['transfer-encoding']
|
||||||
case tc
|
case tc
|
||||||
when /chunked/io then read_chunked(socket, block)
|
when /\Achunked\z/io then read_chunked(socket, block)
|
||||||
else raise HTTPStatus::NotImplemented, "Transfer-Encoding: #{tc}."
|
else raise HTTPStatus::NotImplemented, "Transfer-Encoding: #{tc}."
|
||||||
end
|
end
|
||||||
elsif self['content-length'] || @remaining_size
|
elsif self['content-length'] || @remaining_size
|
||||||
|
Loading…
x
Reference in New Issue
Block a user