1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/lib/webrick
normal feafe07874 webrick: do not hang acceptor on slow TLS connections
OpenSSL::SSL::SSLSocket#accept may block indefinitely on clients
which negotiate the TCP connection, but fail (or are slow) to
negotiate the subsequent TLS handshake.  This prevents the
multi-threaded WEBrick server from accepting other connections.

Since the TLS handshake (via OpenSSL::SSL::SSLSocket#accept)
consists of normal read/write traffic over TCP, handle it in the
per-client thread, instead.

Furthermore, using non-blocking accept() is useful for non-TLS
sockets anyways because spurious wakeups are possible from
select(2).

* lib/webrick/server.rb (accept_client): use TCPServer#accept_nonblock
  and remove OpenSSL::SSL::SSLSocket#accept call
* lib/webrick/server.rb (start_thread): call OpenSSL::SSL::SSLSocket#accept
* test/webrick/test_ssl_server.rb (test_slow_connect): new test
  [ruby-core:83221] [Bug #14005]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-12 18:50:07 +00:00
..
httpauth
httpservlet Remove unnecessary require 'thread' 2017-10-08 07:00:01 +00:00
accesslog.rb
cgi.rb
compat.rb
config.rb Delay Utils.getservername until needed. 2016-12-07 12:59:48 +00:00
cookie.rb
htmlutils.rb
httpauth.rb
httpproxy.rb webrick: handle EAGAIN/EWOULDBLOCK on proxy connections 2017-09-19 08:39:22 +00:00
httprequest.rb
httpresponse.rb
https.rb webrick: fix SNI support 2017-07-18 01:59:28 +00:00
httpserver.rb
httpservlet.rb
httpstatus.rb lib/webrick/log.rb: sanitize any type of logs 2017-09-14 11:16:23 +00:00
httputils.rb Define the MIME type for JSON in WEBrick::HTTPUtils::DefaultMimeTypes. 2017-09-19 01:54:28 +00:00
httpversion.rb
log.rb lib/webrick/log.rb: sanitize any type of logs 2017-09-14 11:16:23 +00:00
server.rb webrick: do not hang acceptor on slow TLS connections 2017-10-12 18:50:07 +00:00
ssl.rb webrick: fix SNI support 2017-07-18 01:59:28 +00:00
utils.rb Remove unnecessary require 'thread' 2017-10-08 07:00:01 +00:00
version.rb Merge gemspec from ruby/webrick. 2017-05-01 10:20:35 +00:00
webrick.gemspec Fixed invalid gemspec. 2017-10-05 01:43:47 +00:00