There was a race condition between the layers (SSL vs. TCP/IP) that permitted the creation of non-functional connections when webrick managed the connection. This patch moves the responsibility into our code via the provided callbacks and makes sure the socket is valid before accepting the connection.
Signed-off-by: Markus Roberts <[email protected]> --- lib/puppet/network/http/webrick.rb | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/lib/puppet/network/http/webrick.rb b/lib/puppet/network/http/webrick.rb index a60a22b..bf4bf88 100644 --- a/lib/puppet/network/http/webrick.rb +++ b/lib/puppet/network/http/webrick.rb @@ -31,13 +31,20 @@ class Puppet::Network::HTTP::WEBrick arguments.merge!(setup_ssl) @server = WEBrick::HTTPServer.new(arguments) + @server.listeners.each { |l| l.start_immediately = false } setup_handlers @mutex.synchronize do raise "WEBrick server is already listening" if @listening @listening = true - @thread = Thread.new { @server.start } + @thread = Thread.new { + @server.start { |sock| + raise "Client disconnected before connection could be established" unless IO.select([sock],nil,nil,0.1) + sock.accept + @server.run(sock) + } + } end end -- 1.6.4 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en -~----------~----~----~----~------~----~------~--~---
