diff --git lib/webrick/httprequest.rb lib/webrick/httprequest.rb index e402099a30..c73f48c6df 100644 --- lib/webrick/httprequest.rb +++ lib/webrick/httprequest.rb @@ -226,9 +226,9 @@ def parse(socket=nil) 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 @@ -503,7 +503,7 @@ def read_body(socket, block) 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 diff --git lib/webrick/version.rb lib/webrick/version.rb index ee6b415eef..c23df9a912 100644 --- lib/webrick/version.rb +++ lib/webrick/version.rb @@ -14,5 +14,5 @@ module WEBrick ## # The WEBrick version - VERSION = "1.4.2" + VERSION = "1.4.4" end diff --git test/webrick/test_httpproxy.rb test/webrick/test_httpproxy.rb index a9f6f7d610..504eb1f915 100644 --- test/webrick/test_httpproxy.rb +++ test/webrick/test_httpproxy.rb @@ -213,7 +213,7 @@ def test_big_bodies end end end - end + end if RUBY_VERSION >= '2.5' def make_certificate(key, cn) subject = OpenSSL::X509::Name.parse("/DC=org/DC=ruby-lang/CN=#{cn}") diff --git test/webrick/test_httpserver.rb test/webrick/test_httpserver.rb index a6e70da7e8..2e5d44940c 100644 --- test/webrick/test_httpserver.rb +++ test/webrick/test_httpserver.rb @@ -253,7 +253,7 @@ def test_callbacks server.virtual_host(WEBrick::HTTPServer.new(vhost_config)) Thread.pass while server.status != :Running - sleep 1 if RubyVM::MJIT.enabled? # server.status behaves unexpectedly with --jit-wait + sleep 1 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # server.status behaves unexpectedly with --jit-wait assert_equal(1, started, log.call) assert_equal(0, stopped, log.call) assert_equal(0, accepted, log.call) diff --git test/webrick/test_server.rb test/webrick/test_server.rb index 5f7f3a0b58..8162a186db 100644 --- test/webrick/test_server.rb +++ test/webrick/test_server.rb @@ -65,7 +65,7 @@ def test_callbacks } TestWEBrick.start_server(Echo, config){|server, addr, port, log| true while server.status != :Running - sleep 1 if RubyVM::MJIT.enabled? # server.status behaves unexpectedly with --jit-wait + sleep 1 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # server.status behaves unexpectedly with --jit-wait assert_equal(1, started, log.call) assert_equal(0, stopped, log.call) assert_equal(0, accepted, log.call)