summaryrefslogtreecommitdiffstats
path: root/lib/puppet/network/http
diff options
context:
space:
mode:
authorLuke Kanies <luke@reductivelabs.com>2009-12-21 16:23:44 -0800
committerLuke Kanies <luke@reductivelabs.com>2009-12-21 16:23:44 -0800
commit740fd6b301af89ab3aad89bca183ad1fcdc24ac4 (patch)
treef34617a229509c373d28d67abb453e7ae2136c39 /lib/puppet/network/http
parent8971d8beae2c409f9052f27c3f80ad3bdfff4de2 (diff)
parent4a06379f8770c164e42bcc410d874076c6e95f24 (diff)
downloadpuppet-740fd6b301af89ab3aad89bca183ad1fcdc24ac4.tar.gz
puppet-740fd6b301af89ab3aad89bca183ad1fcdc24ac4.tar.xz
puppet-740fd6b301af89ab3aad89bca183ad1fcdc24ac4.zip
Merge branch '0.25.x'
Conflicts: lib/puppet/agent.rb lib/puppet/application/puppetd.rb lib/puppet/parser/ast/leaf.rb lib/puppet/util/rdoc/parser.rb
Diffstat (limited to 'lib/puppet/network/http')
-rw-r--r--lib/puppet/network/http/rack/httphandler.rb18
-rw-r--r--lib/puppet/network/http/rack/rest.rb8
-rw-r--r--lib/puppet/network/http/rack/xmlrpc.rb8
3 files changed, 8 insertions, 26 deletions
diff --git a/lib/puppet/network/http/rack/httphandler.rb b/lib/puppet/network/http/rack/httphandler.rb
index 31aa8371e..e14206850 100644
--- a/lib/puppet/network/http/rack/httphandler.rb
+++ b/lib/puppet/network/http/rack/httphandler.rb
@@ -12,23 +12,5 @@ class Puppet::Network::HTTP::RackHttpHandler
raise NotImplementedError, "Your RackHttpHandler subclass is supposed to override service(request)"
end
- def ssl_client_header(request)
- env_or_request_env(Puppet[:ssl_client_header], request)
- end
-
- def ssl_client_verify_header(request)
- env_or_request_env(Puppet[:ssl_client_verify_header], request)
- end
-
- # Older Passenger versions passed all Environment vars in app(env),
- # but since 2.2.3 they (some?) are really in ENV.
- # Mongrel, etc. may also still use request.env.
- def env_or_request_env(var, request)
- if ENV.include?(var)
- ENV[var]
- else
- request.env[var]
- end
- end
end
diff --git a/lib/puppet/network/http/rack/rest.rb b/lib/puppet/network/http/rack/rest.rb
index bdca651d1..104751271 100644
--- a/lib/puppet/network/http/rack/rest.rb
+++ b/lib/puppet/network/http/rack/rest.rb
@@ -63,11 +63,11 @@ class Puppet::Network::HTTP::RackREST < Puppet::Network::HTTP::RackHttpHandler
result[:ip] = request.ip
# if we find SSL info in the headers, use them to get a hostname.
- # try this with :ssl_client_header.
- # For Apache you need special configuration, see ext/rack/README.
- if dn = ssl_client_header(request) and dn_matchdata = dn.match(/^.*?CN\s*=\s*(.*)/)
+ # try this with :ssl_client_header, which defaults should work for
+ # Apache with StdEnvVars.
+ if dn = request.env[Puppet[:ssl_client_header]] and dn_matchdata = dn.match(/^.*?CN\s*=\s*(.*)/)
result[:node] = dn_matchdata[1].to_str
- result[:authenticated] = (ssl_client_verify_header(request) == 'SUCCESS')
+ result[:authenticated] = (request.env[Puppet[:ssl_client_verify_header]] == 'SUCCESS')
else
result[:node] = resolve_node(result)
result[:authenticated] = false
diff --git a/lib/puppet/network/http/rack/xmlrpc.rb b/lib/puppet/network/http/rack/xmlrpc.rb
index 9d0f486bc..4fc9e82fc 100644
--- a/lib/puppet/network/http/rack/xmlrpc.rb
+++ b/lib/puppet/network/http/rack/xmlrpc.rb
@@ -43,11 +43,11 @@ class Puppet::Network::HTTP::RackXMLRPC < Puppet::Network::HTTP::RackHttpHandler
ip = request.ip
# if we find SSL info in the headers, use them to get a hostname.
- # try this with :ssl_client_header.
- # For Apache you need special configuration, see ext/rack/README.
- if dn = ssl_client_header(request) and dn_matchdata = dn.match(/^.*?CN\s*=\s*(.*)/)
+ # try this with :ssl_client_header, which defaults should work for
+ # Apache with StdEnvVars.
+ if dn = request.env[Puppet[:ssl_client_header]] and dn_matchdata = dn.match(/^.*?CN\s*=\s*(.*)/)
node = dn_matchdata[1].to_str
- authenticated = (ssl_client_verify_header(request) == 'SUCCESS')
+ authenticated = (request.env[Puppet[:ssl_client_verify_header]] == 'SUCCESS')
else
begin
node = Resolv.getname(ip)