summaryrefslogtreecommitdiffstats
path: root/lib/puppet/network/http_server
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/network/http_server')
-rw-r--r--lib/puppet/network/http_server/mongrel.rb8
-rw-r--r--lib/puppet/network/http_server/webrick.rb16
2 files changed, 8 insertions, 16 deletions
diff --git a/lib/puppet/network/http_server/mongrel.rb b/lib/puppet/network/http_server/mongrel.rb
index b26eee602..23ab40bb0 100644
--- a/lib/puppet/network/http_server/mongrel.rb
+++ b/lib/puppet/network/http_server/mongrel.rb
@@ -75,27 +75,27 @@ module Puppet::Network
def process(request, response)
# Make sure this has been a POST as required for XMLRPC.
request_method = request.params[Mongrel::Const::REQUEST_METHOD] || Mongrel::Const::GET
- if request_method != "POST" then
+ if request_method != "POST"
response.start(405) { |head, out| out.write("Method Not Allowed") }
return
end
# Make sure the user has sent text/xml data.
request_mime = request.params["CONTENT_TYPE"] || "text/plain"
- if parse_content_type(request_mime).first != "text/xml" then
+ if parse_content_type(request_mime).first != "text/xml"
response.start(400) { |head, out| out.write("Bad Request") }
return
end
# Make sure there is data in the body at all.
length = request.params[Mongrel::Const::CONTENT_LENGTH].to_i
- if length <= 0 then
+ if length <= 0
response.start(411) { |head, out| out.write("Length Required") }
return
end
# Check the body to be valid.
- if request.body.nil? or request.body.size != length then
+ if request.body.nil? or request.body.size != length
response.start(400) { |head, out| out.write("Bad Request") }
return
end
diff --git a/lib/puppet/network/http_server/webrick.rb b/lib/puppet/network/http_server/webrick.rb
index 6cf5c91fe..df7a87bf2 100644
--- a/lib/puppet/network/http_server/webrick.rb
+++ b/lib/puppet/network/http_server/webrick.rb
@@ -29,9 +29,7 @@ module Puppet
store = OpenSSL::X509::Store.new
store.purpose = OpenSSL::X509::PURPOSE_ANY
store.flags = OpenSSL::X509::V_FLAG_CRL_CHECK_ALL|OpenSSL::X509::V_FLAG_CRL_CHECK if Puppet.settings[:certificate_revocation]
- unless self.ca_cert
- raise Puppet::Error, "Could not find CA certificate"
- end
+ raise Puppet::Error, "Could not find CA certificate" unless self.ca_cert
store.add_file(Puppet[:localcacert])
store.add_crl(crl)
@@ -57,9 +55,7 @@ module Puppet
file_io.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
args << file_io
- if Puppet[:debug]
- args << WEBrick::Log::DEBUG
- end
+ args << WEBrick::Log::DEBUG if Puppet[:debug]
log = WEBrick::Log.new(*args)
@@ -115,16 +111,12 @@ module Puppet
# Create a ca client to set up our cert for us.
def request_cert(ca)
client = Puppet::Network::Client.ca.new(:CA => ca)
- unless client.request_cert
- raise Puppet::Error, "Could get certificate"
- end
+ raise Puppet::Error, "Could get certificate" unless client.request_cert
end
# Create all of our handler instances.
def setup_handlers(handlers)
- unless handlers.is_a?(Hash)
- raise ServerError, "Handlers must have arguments"
- end
+ raise ServerError, "Handlers must have arguments" unless handlers.is_a?(Hash)
handlers.collect { |handler, args|
hclass = nil