rack 2.2.8 → 2.2.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/lib/rack/auth/basic.rb +1 -2
- data/lib/rack/auth/digest/nonce.rb +2 -3
- data/lib/rack/media_type.rb +9 -4
- data/lib/rack/multipart/parser.rb +7 -1
- data/lib/rack/session/cookie.rb +2 -3
- data/lib/rack/utils.rb +8 -4
- 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: 89c25f75ddd66c4ab311ec7afaad215f5417ab7c0478fb8da65bef7288b25ead
|
4
|
+
data.tar.gz: 35bef5623220a06f4f1f54a752c0d5d67b23539d9521470446a323a03b25b3fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82b9812778a5e19704f7014a87b5dccffea6122e7a55295cfff5bfc2a581a11d718af4282b1503dc63bd16984ab286367da26ba533081dd7453c5c44d37a3616
|
7
|
+
data.tar.gz: e7231940003fac65c76d7ed327e4f90d3b2ab31f665651e609a607e37952a43ced1b764429f052fef431e849f2bbc6a8841141ce4c51ac898d6bd34f54660b8e
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,22 @@
|
|
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
|
+
## [2.2.10] - 2024-10-14
|
8
|
+
|
9
|
+
- Fix compatibility issues with Ruby v3.4.0. ([#2248](https://github.com/rack/rack/pull/2248), [@byroot](https://github.com/byroot))
|
10
|
+
|
11
|
+
## [2.2.9] - 2023-03-21
|
12
|
+
|
13
|
+
- Return empty when parsing a multi-part POST with only one end delimiter. ([#2104](https://github.com/rack/rack/pull/2104), [@alpaca-tc])
|
14
|
+
|
15
|
+
## [2.2.8] - 2023-07-31
|
16
|
+
|
17
|
+
- Regenerate SPEC ([#2102](https://github.com/rack/rack/pull/2102), [@skipkayhil](https://github.com/skipkayhil))
|
18
|
+
- Limit file extension length of multipart tempfiles ([#2015](https://github.com/rack/rack/pull/2015), [@dentarg](https://github.com/dentarg))
|
19
|
+
- Fix "undefined method DelegateClass for Rack::Session::Cookie:Class" ([#2092](https://github.com/rack/rack/pull/2092), [@onigra](https://github.com/onigra) [@dchandekstark](https://github.com/dchandekstark))
|
20
|
+
|
5
21
|
## [2.2.7] - 2023-03-13
|
6
22
|
|
7
23
|
- Correct the year number in the changelog ([#2015](https://github.com/rack/rack/pull/2015), [@kimulab](https://github.com/kimulab))
|
data/lib/rack/auth/basic.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
require_relative 'abstract/handler'
|
4
4
|
require_relative 'abstract/request'
|
5
|
-
require 'base64'
|
6
5
|
|
7
6
|
module Rack
|
8
7
|
module Auth
|
@@ -48,7 +47,7 @@ module Rack
|
|
48
47
|
end
|
49
48
|
|
50
49
|
def credentials
|
51
|
-
@credentials ||=
|
50
|
+
@credentials ||= params.unpack("m").first.split(':', 2)
|
52
51
|
end
|
53
52
|
|
54
53
|
def username
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'digest/md5'
|
4
|
-
require 'base64'
|
5
4
|
|
6
5
|
module Rack
|
7
6
|
module Auth
|
@@ -21,7 +20,7 @@ module Rack
|
|
21
20
|
end
|
22
21
|
|
23
22
|
def self.parse(string)
|
24
|
-
new(*
|
23
|
+
new(*string.unpack("m").first.split(' ', 2))
|
25
24
|
end
|
26
25
|
|
27
26
|
def initialize(timestamp = Time.now, given_digest = nil)
|
@@ -29,7 +28,7 @@ module Rack
|
|
29
28
|
end
|
30
29
|
|
31
30
|
def to_s
|
32
|
-
|
31
|
+
["#{@timestamp} #{digest}"].pack("m").strip
|
33
32
|
end
|
34
33
|
|
35
34
|
def digest
|
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
|
|
@@ -191,6 +191,7 @@ module Rack
|
|
191
191
|
|
192
192
|
@sbuf = StringScanner.new("".dup)
|
193
193
|
@body_regex = /(?:#{EOL})?#{Regexp.quote(@boundary)}(?:#{EOL}|--)/m
|
194
|
+
@end_boundary_size = boundary.bytesize + 6 # (-- at start, -- at finish, EOL at end)
|
194
195
|
@rx_max_size = EOL.size + @boundary.bytesize + [EOL.size, '--'.size].max
|
195
196
|
@head_regex = /(.*?#{EOL})#{EOL}/m
|
196
197
|
end
|
@@ -231,7 +232,12 @@ module Rack
|
|
231
232
|
end
|
232
233
|
|
233
234
|
def handle_fast_forward
|
234
|
-
|
235
|
+
tok = consume_boundary
|
236
|
+
|
237
|
+
if tok == :END_BOUNDARY && @sbuf.pos == @end_boundary_size && @sbuf.eos?
|
238
|
+
# stop parsing a buffer if a buffer is only an end boundary.
|
239
|
+
@state = :DONE
|
240
|
+
elsif tok
|
235
241
|
@state = :MIME_HEAD
|
236
242
|
else
|
237
243
|
raise EOFError, "bad content body" if @sbuf.rest_size >= @bufsize
|
data/lib/rack/session/cookie.rb
CHANGED
@@ -4,7 +4,6 @@ require 'openssl'
|
|
4
4
|
require 'zlib'
|
5
5
|
require_relative 'abstract/id'
|
6
6
|
require 'json'
|
7
|
-
require 'base64'
|
8
7
|
require 'delegate'
|
9
8
|
|
10
9
|
module Rack
|
@@ -51,11 +50,11 @@ module Rack
|
|
51
50
|
# Encode session cookies as Base64
|
52
51
|
class Base64
|
53
52
|
def encode(str)
|
54
|
-
|
53
|
+
[str].pack("m0")
|
55
54
|
end
|
56
55
|
|
57
56
|
def decode(str)
|
58
|
-
|
57
|
+
str.unpack("m").first
|
59
58
|
end
|
60
59
|
|
61
60
|
# Encode session cookies as Marshaled Base64 data
|
data/lib/rack/utils.rb
CHANGED
@@ -24,6 +24,7 @@ module Rack
|
|
24
24
|
|
25
25
|
RFC2822_DAY_NAME = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ]
|
26
26
|
RFC2822_MONTH_NAME = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ]
|
27
|
+
RFC2396_PARSER = defined?(URI::RFC2396_PARSER) ? URI::RFC2396_PARSER : URI::RFC2396_Parser.new
|
27
28
|
|
28
29
|
class << self
|
29
30
|
attr_accessor :default_query_parser
|
@@ -42,13 +43,13 @@ module Rack
|
|
42
43
|
# Like URI escaping, but with %20 instead of +. Strictly speaking this is
|
43
44
|
# true URI escaping.
|
44
45
|
def escape_path(s)
|
45
|
-
|
46
|
+
RFC2396_PARSER.escape s
|
46
47
|
end
|
47
48
|
|
48
49
|
# Unescapes the **path** component of a URI. See Rack::Utils.unescape for
|
49
50
|
# unescaping query parameters or form components.
|
50
51
|
def unescape_path(s)
|
51
|
-
|
52
|
+
RFC2396_PARSER.unescape s
|
52
53
|
end
|
53
54
|
|
54
55
|
# Unescapes a URI escaped string with +encoding+. +encoding+ will be the
|
@@ -142,8 +143,8 @@ module Rack
|
|
142
143
|
end
|
143
144
|
|
144
145
|
def q_values(q_value_header)
|
145
|
-
q_value_header.to_s.split(
|
146
|
-
value, parameters = part.split(
|
146
|
+
q_value_header.to_s.split(',').map do |part|
|
147
|
+
value, parameters = part.split(';', 2).map(&:strip)
|
147
148
|
quality = 1.0
|
148
149
|
if parameters && (md = /\Aq=([\d.]+)/.match(parameters))
|
149
150
|
quality = md[1].to_f
|
@@ -380,6 +381,9 @@ module Rack
|
|
380
381
|
end
|
381
382
|
ranges << (r0..r1) if r0 <= r1
|
382
383
|
end
|
384
|
+
|
385
|
+
return [] if ranges.map(&:size).inject(0, :+) > size
|
386
|
+
|
383
387
|
ranges
|
384
388
|
end
|
385
389
|
|
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: 2.2.
|
4
|
+
version: 2.2.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:
|
11
|
+
date: 2024-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -184,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
184
|
- !ruby/object:Gem::Version
|
185
185
|
version: '0'
|
186
186
|
requirements: []
|
187
|
-
rubygems_version: 3.
|
187
|
+
rubygems_version: 3.5.11
|
188
188
|
signing_key:
|
189
189
|
specification_version: 4
|
190
190
|
summary: A modular Ruby webserver interface.
|