[前][次][番号順一覧][スレッド一覧]

ruby-changes:63199

From: Yusuke <ko1@a...>
Date: Tue, 29 Sep 2020 16:40:49 +0900 (JST)
Subject: [ruby-changes:63199] d23d2f3f6f (master): [ruby/webrick] Make it more strict to interpret some headers

https://git.ruby-lang.org/ruby.git/commit/?id=d23d2f3f6f

From d23d2f3f6fbb5d787b0dd80675c489a692be23e2 Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Tue, 29 Sep 2020 13:15:58 +0900
Subject: [ruby/webrick] Make it more strict to interpret some headers

Some regexps were too tolerant.

https://github.com/ruby/webrick/commit/8946bb38b4

diff --git a/lib/webrick/httprequest.rb b/lib/webrick/httprequest.rb
index c781797..d1f0889 100644
--- a/lib/webrick/httprequest.rb
+++ b/lib/webrick/httprequest.rb
@@ -227,9 +227,9 @@ module WEBrick https://github.com/ruby/ruby/blob/trunk/lib/webrick/httprequest.rb#L227
         raise HTTPStatus::BadRequest, "bad URI `#{@unparsed_uri}'."
       end
 
-      if /close/io =~ self["connection"]
+      if /\Aclose\z/io =~ self["connection"]
         @keep_alive = false
-      elsif /keep-alive/io =~ self["connection"]
+      elsif /\Akeep-alive\z/io =~ self["connection"]
         @keep_alive = true
       elsif @http_version < "1.1"
         @keep_alive = false
@@ -508,7 +508,7 @@ module WEBrick https://github.com/ruby/ruby/blob/trunk/lib/webrick/httprequest.rb#L508
       return unless socket
       if tc = self['transfer-encoding']
         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}."
         end
       elsif self['content-length'] || @remaining_size
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]