diff options
Diffstat (limited to 'lib/puppet/network/http')
| -rw-r--r-- | lib/puppet/network/http/api/v1.rb | 4 | ||||
| -rw-r--r-- | lib/puppet/network/http/mongrel.rb | 4 | ||||
| -rw-r--r-- | lib/puppet/network/http/rack/xmlrpc.rb | 4 | ||||
| -rw-r--r-- | lib/puppet/network/http/webrick.rb | 8 | ||||
| -rw-r--r-- | lib/puppet/network/http/webrick/rest.rb | 4 |
5 files changed, 7 insertions, 17 deletions
diff --git a/lib/puppet/network/http/api/v1.rb b/lib/puppet/network/http/api/v1.rb index 25e27c486..347da93a6 100644 --- a/lib/puppet/network/http/api/v1.rb +++ b/lib/puppet/network/http/api/v1.rb @@ -39,9 +39,7 @@ module Puppet::Network::HTTP::API::V1 end def indirection_method(http_method, indirection) - unless METHOD_MAP[http_method] - raise ArgumentError, "No support for http method #{http_method}" - end + raise ArgumentError, "No support for http method #{http_method}" unless METHOD_MAP[http_method] unless method = METHOD_MAP[http_method][plurality(indirection)] raise ArgumentError, "No support for plural #{http_method} operations" diff --git a/lib/puppet/network/http/mongrel.rb b/lib/puppet/network/http/mongrel.rb index 8181600e3..88494eea8 100644 --- a/lib/puppet/network/http/mongrel.rb +++ b/lib/puppet/network/http/mongrel.rb @@ -40,9 +40,7 @@ class Puppet::Network::HTTP::Mongrel klass = class_for_protocol(:rest) @server.register('/', klass.new(:server => @server)) - if @protocols.include?(:xmlrpc) and ! @xmlrpc_handlers.empty? - setup_xmlrpc_handlers - end + setup_xmlrpc_handlers if @protocols.include?(:xmlrpc) and ! @xmlrpc_handlers.empty? end # Use our existing code to provide the xmlrpc backward compatibility. diff --git a/lib/puppet/network/http/rack/xmlrpc.rb b/lib/puppet/network/http/rack/xmlrpc.rb index 49eb6fe49..9192b1d48 100644 --- a/lib/puppet/network/http/rack/xmlrpc.rb +++ b/lib/puppet/network/http/rack/xmlrpc.rb @@ -18,12 +18,12 @@ class Puppet::Network::HTTP::RackXMLRPC < Puppet::Network::HTTP::RackHttpHandler def process(request, response) # errors are sent as text/plain response['Content-Type'] = 'text/plain' - if not request.post? then + if not request.post? response.status = 405 response.write 'Method Not Allowed' return end - if request.media_type() != "text/xml" then + if request.media_type() != "text/xml" response.status = 400 response.write 'Bad Request' return diff --git a/lib/puppet/network/http/webrick.rb b/lib/puppet/network/http/webrick.rb index d0533f7ff..66932ad2c 100644 --- a/lib/puppet/network/http/webrick.rb +++ b/lib/puppet/network/http/webrick.rb @@ -105,9 +105,7 @@ class Puppet::Network::HTTP::WEBrick results[:SSLStartImmediately] = true results[:SSLEnable] = true - unless Puppet::SSL::Certificate.find(Puppet::SSL::CA_NAME) - raise Puppet::Error, "Could not find CA certificate" - end + raise Puppet::Error, "Could not find CA certificate" unless Puppet::SSL::Certificate.find(Puppet::SSL::CA_NAME) results[:SSLCACertificateFile] = Puppet[:localcacert] results[:SSLVerifyClient] = OpenSSL::SSL::VERIFY_PEER @@ -125,9 +123,7 @@ class Puppet::Network::HTTP::WEBrick @server.mount('/', klass, :this_value_is_apparently_necessary_but_unused) # And then set up xmlrpc, if configured. - if @protocols.include?(:xmlrpc) and ! @xmlrpc_handlers.empty? - @server.mount("/RPC2", xmlrpc_servlet) - end + @server.mount("/RPC2", xmlrpc_servlet) if @protocols.include?(:xmlrpc) and ! @xmlrpc_handlers.empty? end # Create our xmlrpc servlet, which provides backward compatibility. diff --git a/lib/puppet/network/http/webrick/rest.rb b/lib/puppet/network/http/webrick/rest.rb index 9bfd0ce6a..9a8bf0a83 100644 --- a/lib/puppet/network/http/webrick/rest.rb +++ b/lib/puppet/network/http/webrick/rest.rb @@ -52,9 +52,7 @@ class Puppet::Network::HTTP::WEBrickREST < WEBrick::HTTPServlet::AbstractServlet response.status = status if status >= 200 and status != 304 response.body = result - if result.is_a?(File) - response["content-length"] = result.stat.size - end + response["content-length"] = result.stat.size if result.is_a?(File) end response.reason_phrase = result if status < 200 or status >= 300 end |
