+1 On Sep 14, 2009, at 5:08 PM, Markus Roberts wrote:
> > 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 > > > > -- The most incomprehensible thing about the world is that it is at all comprehensible. --Albert Einstein --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
