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