1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
gotoyuzo 2003-12-04 00:12:14 +00:00
parent dc9603bd5c
commit 8e1714488a
3 changed files with 23 additions and 6 deletions

View file

@ -1,3 +1,14 @@
Thu Dec 4 08:29:43 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
* 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.
Thu Dec 4 03:48:59 2003 Tanaka Akira <akr@m17n.org>
* lib/pathname.rb (Pathname#link, Pathname#symlink): obsoleted.

View file

@ -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

View file

@ -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)