# File lib/puppet/network/http_server/webrick.rb, line 67
 67:       def initialize(hash = {})
 68:         Puppet.info "Starting server for Puppet version #{Puppet.version}"
 69: 
 70:         if handlers = hash[:Handlers]
 71:           handler_instances = setup_handlers(handlers)
 72:         else
 73:           raise ServerError, "A server must have handlers"
 74:         end
 75: 
 76:         unless self.read_cert
 77:           if ca = handler_instances.find { |handler| handler.is_a?(Puppet::Network::Handler.ca) }
 78:             request_cert(ca)
 79:           else
 80:             raise Puppet::Error, "No certificate and no CA; cannot get cert"
 81:           end
 82:         end
 83: 
 84:         setup_webrick(hash)
 85: 
 86:         begin
 87:           super(hash)
 88:         rescue => detail
 89:           puts detail.backtrace if Puppet[:trace]
 90:           raise Puppet::Error, "Could not start WEBrick: #{detail}"
 91:         end
 92: 
 93:         # make sure children don't inherit the sockets
 94:         listeners.each { |sock|
 95:           sock.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
 96:         }
 97: 
 98:         Puppet.info "Listening on port #{hash[:Port]}"
 99: 
100:         # this creates a new servlet for every connection,
101:         # but all servlets have the same list of handlers
102:         # thus, the servlets can have their own state -- passing
103:         # around the requests and such -- but the handlers
104:         # have a global state
105: 
106:         # mount has to be called after the server is initialized
107:         servlet = Puppet::Network::XMLRPC::WEBrickServlet.new( handler_instances)
108:         self.mount("/RPC2", servlet)
109:       end