puppet 3.3.1.rc1 → 3.3.1.rc2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2a2479879d8532a3fb936537d8abaf317c563a49
4
- data.tar.gz: 42bfd1c583faee771a10dfdd3f697bb91a30b734
3
+ metadata.gz: 6d2fd11250a51541a228242c70e648a625e8fc08
4
+ data.tar.gz: c0f9bc3f60a9306296d01e6b4f40520399230d6e
5
5
  SHA512:
6
- metadata.gz: 78443b0f2e01f6fc4fb71b6e58df58bef370054815519fa468b7af5c5511cebf2ec69d7794425a4de7713d4734292c752cb8db875cd899330047dec4213b4362
7
- data.tar.gz: 8026eecbf7556115c83c2bb3ec04c8755ca8766312b22fdb4a7da51aaca63ef5488a88e590b3b028e7c6e6788f9209228b8900d69a3d8a2e6c422025a920e3fb
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
- result = decode_params(request.params)
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
@@ -7,7 +7,7 @@
7
7
 
8
8
 
9
9
  module Puppet
10
- PUPPETVERSION = '3.3.1-rc1'
10
+ PUPPETVERSION = '3.3.1-rc2'
11
11
 
12
12
  ##
13
13
  # version is a public API method intended to always provide a fast and
@@ -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.rc1
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-23 00:00:00.000000000 Z
11
+ date: 2013-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: facter