rack 2.0.0.rc1 → 2.0.1

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

Potentially problematic release.


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

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 54be55d492853c85486a9d94bfa3122be91a375c
4
- data.tar.gz: b1f919ccb928bf607b66efb2dc494d350c4e67f8
3
+ metadata.gz: f4e9c67e795c425f3e8faa0d0fe8d48daba757e5
4
+ data.tar.gz: bf8c0c20c6310e7bd53e8b20c8c4946b1205eb65
5
5
  SHA512:
6
- metadata.gz: 969ed8dd45442d71e9448dcc7951d997429cbe3a8857694c76cd0c8137ea22ba831f54dc1c24d65f2f2b35ce44c4a1d43bba182b98d93d86fc5917a671cc1486
7
- data.tar.gz: cf0ede4ad49a3e2bb23f0136532c32d6fb799b5cb050bffa909727478bf1cca6c6d7704f574cb9a9c9e657e7b5f6430e5e1e8485ac1c747d5d6a14a8d4b81a2d
6
+ metadata.gz: 5540bc2b6de513db3c5c494e6e32229087fb20040c4670a8c2215a9ea5a04b010ac9b5143cc3703ab73df0417234a416e49370fb3eafc85bde1c569e521c0612
7
+ data.tar.gz: f2af8aa5ee53427248393dd707ca34428d18b064c3081a3db663cd0f1e6f35e4b18ce54f607f7cea3c56569ef2552240dd55d0c4ff7006e0e2ab80db3800a933
@@ -18,7 +18,7 @@ module Rack
18
18
  VERSION.join(".")
19
19
  end
20
20
 
21
- RELEASE = "2.0.0.rc1"
21
+ RELEASE = "2.0.1"
22
22
 
23
23
  # Return the Rack release as a dotted string.
24
24
  def self.release
@@ -13,7 +13,11 @@ module Rack
13
13
  end
14
14
 
15
15
  def provided?
16
- !authorization_key.nil?
16
+ !authorization_key.nil? && valid?
17
+ end
18
+
19
+ def valid?
20
+ !@env[authorization_key].nil?
17
21
  end
18
22
 
19
23
  def parts
@@ -163,7 +163,6 @@ module Rack
163
163
  def initialize(status, headers, body, errors=StringIO.new(""))
164
164
  @original_headers = headers
165
165
  @errors = errors.string if errors.respond_to?(:string)
166
- @body_string = nil
167
166
 
168
167
  super(body, status, headers)
169
168
  end
@@ -102,8 +102,7 @@ module Rack
102
102
  child_key = $1
103
103
  params[k] ||= []
104
104
  raise ParameterTypeError, "expected Array (got #{params[k].class.name}) for param `#{k}'" unless params[k].is_a?(Array)
105
- first_key = child_key.gsub(/[\[\]]/, ' ').split.first
106
- if params_hash_type?(params[k].last) && !params[k].last.key?(first_key)
105
+ if params_hash_type?(params[k].last) && !params_hash_has_key?(params[k].last, child_key)
107
106
  normalize_params(params[k].last, child_key, v, depth - 1)
108
107
  else
109
108
  params[k] << normalize_params(make_params, child_key, v, depth - 1)
@@ -135,6 +134,18 @@ module Rack
135
134
  obj.kind_of?(@params_class)
136
135
  end
137
136
 
137
+ def params_hash_has_key?(hash, key)
138
+ return false if key =~ /\[\]/
139
+
140
+ key.split(/[\[\]]+/).inject(hash) do |h, part|
141
+ next h if part == ''
142
+ return false unless params_hash_type?(h) && h.key?(part)
143
+ h[part]
144
+ end
145
+
146
+ true
147
+ end
148
+
138
149
  def unescape(s)
139
150
  Utils.unescape(s)
140
151
  end
@@ -28,8 +28,6 @@ EOF
28
28
  s.homepage = 'http://rack.github.io/'
29
29
  s.required_ruby_version = '>= 2.2.2'
30
30
 
31
- s.add_dependency 'json'
32
-
33
31
  s.add_development_dependency 'minitest', "~> 5.0"
34
32
  s.add_development_dependency 'minitest-sprint'
35
33
  s.add_development_dependency 'concurrent-ruby'
@@ -75,6 +75,13 @@ describe Rack::Auth::Basic do
75
75
  end
76
76
  end
77
77
 
78
+ it 'return 401 Bad Request for a nil authorization header' do
79
+ request 'HTTP_AUTHORIZATION' => nil do |response|
80
+ response.must_be :client_error?
81
+ response.status.must_equal 401
82
+ end
83
+ end
84
+
78
85
  it 'takes realm as optional constructor arg' do
79
86
  app = Rack::Auth::Basic.new(unprotected_app, realm) { true }
80
87
  realm.must_equal app.realm
@@ -231,6 +231,18 @@ describe Rack::Utils do
231
231
  message.must_equal "invalid byte sequence in UTF-8"
232
232
  end
233
233
 
234
+ it "only moves to a new array when the full key has been seen" do
235
+ Rack::Utils.parse_nested_query("x[][y][][z]=1&x[][y][][w]=2").
236
+ must_equal "x" => [{"y" => [{"z" => "1", "w" => "2"}]}]
237
+
238
+ Rack::Utils.parse_nested_query(
239
+ "x[][id]=1&x[][y][a]=5&x[][y][b]=7&x[][z][id]=3&x[][z][w]=0&x[][id]=2&x[][y][a]=6&x[][y][b]=8&x[][z][id]=4&x[][z][w]=0"
240
+ ).must_equal "x" => [
241
+ {"id" => "1", "y" => {"a" => "5", "b" => "7"}, "z" => {"id" => "3", "w" => "0"}},
242
+ {"id" => "2", "y" => {"a" => "6", "b" => "8"}, "z" => {"id" => "4", "w" => "0"}},
243
+ ]
244
+ end
245
+
234
246
  it "allow setting the params hash class to use for parsing query strings" do
235
247
  begin
236
248
  default_parser = Rack::Utils.default_query_parser
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.rc1
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Neukirchen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-06 00:00:00.000000000 Z
11
+ date: 2016-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: json
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: minitest
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -185,7 +171,6 @@ files:
185
171
  - test/cgi/assets/javascripts/app.js
186
172
  - test/cgi/assets/stylesheets/app.css
187
173
  - test/cgi/lighttpd.conf
188
- - test/cgi/lighttpd.errors
189
174
  - test/cgi/rackup_stub.rb
190
175
  - test/cgi/sample_rackup.ru
191
176
  - test/cgi/test
@@ -298,12 +283,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
298
283
  version: 2.2.2
299
284
  required_rubygems_version: !ruby/object:Gem::Requirement
300
285
  requirements:
301
- - - ">"
286
+ - - ">="
302
287
  - !ruby/object:Gem::Version
303
- version: 1.3.1
288
+ version: '0'
304
289
  requirements: []
305
290
  rubyforge_project:
306
- rubygems_version: 2.6.4
291
+ rubygems_version: 2.6.6
307
292
  signing_key:
308
293
  specification_version: 4
309
294
  summary: a modular Ruby webserver interface
@@ -1,8 +0,0 @@
1
- 2016-05-04 12:00:25: (log.c.164) server started
2
- 2016-05-04 12:00:35: (server.c.1558) server stopped by UID = 502 PID = 80374
3
- 2016-05-04 12:13:42: (log.c.164) server started
4
- 2016-05-04 12:13:51: (server.c.1558) server stopped by UID = 502 PID = 82209
5
- 2016-05-04 12:16:30: (log.c.164) server started
6
- 2016-05-04 12:16:39: (server.c.1558) server stopped by UID = 502 PID = 82523
7
- 2016-05-04 12:18:17: (log.c.164) server started
8
- 2016-05-04 12:18:26: (server.c.1558) server stopped by UID = 502 PID = 82745