diff options
author | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-12-04 00:12:14 +0000 |
---|---|---|
committer | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-12-04 00:12:14 +0000 |
commit | 8e1714488ae78589741991ba7cc72b1c9e3e4028 (patch) | |
tree | b6b13564030628640e7026271b47e878891a4c9c /lib | |
parent | dc9603bd5c6b9618e1f4aa8a48c020c56425366f (diff) |
* lib/webrick/server.rb (GenericServer#start): should rescue
Exception to avoid unexpected aborting. [ruby-core:01853]
* lib/webrick/server.rb (GenericServer#start_thread): should check
that peeraddr isn't nil before printing.
* lib/webrick/httpresponse.rb (HTTPResponse#start_thread): should
rescue Exception to avoid unexpected aborting of thread.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/webrick/httpresponse.rb | 6 | ||||
-rw-r--r-- | lib/webrick/server.rb | 12 |
2 files changed, 12 insertions, 6 deletions
diff --git a/lib/webrick/httpresponse.rb b/lib/webrick/httpresponse.rb index 667c4c46cd..9d6e5522ed 100644 --- a/lib/webrick/httpresponse.rb +++ b/lib/webrick/httpresponse.rb @@ -84,10 +84,10 @@ module WEBrick setup_header() send_header(socket) send_body(socket) - rescue Errno::EPIPE - @logger.error("HTTPResponse#send_response: EPIPE occured.") + rescue Errno::EPIPE, Errno::ECONNRESET, Errno::ENOTCONN => ex + @logger.debug(ex) @keep_alive = false - rescue => ex + rescue Exception => ex @logger.error(ex) @keep_alive = false end diff --git a/lib/webrick/server.rb b/lib/webrick/server.rb index f89115f035..93e3b2ccf5 100644 --- a/lib/webrick/server.rb +++ b/lib/webrick/server.rb @@ -102,7 +102,7 @@ module WEBrick rescue Errno::EBADF, IOError => ex # if the listening socket was closed in GenericServer#shutdown, # IO::select raise it. - rescue => ex + rescue Exception => ex msg = "#{ex.class}: #{ex.message}\n\t#{ex.backtrace[0]}" @logger.error msg end @@ -148,14 +148,20 @@ module WEBrick @logger.debug "accept: #{addr[3]}:#{addr[1]}" call_callback(:AcceptCallback, sock) block ? block.call(sock) : run(sock) - rescue ServerError, Errno::ENOTCONN => ex + rescue Errno::ENOTCONN + @logger.debug "Errno::ENOTCONN raised" + rescue ServerError => ex msg = "#{ex.class}: #{ex.message}\n\t#{ex.backtrace[0]}" @logger.error msg rescue Exception => ex @logger.error ex ensure Thread.current[:WEBrickSocket] = nil - @logger.debug "close: #{addr[3]}:#{addr[1]}" + if addr + @logger.debug "close: #{addr[3]}:#{addr[1]}" + else + @logger.debug "close: <address unknown>" + end sock.close end @tokens.push(nil) |