rack 3.0.9 → 3.0.10
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 +4 -4
- data/CHANGELOG.md +5 -1
- data/lib/rack/media_type.rb +9 -4
- data/lib/rack/multipart/parser.rb +9 -1
- data/lib/rack/utils.rb +9 -5
- data/lib/rack/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '02708966a52d0c3f5837969a1be34245fe608b2b195e05a5f6d01a192c54a104'
|
4
|
+
data.tar.gz: ce9f131cb863d4c4fd215cfc612cad5f90368187d20eaabd70db6f5cc8fd14ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d7a4f539b7abd7e28908da9c34d29ef6df3a1bb80e52ec656dc9324bdf5573b2213e82bb01175327f701c9275f404a790ddb3ee42ceeba7dac0d579f68f6cd6
|
7
|
+
data.tar.gz: 125fb761b1d4e979936a4587146c41623d03c26561c8e36501efb25735cb8ff122bcf2fe77382850ea3c28559ef2aa3f5dba64dba86530c02359a6be6ac0a3bf
|
data/CHANGELOG.md
CHANGED
@@ -4,9 +4,13 @@ All notable changes to this project will be documented in this file. For info on
|
|
4
4
|
|
5
5
|
## Unreleased
|
6
6
|
|
7
|
+
## [3.0.10] - 2024-03-21
|
8
|
+
|
9
|
+
- Backport #2104 to 3-0-stable: Return empty when parsing a multi-part POST with only one end delimiter. ([#2164](https://github.com/rack/rack/pull/2164), [@JoeDupuis](https://github.com/JoeDupuis))
|
10
|
+
|
7
11
|
## [3.0.9] - 2024-01-31
|
8
12
|
|
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])
|
13
|
+
- 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](https://github.com/mattbrictson))
|
10
14
|
|
11
15
|
## [3.0.8] - 2023-06-14
|
12
16
|
|
data/lib/rack/media_type.rb
CHANGED
@@ -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 =
|
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
|
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
|
36
|
+
k.downcase!
|
37
|
+
hsh[k] = strip_doublequotes(v)
|
33
38
|
end
|
34
39
|
end
|
35
40
|
|
@@ -213,6 +213,7 @@ module Rack
|
|
213
213
|
|
214
214
|
@sbuf = StringScanner.new("".dup)
|
215
215
|
@body_regex = /(?:#{EOL}|\A)--#{Regexp.quote(boundary)}(?:#{EOL}|--)/m
|
216
|
+
@end_boundary_size = boundary.bytesize + 4 # (-- at start, -- at finish)
|
216
217
|
@rx_max_size = boundary.bytesize + 6 # (\r\n-- at start, either \r\n or -- at finish)
|
217
218
|
@head_regex = /(.*?#{EOL})#{EOL}/m
|
218
219
|
end
|
@@ -279,7 +280,14 @@ module Rack
|
|
279
280
|
@state = :MIME_HEAD
|
280
281
|
return
|
281
282
|
when :END_BOUNDARY
|
282
|
-
# invalid multipart upload
|
283
|
+
# invalid multipart upload
|
284
|
+
if @sbuf.pos == @end_boundary_size && @sbuf.rest == EOL
|
285
|
+
# stop parsing a buffer if a buffer is only an end boundary.
|
286
|
+
@state = :DONE
|
287
|
+
return
|
288
|
+
end
|
289
|
+
|
290
|
+
# retry for opening boundary
|
283
291
|
else
|
284
292
|
# no boundary found, keep reading data
|
285
293
|
return :want_read
|
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(
|
147
|
-
value, parameters = part.split(
|
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(
|
161
|
-
field.split(
|
162
|
-
|
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
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.
|
4
|
+
version: 3.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leah Neukirchen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-03-20 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.5.
|
167
|
+
rubygems_version: 3.5.3
|
168
168
|
signing_key:
|
169
169
|
specification_version: 4
|
170
170
|
summary: A modular Ruby webserver interface.
|