# File lib/puppet/network/http_server/mongrel.rb, line 75
 75:         def process(request, response)
 76:             # Make sure this has been a POST as required for XMLRPC.
 77:             request_method = request.params[Mongrel::Const::REQUEST_METHOD] || Mongrel::Const::GET
 78:             if request_method != "POST" then
 79:                 response.start(405) { |head, out| out.write("Method Not Allowed") }
 80:                 return
 81:             end
 82: 
 83:             # Make sure the user has sent text/xml data.
 84:             request_mime = request.params["CONTENT_TYPE"] || "text/plain"
 85:             if parse_content_type(request_mime).first != "text/xml" then
 86:                 response.start(400) { |head, out| out.write("Bad Request") }
 87:                 return
 88:             end
 89: 
 90:             # Make sure there is data in the body at all.
 91:             length = request.params[Mongrel::Const::CONTENT_LENGTH].to_i
 92:             if length <= 0 then
 93:                 response.start(411) { |head, out| out.write("Length Required") }
 94:                 return
 95:             end
 96: 
 97:             # Check the body to be valid.
 98:             if request.body.nil? or request.body.size != length then
 99:                 response.start(400) { |head, out| out.write("Bad Request") }
100:                 return
101:             end
102: 
103:             info = client_info(request)
104: 
105:             # All checks above passed through
106:             response.start(200) do |head, out|
107:                 head["Content-Type"] = "text/xml; charset=utf-8"
108:                 begin
109:                     out.write(@xmlrpc_server.process(request.body, info))
110:                 rescue => detail
111:                     puts detail.backtrace
112:                     raise
113:                 end
114:             end
115:         end