sinatra 4.1.1 → 4.2.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +42 -0
- data/README.md +19 -3
- data/VERSION +1 -1
- data/lib/sinatra/base.rb +10 -4
- data/lib/sinatra/version.rb +1 -1
- data/sinatra.gemspec +2 -1
- metadata +7 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 273dc42d5989e8186e18f3c93f386454a4c63ffa1e8da672e9d5f91a4e1ea1e5
|
4
|
+
data.tar.gz: 66a2357e2aab7d0acd8a780f692ce66286eb806175199fc7ccd421267b29bf4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a30a3cb2dad00c6c54c9ecf57066f2810e9599a1c612ecea5da910913d1380ca0307e6ed4897eb3d2cedba7faff3d225bb52c6b4975d3f9d2a120fe8d08a304
|
7
|
+
data.tar.gz: 3c241fe8a0613f29af44ed93d416fdc647febf9e0b4c725c8bc15d8328f98701181f3a01d2c8dc4987aa08a44d7b7501722945c10041ea0f37b732c4d894f5ae
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
## Unreleased
|
2
|
+
|
3
|
+
## 4.2.1 / 2025-10-10
|
4
|
+
|
5
|
+
* Fix: Revert "`PATH_INFO` can never be empty" ([#2124](https://github.com/sinatra/sinatra/pull/2124))
|
6
|
+
* addresses issues with routing and 404, [more in the original pull request](https://github.com/sinatra/sinatra/issues/2113#issuecomment-3388476329)
|
7
|
+
|
8
|
+
## 4.2.0 / 2025-10-08
|
9
|
+
|
10
|
+
* New: Add `:static_headers` setting for custom headers in static file responses ([#2089](https://github.com/sinatra/sinatra/pull/2089))
|
11
|
+
* Fix: Fix regex in `etag_matches?` to prevent ReDoS ([#2121](https://github.com/sinatra/sinatra/pull/2121))
|
12
|
+
* Fix: `PATH_INFO` can never be empty ([#2114](https://github.com/sinatra/sinatra/pull/2114))
|
13
|
+
* Fix: Fix malformed Content-Type headers ([#2081](https://github.com/sinatra/sinatra/pull/2081))
|
14
|
+
* Fix: Avoid crash for integer values in `content_type` parameters ([#2078](https://github.com/sinatra/sinatra/pull/2078))
|
15
|
+
|
1
16
|
## 4.1.1 / 2024-11-20
|
2
17
|
|
3
18
|
* Fix: Restore WEBrick support ([#2067](https://github.com/sinatra/sinatra/pull/2067))
|
@@ -18,6 +33,33 @@
|
|
18
33
|
* Don't depend on `Rack::Logger`
|
19
34
|
* Don't delete `content-length` header when `Rack::Files` is used
|
20
35
|
|
36
|
+
## 4.0.1 / 2025-05-24
|
37
|
+
|
38
|
+
* Rack 3.1 compatibility ([#2035])
|
39
|
+
|
40
|
+
* Fix malformed Content-Type headers ([#2081])
|
41
|
+
|
42
|
+
* Avoid crash for integer values in `content_type` parameters ([#2078])
|
43
|
+
|
44
|
+
* Fix compatibility with --enable-frozen-string-literal ([#2033])
|
45
|
+
|
46
|
+
* Declare missing dependencies for Ruby 3.5 ([#2032])
|
47
|
+
|
48
|
+
* Fix warning about Hash construction. ([#2028])
|
49
|
+
|
50
|
+
* Support Zeitwerk 2.7.0+ ([#2050])
|
51
|
+
|
52
|
+
* Address URI depreciation ([#2060])
|
53
|
+
|
54
|
+
[#2035]: https://github.com/sinatra/sinatra/pull/2035
|
55
|
+
[#2081]: https://github.com/sinatra/sinatra/pull/2081
|
56
|
+
[#2078]: https://github.com/sinatra/sinatra/pull/2078
|
57
|
+
[#2033]: https://github.com/sinatra/sinatra/pull/2033
|
58
|
+
[#2032]: https://github.com/sinatra/sinatra/pull/2032
|
59
|
+
[#2028]: https://github.com/sinatra/sinatra/pull/2028
|
60
|
+
[#2050]: https://github.com/sinatra/sinatra/pull/2050
|
61
|
+
[#2060]: https://github.com/sinatra/sinatra/pull/2060
|
62
|
+
|
21
63
|
## 4.0.0. / 2024-01-19
|
22
64
|
|
23
65
|
* New: Add support for Rack 3 ([#1857])
|
data/README.md
CHANGED
@@ -34,9 +34,6 @@ Please restart the server every time you change or use a code reloader
|
|
34
34
|
like [rerun](https://github.com/alexch/rerun) or
|
35
35
|
[rack-unreloader](https://github.com/jeremyevans/rack-unreloader).
|
36
36
|
|
37
|
-
It is recommended to also run `gem install puma`, which Sinatra will
|
38
|
-
pick up if available.
|
39
|
-
|
40
37
|
## Table of Contents
|
41
38
|
|
42
39
|
- [Sinatra](#sinatra)
|
@@ -423,6 +420,15 @@ Note that the public directory name is not included in the URL. A file
|
|
423
420
|
Use the `:static_cache_control` setting (see [below](#cache-control)) to add
|
424
421
|
`Cache-Control` header info.
|
425
422
|
|
423
|
+
By default, Sinatra serves static files from the `public/` folder without running middleware or filters. To add custom headers (e.g, for CORS or caching), use the `:static_headers` setting:
|
424
|
+
|
425
|
+
```ruby
|
426
|
+
set :static_headers, {
|
427
|
+
'access-control-allow-origin' => '*',
|
428
|
+
'x-static-asset' => 'served-by-sinatra'
|
429
|
+
}
|
430
|
+
```
|
431
|
+
|
426
432
|
## Views / Templates
|
427
433
|
|
428
434
|
Each template language is exposed via its own rendering method. These
|
@@ -2160,6 +2166,16 @@ set :protection, :session => true
|
|
2160
2166
|
<tt>set :static_cache_control, [:public, :max_age => 300]</tt>
|
2161
2167
|
</dd>
|
2162
2168
|
|
2169
|
+
<dt>static_headers</dt>
|
2170
|
+
<dd>
|
2171
|
+
Allows you to define custom header settings for static file responses.
|
2172
|
+
</dd>
|
2173
|
+
<dd>
|
2174
|
+
For example: <br>
|
2175
|
+
<tt>set :static_headers, {'access-control-allow-origin' => '*', 'x-static-asset' => 'served-by-sinatra'}</tt>
|
2176
|
+
</dd>
|
2177
|
+
|
2178
|
+
|
2163
2179
|
<dt>threaded</dt>
|
2164
2180
|
<dd>
|
2165
2181
|
If set to <tt>true</tt>, will tell server to use
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.
|
1
|
+
4.2.1
|
data/lib/sinatra/base.rb
CHANGED
@@ -396,11 +396,11 @@ module Sinatra
|
|
396
396
|
end
|
397
397
|
params.delete :charset if mime_type.include? 'charset'
|
398
398
|
unless params.empty?
|
399
|
-
mime_type <<
|
399
|
+
mime_type << ';'
|
400
400
|
mime_type << params.map do |key, val|
|
401
|
-
val = val.inspect if val =~ /[";,]/
|
401
|
+
val = val.inspect if val.to_s =~ /[";,]/
|
402
402
|
"#{key}=#{val}"
|
403
|
-
end.join('
|
403
|
+
end.join(';')
|
404
404
|
end
|
405
405
|
response['content-type'] = mime_type
|
406
406
|
end
|
@@ -711,7 +711,7 @@ module Sinatra
|
|
711
711
|
def etag_matches?(list, new_resource = request.post?)
|
712
712
|
return !new_resource if list == '*'
|
713
713
|
|
714
|
-
list.to_s.split(
|
714
|
+
list.to_s.split(',').map(&:strip).include?(response['ETag'])
|
715
715
|
end
|
716
716
|
|
717
717
|
def with_params(temp_params)
|
@@ -1143,6 +1143,7 @@ module Sinatra
|
|
1143
1143
|
|
1144
1144
|
# Attempt to serve static files from public directory. Throws :halt when
|
1145
1145
|
# a matching file is found, returns nil otherwise.
|
1146
|
+
# If custom static headers are defined, use them.
|
1146
1147
|
def static!(options = {})
|
1147
1148
|
return if (public_dir = settings.public_folder).nil?
|
1148
1149
|
|
@@ -1156,6 +1157,9 @@ module Sinatra
|
|
1156
1157
|
|
1157
1158
|
env['sinatra.static_file'] = path
|
1158
1159
|
cache_control(*settings.static_cache_control) if settings.static_cache_control?
|
1160
|
+
|
1161
|
+
headers(settings.static_headers) if settings.static_headers?
|
1162
|
+
|
1159
1163
|
send_file path, options.merge(disposition: nil)
|
1160
1164
|
end
|
1161
1165
|
|
@@ -2011,6 +2015,8 @@ module Sinatra
|
|
2011
2015
|
set :public_folder, proc { root && File.join(root, 'public') }
|
2012
2016
|
set :static, proc { public_folder && File.exist?(public_folder) }
|
2013
2017
|
set :static_cache_control, false
|
2018
|
+
|
2019
|
+
set :static_headers, {}
|
2014
2020
|
|
2015
2021
|
error ::Exception do
|
2016
2022
|
response.status = 500
|
data/lib/sinatra/version.rb
CHANGED
data/sinatra.gemspec
CHANGED
@@ -40,7 +40,8 @@ RubyGems 2.0 or newer is required to protect against public gem pushes. You can
|
|
40
40
|
'homepage_uri' => 'http://sinatrarb.com/',
|
41
41
|
'bug_tracker_uri' => 'https://github.com/sinatra/sinatra/issues',
|
42
42
|
'mailing_list_uri' => 'http://groups.google.com/group/sinatrarb',
|
43
|
-
'documentation_uri' => 'https://www.rubydoc.info/gems/sinatra'
|
43
|
+
'documentation_uri' => 'https://www.rubydoc.info/gems/sinatra',
|
44
|
+
'rubygems_mfa_required' => 'true',
|
44
45
|
}
|
45
46
|
|
46
47
|
s.required_ruby_version = '>= 2.7.8'
|
metadata
CHANGED
@@ -1,17 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Blake Mizerany
|
8
8
|
- Ryan Tomayko
|
9
9
|
- Simon Rozet
|
10
10
|
- Konstantin Haase
|
11
|
-
autorequire:
|
12
11
|
bindir: bin
|
13
12
|
cert_chain: []
|
14
|
-
date:
|
13
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: logger
|
@@ -67,14 +66,14 @@ dependencies:
|
|
67
66
|
requirements:
|
68
67
|
- - '='
|
69
68
|
- !ruby/object:Gem::Version
|
70
|
-
version: 4.
|
69
|
+
version: 4.2.1
|
71
70
|
type: :runtime
|
72
71
|
prerelease: false
|
73
72
|
version_requirements: !ruby/object:Gem::Requirement
|
74
73
|
requirements:
|
75
74
|
- - '='
|
76
75
|
- !ruby/object:Gem::Version
|
77
|
-
version: 4.
|
76
|
+
version: 4.2.1
|
78
77
|
- !ruby/object:Gem::Dependency
|
79
78
|
name: rack-session
|
80
79
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,8 +114,8 @@ email: sinatrarb@googlegroups.com
|
|
115
114
|
executables: []
|
116
115
|
extensions: []
|
117
116
|
extra_rdoc_files:
|
118
|
-
- README.md
|
119
117
|
- LICENSE
|
118
|
+
- README.md
|
120
119
|
files:
|
121
120
|
- ".yardopts"
|
122
121
|
- AUTHORS.md
|
@@ -153,7 +152,7 @@ metadata:
|
|
153
152
|
bug_tracker_uri: https://github.com/sinatra/sinatra/issues
|
154
153
|
mailing_list_uri: http://groups.google.com/group/sinatrarb
|
155
154
|
documentation_uri: https://www.rubydoc.info/gems/sinatra
|
156
|
-
|
155
|
+
rubygems_mfa_required: 'true'
|
157
156
|
rdoc_options:
|
158
157
|
- "--line-numbers"
|
159
158
|
- "--title"
|
@@ -174,8 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
173
|
- !ruby/object:Gem::Version
|
175
174
|
version: '0'
|
176
175
|
requirements: []
|
177
|
-
rubygems_version: 3.
|
178
|
-
signing_key:
|
176
|
+
rubygems_version: 3.6.9
|
179
177
|
specification_version: 4
|
180
178
|
summary: Classy web-development dressed in a DSL
|
181
179
|
test_files: []
|