puppet 3.3.1.rc1 → 3.3.1.rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/puppet/network/http/rack/rest.rb +17 -1
- data/lib/puppet/version.rb +1 -1
- data/spec/lib/puppet_spec/matchers.rb +10 -0
- data/spec/unit/network/http/rack/rest_spec.rb +19 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d2fd11250a51541a228242c70e648a625e8fc08
|
4
|
+
data.tar.gz: c0f9bc3f60a9306296d01e6b4f40520399230d6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3aac39e3ed1d2eeb992fa912576ae3a26749ee3e0b26c642616000080c961f471448b2ecc1f2ac920b1aaad04d2d3eb9c1fae2e252d49bd72985f6b5d50ef2f3
|
7
|
+
data.tar.gz: dd42835bc9e0049cc3d1b3145e9395efd3a0700a894a24bc34756e2cfcf9a3ba080a1e445900f57c5846b5d9fdefe7f4ac5731b554ca3502fb6945d612d60eeb
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'openssl'
|
2
|
+
require 'cgi'
|
2
3
|
require 'puppet/network/http/handler'
|
3
4
|
require 'puppet/network/http/rack/httphandler'
|
4
5
|
require 'puppet/util/ssl'
|
@@ -73,7 +74,15 @@ class Puppet::Network::HTTP::RackREST < Puppet::Network::HTTP::RackHttpHandler
|
|
73
74
|
|
74
75
|
# Return the query params for this request.
|
75
76
|
def params(request)
|
76
|
-
|
77
|
+
if request.post?
|
78
|
+
params = request.params
|
79
|
+
else
|
80
|
+
# rack doesn't support multi-valued query parameters,
|
81
|
+
# e.g. ignore, so parse them ourselves
|
82
|
+
params = CGI.parse(request.query_string)
|
83
|
+
convert_singular_arrays_to_value(params)
|
84
|
+
end
|
85
|
+
result = decode_params(params)
|
77
86
|
result.merge(extract_client_info(request))
|
78
87
|
end
|
79
88
|
|
@@ -125,4 +134,11 @@ class Puppet::Network::HTTP::RackREST < Puppet::Network::HTTP::RackHttpHandler
|
|
125
134
|
result
|
126
135
|
end
|
127
136
|
|
137
|
+
def convert_singular_arrays_to_value(hash)
|
138
|
+
hash.each do |key, value|
|
139
|
+
if value.size == 1
|
140
|
+
hash[key] = value.first
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
128
144
|
end
|
data/lib/puppet/version.rb
CHANGED
@@ -103,3 +103,13 @@ RSpec::Matchers.define :equal_attributes_of do |expected|
|
|
103
103
|
end
|
104
104
|
end
|
105
105
|
end
|
106
|
+
|
107
|
+
RSpec::Matchers.define :be_one_of do |*expected|
|
108
|
+
match do |actual|
|
109
|
+
expected.include? actual
|
110
|
+
end
|
111
|
+
|
112
|
+
failure_message_for_should do |actual|
|
113
|
+
"expected #{actual.inspect} to be one of #{expected.map(&:inspect).join(' or ')}"
|
114
|
+
end
|
115
|
+
end
|
@@ -148,6 +148,25 @@ describe "Puppet::Network::HTTP::RackREST", :if => Puppet.features.rack? do
|
|
148
148
|
result[:bar].should == "xyzzy"
|
149
149
|
end
|
150
150
|
|
151
|
+
it "should return multi-values params as an array of the values" do
|
152
|
+
req = mk_req('/?foo=baz&foo=xyzzy')
|
153
|
+
result = @handler.params(req)
|
154
|
+
result[:foo].should == ["baz", "xyzzy"]
|
155
|
+
end
|
156
|
+
|
157
|
+
it "should return parameters from the POST body" do
|
158
|
+
req = mk_req("/", :method => 'POST', :input => 'foo=baz&bar=xyzzy')
|
159
|
+
result = @handler.params(req)
|
160
|
+
result[:foo].should == "baz"
|
161
|
+
result[:bar].should == "xyzzy"
|
162
|
+
end
|
163
|
+
|
164
|
+
it "should not return multi-valued params in a POST body as an array of values" do
|
165
|
+
req = mk_req("/", :method => 'POST', :input => 'foo=baz&foo=xyzzy')
|
166
|
+
result = @handler.params(req)
|
167
|
+
result[:foo].should be_one_of("baz", "xyzzy")
|
168
|
+
end
|
169
|
+
|
151
170
|
it "should CGI-decode the HTTP parameters" do
|
152
171
|
encoding = CGI.escape("foo bar")
|
153
172
|
req = mk_req("/?foo=#{encoding}")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.1.
|
4
|
+
version: 3.3.1.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet Labs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: facter
|