cuba 4.0.1 → 4.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +7 -3
- data/cuba.gemspec +1 -1
- data/lib/cuba/render.rb +1 -1
- data/lib/cuba/safe/secure_headers.rb +9 -6
- data/lib/cuba.rb +3 -3
- data/test/middleware.rb +3 -2
- data/test/redirect.rb +1 -1
- data/test/render.rb +1 -1
- data/test/run.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdca6a9e01b7f7981cd430ed976c9d0822739895340549150e4d719196e059c0
|
4
|
+
data.tar.gz: 206b7ea5088509c073f6d69f9c72e07c066b0b043483d1ecd2b292e5a9dd9f2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36cd6bcfa37d6ab1c50b4235243143117be5de74cfa3d7a065c4434c2c4fd1bd064fd46df2f13d4578427d61c6ceda769566bd26152214787a7357779780f6f5
|
7
|
+
data.tar.gz: 64e6ce940c7f8004b88535cb6b8c938da8e0be6ccce33e544843fd97029bccb7763f9ded60860d2299c5632bc825cd7d688585ad37e7449bf42183cbc232f183
|
data/CHANGELOG
CHANGED
@@ -1,10 +1,14 @@
|
|
1
|
+
4.0.3
|
2
|
+
|
3
|
+
* Change secure headers to lowercase.
|
4
|
+
|
1
5
|
3.9.0
|
2
6
|
|
3
|
-
* Cache regular expressions
|
7
|
+
* Cache regular expressions.
|
4
8
|
|
5
9
|
3.8.1
|
6
10
|
|
7
|
-
* Remove requirement on Time
|
11
|
+
* Remove requirement on Time.
|
8
12
|
|
9
13
|
3.8.0
|
10
14
|
|
@@ -64,4 +68,4 @@
|
|
64
68
|
* Remove Cuba::VERSION.
|
65
69
|
* Rename _call to call! (inspired from Sinatra).
|
66
70
|
* Fix a memory leak with the caching used in Tilt.
|
67
|
-
* Adding syntax highlighting to the README Code blocks
|
71
|
+
* Adding syntax highlighting to the README Code blocks.
|
data/cuba.gemspec
CHANGED
data/lib/cuba/render.rb
CHANGED
@@ -13,7 +13,7 @@ class Cuba
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def render(template, locals = {}, layout = settings[:render][:layout])
|
16
|
-
res.headers[
|
16
|
+
res.headers[Rack::CONTENT_TYPE] ||= "text/html; charset=utf-8"
|
17
17
|
res.write(view(template, locals, layout))
|
18
18
|
end
|
19
19
|
|
@@ -10,6 +10,8 @@
|
|
10
10
|
# - X-Download-Options [6].
|
11
11
|
# - X-Permitted-Cross-Domain-Policies [7].
|
12
12
|
#
|
13
|
+
# Due to HTTP/2 specifications and Rack specifications, field names are applied in all lowercase.
|
14
|
+
#
|
13
15
|
# == References
|
14
16
|
#
|
15
17
|
# [1]: https://github.com/twitter/secureheaders
|
@@ -19,17 +21,18 @@
|
|
19
21
|
# [5]: http://msdn.microsoft.com/en-us/library/ie/gg622941(v=vs.85).aspx
|
20
22
|
# [6]: http://msdn.microsoft.com/en-us/library/ie/jj542450(v=vs.85).aspx
|
21
23
|
# [7]: https://www.adobe.com/devnet/adobe-media-server/articles/cross-domain-xml-for-streaming.html
|
24
|
+
# [8]: https://datatracker.ietf.org/doc/html/rfc9113#name-http-fields
|
22
25
|
#
|
23
26
|
class Cuba
|
24
27
|
module Safe
|
25
28
|
module SecureHeaders
|
26
29
|
HEADERS = {
|
27
|
-
"
|
28
|
-
"
|
29
|
-
"
|
30
|
-
"
|
31
|
-
"
|
32
|
-
"
|
30
|
+
"x-content-type-options" => "nosniff",
|
31
|
+
"x-download-options" => "noopen",
|
32
|
+
"x-frame-options" => "SAMEORIGIN",
|
33
|
+
"x-permitted-cross-domain-policies" => "none",
|
34
|
+
"x-xss-protection" => "1; mode=block",
|
35
|
+
"strict-transport-security" => "max-age=2628000"
|
33
36
|
}
|
34
37
|
|
35
38
|
def self.setup(app)
|
data/lib/cuba.rb
CHANGED
@@ -10,7 +10,7 @@ class Cuba
|
|
10
10
|
REGEXES = Hash.new { |h, pattern| h[pattern] = /\A\/(#{pattern})(\/|\z)/ }
|
11
11
|
|
12
12
|
class Response
|
13
|
-
LOCATION = "
|
13
|
+
LOCATION = "location".freeze
|
14
14
|
|
15
15
|
module ContentType
|
16
16
|
HTML = "text/html".freeze # :nodoc:
|
@@ -91,8 +91,8 @@ class Cuba
|
|
91
91
|
@app ||= Rack::Builder.new
|
92
92
|
end
|
93
93
|
|
94
|
-
def self.use(middleware, *args, &block)
|
95
|
-
app.use(middleware, *args, &block)
|
94
|
+
def self.use(middleware, *args, **kwargs, &block)
|
95
|
+
app.use(middleware, *args, **kwargs, &block)
|
96
96
|
end
|
97
97
|
|
98
98
|
def self.define(&block)
|
data/test/middleware.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
require File.expand_path("helper", File.dirname(__FILE__))
|
2
2
|
|
3
3
|
class Shrimp
|
4
|
-
def initialize(app)
|
4
|
+
def initialize(app, foo:)
|
5
5
|
@app = app
|
6
|
+
@foo = foo
|
6
7
|
end
|
7
8
|
|
8
9
|
def call(env)
|
@@ -17,7 +18,7 @@ end
|
|
17
18
|
|
18
19
|
test do
|
19
20
|
class API < Cuba
|
20
|
-
use Shrimp
|
21
|
+
use Shrimp, foo: 'bar'
|
21
22
|
|
22
23
|
define do
|
23
24
|
on "v1/test" do
|
data/test/redirect.rb
CHANGED
data/test/render.rb
CHANGED
data/test/run.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cuba
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michel Martens
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|