From 719804b5df99feb8f8b871051d64bdd73524511f Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 8 May 2014 01:17:07 +0000 Subject: webrick/httpserver.rb: Stop handling requests on shutdown * lib/webrick/httpserver.rb (WEBrick::HTTPServer#run): stop handling requests on shutdown, even if the socket is readable and IO.select() returns true. [Fixes GH-607] * lib/webrick/server.rb (WEBrick::GenericServer#start): IO.select() raises ENOTSOCK on shutdown on Windows. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/webrick/httpserver.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/webrick/httpserver.rb') diff --git a/lib/webrick/httpserver.rb b/lib/webrick/httpserver.rb index 7a7b931dad..0618489c53 100644 --- a/lib/webrick/httpserver.rb +++ b/lib/webrick/httpserver.rb @@ -73,10 +73,10 @@ module WEBrick timeout = @config[:RequestTimeout] while timeout > 0 break if IO.select([sock], nil, nil, 0.5) - timeout = 0 if @status != :Running + break if @status != :Running timeout -= 0.5 end - raise HTTPStatus::EOFError if timeout <= 0 + raise HTTPStatus::EOFError if timeout <= 0 || @status != :Running raise HTTPStatus::EOFError if sock.eof? req.parse(sock) res.request_method = req.request_method -- cgit v1.2.3