mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/webrick/server.rb (WEBrick::GenericServer#accept_client):
should rescue Errno::EINVAL from TCPServer#accept. this exception might occur if the server socket is not in ready to listen. * lib/webrick/server.rb (WEBrick::GenericServer#accept_client): don't call TCPServer#close if the :ShutdownSocketWithoutClose is set. * lib/webrick/config.rb (WEBrick::Config::General): add new parameter :ShutdownSocketWithoutClose. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d99a343dfd
commit
a04281ff0e
3 changed files with 19 additions and 4 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
Tue Dec 18 23:27:51 2007 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
||||||
|
|
||||||
|
* lib/webrick/server.rb (WEBrick::GenericServer#accept_client):
|
||||||
|
should rescue Errno::EINVAL from TCPServer#accept. this exception
|
||||||
|
might occur if the server socket is not in ready to listen.
|
||||||
|
|
||||||
|
* lib/webrick/server.rb (WEBrick::GenericServer#accept_client):
|
||||||
|
don't call TCPServer#close if the :ShutdownSocketWithoutClose is set.
|
||||||
|
|
||||||
|
* lib/webrick/config.rb (WEBrick::Config::General): add new parameter
|
||||||
|
:ShutdownSocketWithoutClose.
|
||||||
|
|
||||||
Tue Dec 18 22:51:47 2007 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
Tue Dec 18 22:51:47 2007 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
||||||
|
|
||||||
* ext/openssl/lib/openssl/ssl.rb (OpenSSL::SSL::SSLServer#shutdown):
|
* ext/openssl/lib/openssl/ssl.rb (OpenSSL::SSL::SSLServer#shutdown):
|
||||||
|
|
|
@ -34,6 +34,7 @@ module WEBrick
|
||||||
:StopCallback => nil,
|
:StopCallback => nil,
|
||||||
:AcceptCallback => nil,
|
:AcceptCallback => nil,
|
||||||
:DoNotReverseLookup => nil,
|
:DoNotReverseLookup => nil,
|
||||||
|
:ShutdownSocketWithoutClose => false,
|
||||||
}
|
}
|
||||||
|
|
||||||
# for HTTPServer, HTTPRequest, HTTPResponse ...
|
# for HTTPServer, HTTPRequest, HTTPResponse ...
|
||||||
|
|
|
@ -129,7 +129,10 @@ module WEBrick
|
||||||
addr = s.addr
|
addr = s.addr
|
||||||
@logger.debug("close TCPSocket(#{addr[2]}, #{addr[1]})")
|
@logger.debug("close TCPSocket(#{addr[2]}, #{addr[1]})")
|
||||||
end
|
end
|
||||||
|
s.shutdown
|
||||||
|
unless @config[:ShutdownSocketWithoutClose]
|
||||||
s.close
|
s.close
|
||||||
|
end
|
||||||
}
|
}
|
||||||
@listeners.clear
|
@listeners.clear
|
||||||
end
|
end
|
||||||
|
@ -147,9 +150,8 @@ module WEBrick
|
||||||
sock.sync = true
|
sock.sync = true
|
||||||
Utils::set_non_blocking(sock)
|
Utils::set_non_blocking(sock)
|
||||||
Utils::set_close_on_exec(sock)
|
Utils::set_close_on_exec(sock)
|
||||||
rescue Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPROTO => ex
|
rescue Errno::ECONNRESET, Errno::ECONNABORTED,
|
||||||
# TCP connection was established but RST segment was sent
|
Errno::EPROTO, Errno::EINVAL => ex
|
||||||
# from peer before calling TCPServer#accept.
|
|
||||||
rescue Exception => ex
|
rescue Exception => ex
|
||||||
msg = "#{ex.class}: #{ex.message}\n\t#{ex.backtrace[0]}"
|
msg = "#{ex.class}: #{ex.message}\n\t#{ex.backtrace[0]}"
|
||||||
@logger.error msg
|
@logger.error msg
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue