diff options
author | Luke Kanies <luke@madstop.com> | 2008-05-02 12:58:35 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-05-02 12:58:35 -0500 |
commit | 31b79fa7760f95059a4e2afb35e734de283cf4a0 (patch) | |
tree | 5e8cf6732758e3548103d2523fccecb056c39c1d /lib/puppet | |
parent | 7a876ed6a06bc5decb257126eb57368aeb178a81 (diff) | |
download | puppet-31b79fa7760f95059a4e2afb35e734de283cf4a0.tar.gz puppet-31b79fa7760f95059a4e2afb35e734de283cf4a0.tar.xz puppet-31b79fa7760f95059a4e2afb35e734de283cf4a0.zip |
Adding xmlrpc support to webrick.
This provides the backward compatibility for webrick,
and only Mongrel is left.
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/network/http/mongrel.rb | 1 | ||||
-rw-r--r-- | lib/puppet/network/http/webrick.rb | 22 |
2 files changed, 20 insertions, 3 deletions
diff --git a/lib/puppet/network/http/mongrel.rb b/lib/puppet/network/http/mongrel.rb index 9a4531c7a..5e93b88ba 100644 --- a/lib/puppet/network/http/mongrel.rb +++ b/lib/puppet/network/http/mongrel.rb @@ -38,6 +38,7 @@ class Puppet::Network::HTTP::Mongrel def setup_handlers @protocols.each do |protocol| + next if protocol == :xmlrpc klass = class_for_protocol(protocol) @handlers.each do |handler| @server.register('/' + handler.to_s, klass.new(:server => @server, :handler => handler)) diff --git a/lib/puppet/network/http/webrick.rb b/lib/puppet/network/http/webrick.rb index 2b3eace48..36fb0776b 100644 --- a/lib/puppet/network/http/webrick.rb +++ b/lib/puppet/network/http/webrick.rb @@ -25,6 +25,7 @@ class Puppet::Network::HTTP::WEBrick @protocols = args[:protocols] @handlers = args[:handlers] + @xmlrpc_handlers = args[:xmlrpc_handlers] arguments = {:BindAddress => args[:address], :Port => args[:port]} arguments.merge!(setup_logger) @@ -105,9 +106,6 @@ class Puppet::Network::HTTP::WEBrick results[:SSLCACertificateFile] = Puppet[:localcacert] results[:SSLVerifyClient] = OpenSSL::SSL::VERIFY_PEER - # LAK:NOTE I'm not sure why this is this way, actually. - results[:SSLCertName] = nil - results[:SSLCertificateStore] = setup_ssl_store if Puppet[:hostcrl] != 'false' results @@ -130,12 +128,30 @@ class Puppet::Network::HTTP::WEBrick private def setup_handlers + # Set up the new-style protocols. @protocols.each do |protocol| + next if protocol == :xmlrpc klass = self.class.class_for_protocol(protocol) @handlers.each do |handler| @server.mount('/' + handler.to_s, klass, handler) @server.mount('/' + handler.to_s + 's', klass, handler) end end + + # And then set up xmlrpc, if configured. + if @protocols.include?(:xmlrpc) and ! @xmlrpc_handlers.empty? + @server.mount("/RPC2", xmlrpc_servlet) + end + end + + # Create our xmlrpc servlet, which provides backward compatibility. + def xmlrpc_servlet + handlers = @xmlrpc_handlers.collect { |handler| + unless hclass = Puppet::Network::Handler.handler(handler) + raise "Invalid xmlrpc handler %s" % handler + end + hclass.new({}) + } + Puppet::Network::XMLRPC::WEBrickServlet.new handlers end end |