diff options
author | Rick Bradley <rick@rickbradley.com> | 2007-10-15 23:04:24 -0500 |
---|---|---|
committer | Rick Bradley <rick@rickbradley.com> | 2007-10-15 23:04:24 -0500 |
commit | b1d62231c587e13ad78fe1bbd292a6c9f1cb99a1 (patch) | |
tree | d7a93ce3be6b72f43bff152418925eda609bd861 /lib/puppet | |
parent | 298eff27a6c702c177fa11e08c980c7365382162 (diff) | |
download | puppet-b1d62231c587e13ad78fe1bbd292a6c9f1cb99a1.tar.gz puppet-b1d62231c587e13ad78fe1bbd292a6c9f1cb99a1.tar.xz puppet-b1d62231c587e13ad78fe1bbd292a6c9f1cb99a1.zip |
Bringing in initial handlers for server+protocol pairs.
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/network/http/mongrel.rb | 16 | ||||
-rw-r--r-- | lib/puppet/network/http/webrick.rb | 15 |
2 files changed, 19 insertions, 12 deletions
diff --git a/lib/puppet/network/http/mongrel.rb b/lib/puppet/network/http/mongrel.rb index ab1e616b1..5b14d93c9 100644 --- a/lib/puppet/network/http/mongrel.rb +++ b/lib/puppet/network/http/mongrel.rb @@ -14,10 +14,10 @@ class Puppet::Network::HTTP::Mongrel @protocols = args[:protocols] @handlers = args[:handlers] - - setup_handlers - @server = Mongrel::HttpServer.new(args[:address], args[:port]) + + setup_handlers + @server.run @listening = true end @@ -37,12 +37,16 @@ class Puppet::Network::HTTP::Mongrel def setup_handlers @protocols.each do |protocol| @handlers.each do |handler| - class_for_protocol_handler(protocol, handler).new + class_for_protocol(protocol).new(:server => @server, :handler => handler) end end end - def class_for_protocol_handler(protocol, handler) - Class.new + # TODO/FIXME: need a spec which forces delegation to the real class + def class_for_protocol(protocol) + Class.new do + def initialize(args = {}) + end + end end end diff --git a/lib/puppet/network/http/webrick.rb b/lib/puppet/network/http/webrick.rb index 00d13437c..474f66e4f 100644 --- a/lib/puppet/network/http/webrick.rb +++ b/lib/puppet/network/http/webrick.rb @@ -14,12 +14,11 @@ class Puppet::Network::HTTP::WEBrick raise "WEBrick server is already listening" if listening? @protocols = args[:protocols] - @handlers = args[:handlers] + @handlers = args[:handlers] + @server = WEBrick::HTTPServer.new(:BindAddress => args[:address], :Port => args[:port]) setup_handlers - @server = WEBrick::HTTPServer.new(:BindAddress => args[:address], :Port => args[:port]) - # TODO / FIXME is this really necessary? -- or can we do it in both mongrel and webrick? Puppet.newservice(@server) Puppet.start @@ -42,12 +41,16 @@ class Puppet::Network::HTTP::WEBrick def setup_handlers @handlers.each do |handler| @protocols.each do |protocol| - class_for_protocol_handler(protocol, handler).new + class_for_protocol(protocol).new(:server => @server, :handler => handler) end end end - def class_for_protocol_handler(protocol, handler) - Class.new + # TODO/FIXME: need a spec which forces delegation to the real class + def class_for_protocol(protocol) + Class.new do + def initialize(args = {}) + end + end end end |