rack 3.0.8 → 3.0.9.1

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 rack might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e05c24e17dac3f2da82b5e26090a5bcc2dffec8955792b9df92bdc21bd4fdad2
4
- data.tar.gz: 7af9d2217e9e092af82c3d6582f9b377a71e370279ecf8ee722ff142e79b9031
3
+ metadata.gz: ebeaad43b1e4e691aa7123f2f0b0abb55bd4e8ccb062a048d3bc636c12780a1c
4
+ data.tar.gz: 4db213c69e487539b15f2648019de339b3876bd9d9ab39a7e4948c6114a18546
5
5
  SHA512:
6
- metadata.gz: 7280fd5a123ca1760f3b1d3c2ff1742bc7686fc5e8d3254d8a7cd8897fadf8f73f2887778a1b9a9cba05093ed98a9326528db5bebbe85f4961274f5ca4aab52c
7
- data.tar.gz: 4f2bc0fe42ddcc8dbe92d8620ab0b1a40eb8215d668db085ef9fd4f30660c492e51da14a7a6d568c16674b3e1854f75e0dbd51258c9f3432f4ac6c8f4a43f14c
6
+ metadata.gz: 6c3afb608d9170593f0bc58120d60dcec9d4d3163e72a9805b8a48b2ebd8952a359dd56d2c2f48dc8673d2361647409a628b22073b4e07a6c070f60283265bb9
7
+ data.tar.gz: fb304999e3568174cdcc7a2b0b43b3ba064448db1882142524b50332cd7d037a2ff44c7042f94a2b18da862ca4db6e43b6eb9ca71b6b73986e1359e4b294eb7c
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. For info on how to format all future additions to this file please reference [Keep A Changelog](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
+ ## Unreleased
6
+
7
+ ## [3.0.9] - 2024-01-31
8
+
9
+ - Fix incorrect content-length header that was emitted when `Rack::Response#write` was used in some situations. ([#2150](https://github.com/rack/rack/pull/2150), [@mattbrictson])
10
+
11
+ ## [3.0.8] - 2023-06-14
12
+
13
+ - Fix some unused variable verbose warnings. ([#2084](https://github.com/rack/rack/pull/2084), [@jeremyevans], [@skipkayhil](https://github.com/skipkayhil))
14
+
5
15
  ## [3.0.7] - 2023-03-16
6
16
 
7
17
  - Make query parameters without `=` have `nil` values. ([#2059](https://github.com/rack/rack/pull/2059), [@jeremyevans])
@@ -4,7 +4,7 @@ module Rack
4
4
  # Rack::MediaType parse media type and parameters out of content_type string
5
5
 
6
6
  class MediaType
7
- SPLIT_PATTERN = %r{\s*[;,]\s*}
7
+ SPLIT_PATTERN = /[;,]/
8
8
 
9
9
  class << self
10
10
  # The media type (type/subtype) portion of the CONTENT_TYPE header
@@ -15,7 +15,11 @@ module Rack
15
15
  # http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7
16
16
  def type(content_type)
17
17
  return nil unless content_type
18
- content_type.split(SPLIT_PATTERN, 2).first.tap(&:downcase!)
18
+ if type = content_type.split(SPLIT_PATTERN, 2).first
19
+ type.rstrip!
20
+ type.downcase!
21
+ type
22
+ end
19
23
  end
20
24
 
21
25
  # The media type parameters provided in CONTENT_TYPE as a Hash, or
@@ -27,9 +31,10 @@ module Rack
27
31
  return {} if content_type.nil?
28
32
 
29
33
  content_type.split(SPLIT_PATTERN)[1..-1].each_with_object({}) do |s, hsh|
34
+ s.strip!
30
35
  k, v = s.split('=', 2)
31
-
32
- hsh[k.tap(&:downcase!)] = strip_doublequotes(v)
36
+ k.downcase!
37
+ hsh[k] = strip_doublequotes(v)
33
38
  end
34
39
  end
35
40
 
data/lib/rack/response.rb CHANGED
@@ -328,6 +328,8 @@ module Rack
328
328
  @body.each do |part|
329
329
  @length += part.to_s.bytesize
330
330
  end
331
+
332
+ @buffered = true
331
333
  elsif @body.respond_to?(:each)
332
334
  # Turn the user supplied body into a buffered array:
333
335
  body = @body
data/lib/rack/utils.rb CHANGED
@@ -143,8 +143,8 @@ module Rack
143
143
  end
144
144
 
145
145
  def q_values(q_value_header)
146
- q_value_header.to_s.split(/\s*,\s*/).map do |part|
147
- value, parameters = part.split(/\s*;\s*/, 2)
146
+ q_value_header.to_s.split(',').map do |part|
147
+ value, parameters = part.split(';', 2).map(&:strip)
148
148
  quality = 1.0
149
149
  if parameters && (md = /\Aq=([\d.]+)/.match(parameters))
150
150
  quality = md[1].to_f
@@ -157,9 +157,10 @@ module Rack
157
157
  return nil unless forwarded_header
158
158
  forwarded_header = forwarded_header.to_s.gsub("\n", ";")
159
159
 
160
- forwarded_header.split(/\s*;\s*/).each_with_object({}) do |field, values|
161
- field.split(/\s*,\s*/).each do |pair|
162
- return nil unless pair =~ /\A\s*(by|for|host|proto)\s*=\s*"?([^"]+)"?\s*\Z/i
160
+ forwarded_header.split(';').each_with_object({}) do |field, values|
161
+ field.split(',').each do |pair|
162
+ pair = pair.split('=').map(&:strip).join('=')
163
+ return nil unless pair =~ /\A(by|for|host|proto)="?([^"]+)"?\Z/i
163
164
  (values[$1.downcase.to_sym] ||= []) << $2
164
165
  end
165
166
  end
@@ -458,6 +459,9 @@ module Rack
458
459
  end
459
460
  ranges << (r0..r1) if r0 <= r1
460
461
  end
462
+
463
+ return [] if ranges.map(&:size).sum > size
464
+
461
465
  ranges
462
466
  end
463
467
 
data/lib/rack/version.rb CHANGED
@@ -25,7 +25,7 @@ module Rack
25
25
  VERSION
26
26
  end
27
27
 
28
- RELEASE = "3.0.8"
28
+ RELEASE = "3.0.9.1"
29
29
 
30
30
  # Return the Rack release as a dotted string.
31
31
  def self.release
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: 3.0.8
4
+ version: 3.0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leah Neukirchen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-14 00:00:00.000000000 Z
11
+ date: 2024-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
164
  - !ruby/object:Gem::Version
165
165
  version: '0'
166
166
  requirements: []
167
- rubygems_version: 3.4.7
167
+ rubygems_version: 3.4.10
168
168
  signing_key:
169
169
  specification_version: 4
170
170
  summary: A modular Ruby webserver interface.