rack 2.0.6 → 2.0.7

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
- SHA256:
3
- metadata.gz: c26f21f48fd630f4f95eead2d2845f51c160bcd084824b305d81d95bad08b6d9
4
- data.tar.gz: 312598a6017f9dd516214a2390f828008e6f30a6f6b4acc570c79133b975c8a4
2
+ SHA1:
3
+ metadata.gz: 116f4a51b2ae4bf5127f7609fe8bc0586647cd05
4
+ data.tar.gz: aabc7fa3253cc8696e1d1f0e7b175656ef39b8a7
5
5
  SHA512:
6
- metadata.gz: bf760ff4d0077492ddd2760a8b9d9a16a45560dd55612c29b31331ce70f0308defa5edacbcd74bac2a8f0fb26a41330ff3bb995cc6367822deea2246c474e7aa
7
- data.tar.gz: d4e666fcdbdc9c09b6175b4b3ec96f20f1638c12133ebc2666428be6cb98d54097ef8a4351e92f9ba9637ed7b0bc64ea45b755081ae07f24264bbb6ecd10c270
6
+ metadata.gz: 1e2ecf2098113d2f435bd2e299cb207701960cd08225bd4bcc2953f46955f71225935c545c2efd35a0d288510435d56486ffc3e6c6cca9051695c70751447f85
7
+ data.tar.gz: ff2e93c1e9989f628523a64693102ca05fdcd7749878710c2c4af44c84aa9eb1ac0af92817dbb251a5da929b09a35ea288ee20a0896d49771a41295917a18ca2
data/SPEC CHANGED
@@ -60,8 +60,8 @@ below.
60
60
  the presence or absence of the
61
61
  appropriate HTTP header in the
62
62
  request. See
63
- <a href="https://tools.ietf.org/html/rfc3875#section-4.1.18">
64
- RFC3875 section 4.1.18</a> for
63
+ {https://tools.ietf.org/html/rfc3875#section-4.1.18
64
+ RFC3875 section 4.1.18} for
65
65
  specific behavior.
66
66
  In addition to this, the Rack environment must include these
67
67
  Rack-specific variables:
@@ -98,13 +98,12 @@ Rack-specific variables:
98
98
  Additional environment specifications have approved to
99
99
  standardized middleware APIs. None of these are required to
100
100
  be implemented by the server.
101
- <tt>rack.session</tt>:: A hash like interface for storing
102
- request session data.
101
+ <tt>rack.session</tt>:: A hash like interface for storing request session data.
103
102
  The store must implement:
104
- store(key, value) (aliased as []=);
105
- fetch(key, default = nil) (aliased as []);
106
- delete(key);
107
- clear;
103
+ store(key, value) (aliased as []=);
104
+ fetch(key, default = nil) (aliased as []);
105
+ delete(key);
106
+ clear;
108
107
  <tt>rack.logger</tt>:: A common object interface for logging messages.
109
108
  The object must implement:
110
109
  info(message, &block)
@@ -18,7 +18,7 @@ module Rack
18
18
  VERSION.join(".")
19
19
  end
20
20
 
21
- RELEASE = "2.0.6"
21
+ RELEASE = "2.0.7"
22
22
 
23
23
  # Return the Rack release as a dotted string.
24
24
  def self.release
@@ -39,8 +39,6 @@ module Rack
39
39
  str
40
40
  end
41
41
 
42
- def eof?; @content_length == @cursor; end
43
-
44
42
  def rewind
45
43
  @io.rewind
46
44
  end
@@ -65,11 +63,11 @@ module Rack
65
63
  io = BoundedIO.new(io, content_length) if content_length
66
64
 
67
65
  parser = new(boundary, tmpfile, bufsize, qp)
68
- parser.on_read io.read(bufsize), io.eof?
66
+ parser.on_read io.read(bufsize)
69
67
 
70
68
  loop do
71
69
  break if parser.state == :DONE
72
- parser.on_read io.read(bufsize), io.eof?
70
+ parser.on_read io.read(bufsize)
73
71
  end
74
72
 
75
73
  io.rewind
@@ -181,8 +179,8 @@ module Rack
181
179
  @collector = Collector.new tempfile
182
180
  end
183
181
 
184
- def on_read content, eof
185
- handle_empty_content!(content, eof)
182
+ def on_read content
183
+ handle_empty_content!(content)
186
184
  @buf << content
187
185
  run_parser
188
186
  end
@@ -358,10 +356,9 @@ module Rack
358
356
  end
359
357
 
360
358
 
361
- def handle_empty_content!(content, eof)
359
+ def handle_empty_content!(content)
362
360
  if content.nil? || content.empty?
363
- raise EOFError if eof
364
- return true
361
+ raise EOFError
365
362
  end
366
363
  end
367
364
  end
@@ -261,7 +261,7 @@ module Rack
261
261
 
262
262
  forwarded_ips = split_ip_addresses(get_header('HTTP_X_FORWARDED_FOR'))
263
263
 
264
- return reject_trusted_ip_addresses(forwarded_ips).last || get_header("REMOTE_ADDR")
264
+ return reject_trusted_ip_addresses(forwarded_ips).last || forwarded_ips.first || get_header("REMOTE_ADDR")
265
265
  end
266
266
 
267
267
  # The media type (type/subtype) portion of the CONTENT_TYPE header
@@ -1286,7 +1286,16 @@ EOF
1286
1286
  res.body.must_equal '2.2.2.3'
1287
1287
  end
1288
1288
 
1289
- it "regard local addresses as proxies" do
1289
+ it "preserves ip for trusted proxy chain" do
1290
+ mock = Rack::MockRequest.new(Rack::Lint.new(ip_app))
1291
+ res = mock.get '/',
1292
+ 'HTTP_X_FORWARDED_FOR' => '192.168.0.11, 192.168.0.7',
1293
+ 'HTTP_CLIENT_IP' => '127.0.0.1'
1294
+ res.body.must_equal '192.168.0.11'
1295
+
1296
+ end
1297
+
1298
+ it "regards local addresses as proxies" do
1290
1299
  req = make_request(Rack::MockRequest.env_for("/"))
1291
1300
  req.trusted_proxy?('127.0.0.1').must_equal 0
1292
1301
  req.trusted_proxy?('10.0.0.1').must_equal 0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.6
4
+ version: 2.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leah Neukirchen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-05 00:00:00.000000000 Z
11
+ date: 2019-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -275,59 +275,59 @@ required_rubygems_version: !ruby/object:Gem::Requirement
275
275
  version: '0'
276
276
  requirements: []
277
277
  rubyforge_project:
278
- rubygems_version: 2.7.6
278
+ rubygems_version: 2.6.13
279
279
  signing_key:
280
280
  specification_version: 4
281
281
  summary: a modular Ruby webserver interface
282
282
  test_files:
283
- - test/spec_multipart.rb
283
+ - test/spec_auth_basic.rb
284
+ - test/spec_auth_digest.rb
285
+ - test/spec_body_proxy.rb
286
+ - test/spec_builder.rb
287
+ - test/spec_cascade.rb
288
+ - test/spec_cgi.rb
289
+ - test/spec_chunked.rb
290
+ - test/spec_common_logger.rb
291
+ - test/spec_conditional_get.rb
292
+ - test/spec_config.rb
293
+ - test/spec_content_length.rb
294
+ - test/spec_content_type.rb
284
295
  - test/spec_deflater.rb
285
- - test/spec_static.rb
286
- - test/spec_session_cookie.rb
287
- - test/spec_session_pool.rb
296
+ - test/spec_directory.rb
288
297
  - test/spec_etag.rb
289
- - test/spec_version.rb
298
+ - test/spec_events.rb
299
+ - test/spec_fastcgi.rb
300
+ - test/spec_file.rb
290
301
  - test/spec_handler.rb
291
- - test/spec_thin.rb
292
- - test/spec_session_abstract_id.rb
293
- - test/spec_mime.rb
294
- - test/spec_recursive.rb
295
- - test/spec_null_logger.rb
302
+ - test/spec_head.rb
303
+ - test/spec_lint.rb
304
+ - test/spec_lobster.rb
305
+ - test/spec_lock.rb
306
+ - test/spec_logger.rb
296
307
  - test/spec_media_type.rb
297
- - test/spec_cgi.rb
298
308
  - test/spec_method_override.rb
299
- - test/spec_content_type.rb
300
- - test/spec_session_abstract_session_hash.rb
309
+ - test/spec_mime.rb
310
+ - test/spec_mock.rb
311
+ - test/spec_multipart.rb
312
+ - test/spec_null_logger.rb
313
+ - test/spec_recursive.rb
301
314
  - test/spec_request.rb
302
- - test/spec_chunked.rb
303
- - test/spec_show_exceptions.rb
315
+ - test/spec_response.rb
316
+ - test/spec_rewindable_input.rb
304
317
  - test/spec_runtime.rb
305
- - test/spec_fastcgi.rb
306
- - test/spec_common_logger.rb
307
- - test/spec_builder.rb
308
- - test/spec_config.rb
309
- - test/spec_utils.rb
310
318
  - test/spec_sendfile.rb
311
- - test/spec_lobster.rb
312
- - test/spec_lint.rb
313
- - test/spec_conditional_get.rb
314
- - test/spec_tempfile_reaper.rb
315
- - test/spec_mock.rb
316
319
  - test/spec_server.rb
317
- - test/spec_directory.rb
318
- - test/spec_webrick.rb
319
- - test/spec_response.rb
320
- - test/spec_file.rb
320
+ - test/spec_session_abstract_id.rb
321
+ - test/spec_session_abstract_session_hash.rb
322
+ - test/spec_session_cookie.rb
323
+ - test/spec_session_memcache.rb
324
+ - test/spec_session_pool.rb
325
+ - test/spec_show_exceptions.rb
321
326
  - test/spec_show_status.rb
322
- - test/spec_body_proxy.rb
323
- - test/spec_logger.rb
324
- - test/spec_auth_digest.rb
327
+ - test/spec_static.rb
328
+ - test/spec_tempfile_reaper.rb
329
+ - test/spec_thin.rb
325
330
  - test/spec_urlmap.rb
326
- - test/spec_events.rb
327
- - test/spec_cascade.rb
328
- - test/spec_auth_basic.rb
329
- - test/spec_head.rb
330
- - test/spec_lock.rb
331
- - test/spec_rewindable_input.rb
332
- - test/spec_session_memcache.rb
333
- - test/spec_content_length.rb
331
+ - test/spec_utils.rb
332
+ - test/spec_version.rb
333
+ - test/spec_webrick.rb