sinatra 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sinatra might be problematic. Click here for more details.
- checksums.yaml +5 -5
- data/CHANGELOG.md +13 -1
- data/Gemfile +1 -1
- data/README.md +3 -1
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/lib/sinatra/base.rb +3 -4
- data/lib/sinatra/indifferent_hash.rb +57 -5
- data/lib/sinatra/version.rb +1 -1
- data/sinatra.gemspec +24 -1
- metadata +13 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2eb0ce368ea68772182f3af721a991c23d85cc97
|
4
|
+
data.tar.gz: d55ba8f5d95c39f7e8903ced236103b46b1a29ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9ccb8f9d0a4636c538af77f6f35920620873aa7b5330a74e0811213505ab8ac7ee3daa238b22d378a2ccf603130091acef6cae2cbb661ecd8038cefab2f6f03
|
7
|
+
data.tar.gz: 77fcd98ec71a87f3ba5cf0105f8f0e3f1a8f2c079051d2b44677fe22be1cb7cc3a0b8b85fed4997e3a83f9baae1f268e802d3f34eb5a85544a1260c7290d88e8
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,18 @@
|
|
1
|
+
## 2.0.4 / 2018-09-15
|
2
|
+
|
3
|
+
* Don't blow up when passing frozen string to `send_file` disposition [#1137](https://github.com/sinatra/sinatra/pull/1137) by Andrew Selder
|
4
|
+
|
5
|
+
* Fix ubygems LoadError [#1436](https://github.com/sinatra/sinatra/pull/1436) by Pavel Rosický
|
6
|
+
|
7
|
+
* Unescape regex captures [#1446](https://github.com/sinatra/sinatra/pull/1446) by Jordan Owens
|
8
|
+
|
9
|
+
* Slight performance improvements for IndifferentHash [#1427](https://github.com/sinatra/sinatra/pull/1427) by Mike Pastore
|
10
|
+
|
11
|
+
* Improve development support and documentation and source code by Will Yang, Jake Craige, Grey Baker and Guilherme Goettems Schneider
|
12
|
+
|
1
13
|
## 2.0.3 / 2018-06-09
|
2
14
|
|
3
|
-
* Fix the backports gem regression [#1442](
|
15
|
+
* Fix the backports gem regression [#1442](https://github.com/sinatra/sinatra/issues/1442) by Marc-André Lafortune
|
4
16
|
|
5
17
|
## 2.0.2 / 2018-06-05
|
6
18
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Sinatra
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/sinatra.svg)](http://badge.fury.io/rb/sinatra)
|
3
4
|
[![Build Status](https://secure.travis-ci.org/sinatra/sinatra.svg)](https://travis-ci.org/sinatra/sinatra)
|
5
|
+
[![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=sinatra&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=sinatra&package-manager=bundler&version-scheme=semver)
|
4
6
|
|
5
7
|
Sinatra is a [DSL](https://en.wikipedia.org/wiki/Domain-specific_language) for
|
6
8
|
quickly creating web applications in Ruby with minimal effort:
|
@@ -2191,7 +2193,7 @@ end
|
|
2191
2193
|
### Configuring attack protection
|
2192
2194
|
|
2193
2195
|
Sinatra is using
|
2194
|
-
[Rack::Protection](https://github.com/sinatra/rack-protection#readme) to
|
2196
|
+
[Rack::Protection](https://github.com/sinatra/sinatra/tree/master/rack-protection#readme) to
|
2195
2197
|
defend your application against common, opportunistic attacks. You can
|
2196
2198
|
easily disable this behavior (which will open up your application to tons
|
2197
2199
|
of common vulnerabilities):
|
data/Rakefile
CHANGED
@@ -30,7 +30,7 @@ end
|
|
30
30
|
|
31
31
|
Rake::TestTask.new(:test) do |t|
|
32
32
|
t.test_files = FileList['test/*_test.rb']
|
33
|
-
t.ruby_opts = ['-rubygems'] if defined? Gem
|
33
|
+
t.ruby_opts = ['-r rubygems'] if defined? Gem
|
34
34
|
t.ruby_opts << '-I.'
|
35
35
|
t.warning = true
|
36
36
|
end
|
@@ -41,7 +41,7 @@ Rake::TestTask.new(:"test:core") do |t|
|
|
41
41
|
readme request response result route_added_hook
|
42
42
|
routing server settings sinatra static templates]
|
43
43
|
t.test_files = core_tests.map {|n| "test/#{n}_test.rb"}
|
44
|
-
t.ruby_opts = ["-rubygems"] if defined? Gem
|
44
|
+
t.ruby_opts = ["-r rubygems"] if defined? Gem
|
45
45
|
t.ruby_opts << "-I."
|
46
46
|
t.warning = true
|
47
47
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.4
|
data/lib/sinatra/base.rb
CHANGED
@@ -360,7 +360,7 @@ module Sinatra
|
|
360
360
|
# Set the Content-Disposition to "attachment" with the specified filename,
|
361
361
|
# instructing the user agents to prompt to save.
|
362
362
|
def attachment(filename = nil, disposition = :attachment)
|
363
|
-
response['Content-Disposition'] = disposition.to_s
|
363
|
+
response['Content-Disposition'] = disposition.to_s.dup
|
364
364
|
if filename
|
365
365
|
params = '; filename="%s"' % File.basename(filename)
|
366
366
|
response['Content-Disposition'] << params
|
@@ -1028,7 +1028,7 @@ module Sinatra
|
|
1028
1028
|
|
1029
1029
|
regexp_exists = pattern.is_a?(Mustermann::Regular) || (pattern.respond_to?(:patterns) && pattern.patterns.any? {|subpattern| subpattern.is_a?(Mustermann::Regular)} )
|
1030
1030
|
if regexp_exists
|
1031
|
-
captures = pattern.match(route).captures
|
1031
|
+
captures = pattern.match(route).captures.map { |c| URI_INSTANCE.unescape(c) if c }
|
1032
1032
|
values += captures
|
1033
1033
|
@params[:captures] = force_encoding(captures) unless captures.nil? || captures.empty?
|
1034
1034
|
else
|
@@ -1813,10 +1813,9 @@ module Sinatra
|
|
1813
1813
|
server.unshift 'control_tower'
|
1814
1814
|
else
|
1815
1815
|
server.unshift 'reel'
|
1816
|
+
server.unshift 'puma'
|
1816
1817
|
server.unshift 'mongrel' if ruby_engine.nil?
|
1817
|
-
server.unshift 'puma' if ruby_engine != 'rbx'
|
1818
1818
|
server.unshift 'thin' if ruby_engine != 'jruby'
|
1819
|
-
server.unshift 'puma' if ruby_engine == 'rbx'
|
1820
1819
|
server.unshift 'trinidad' if ruby_engine == 'jruby'
|
1821
1820
|
end
|
1822
1821
|
|
@@ -1,4 +1,23 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
if !$LOAD_PATH.grep(%r{gems/activesupport}).empty? && $LOADED_FEATURES.grep(%r{active_support/core_ext/hash}).empty?
|
3
|
+
puts <<-EOF
|
4
|
+
WARNING: If you plan to load any of ActiveSupport's core extensions to Hash, be
|
5
|
+
sure to do so *before* loading Sinatra::Application or Sinatra::Base. If not,
|
6
|
+
you may disregard this warning.
|
7
|
+
EOF
|
8
|
+
end
|
9
|
+
|
10
|
+
if ENV['APP_ENV'] == 'test' && !Hash.method_defined?(:slice)
|
11
|
+
# Some extensions get loaded during testing (e.g. by RABL and our RABL test)
|
12
|
+
# that we have no control over, but we need it to load *before*
|
13
|
+
# IndifferentHash, so we'll do it preemptively here.
|
14
|
+
#
|
15
|
+
# Newer Rubies have these methods built-in, so the extensions are no-ops.
|
16
|
+
require 'active_support/core_ext/hash/conversions'
|
17
|
+
require 'active_support/core_ext/hash/slice'
|
18
|
+
require 'active_support/core_ext/hash/keys'
|
19
|
+
end
|
20
|
+
|
2
21
|
module Sinatra
|
3
22
|
# A poor man's ActiveSupport::HashWithIndifferentAccess, with all the Rails-y
|
4
23
|
# stuff removed.
|
@@ -41,11 +60,15 @@ module Sinatra
|
|
41
60
|
end
|
42
61
|
|
43
62
|
def initialize(*args)
|
44
|
-
|
63
|
+
args.map!(&method(:convert_value))
|
64
|
+
|
65
|
+
super(*args)
|
45
66
|
end
|
46
67
|
|
47
68
|
def default(*args)
|
48
|
-
|
69
|
+
args.map!(&method(:convert_key))
|
70
|
+
|
71
|
+
super(*args)
|
49
72
|
end
|
50
73
|
|
51
74
|
def default=(value)
|
@@ -61,7 +84,9 @@ module Sinatra
|
|
61
84
|
end
|
62
85
|
|
63
86
|
def fetch(key, *args)
|
64
|
-
|
87
|
+
args.map!(&method(:convert_value))
|
88
|
+
|
89
|
+
super(convert_key(key), *args)
|
65
90
|
end
|
66
91
|
|
67
92
|
def [](key)
|
@@ -101,16 +126,21 @@ module Sinatra
|
|
101
126
|
end if method_defined?(:dig) # Added in Ruby 2.3
|
102
127
|
|
103
128
|
def fetch_values(*keys)
|
104
|
-
|
129
|
+
keys.map!(&method(:convert_key))
|
130
|
+
|
131
|
+
super(*keys)
|
105
132
|
end if method_defined?(:fetch_values) # Added in Ruby 2.3
|
106
133
|
|
107
134
|
def slice(*keys)
|
108
135
|
keys.map!(&method(:convert_key))
|
136
|
+
|
109
137
|
self.class[super(*keys)]
|
110
138
|
end if method_defined?(:slice) # Added in Ruby 2.5
|
111
139
|
|
112
140
|
def values_at(*keys)
|
113
|
-
|
141
|
+
keys.map!(&method(:convert_key))
|
142
|
+
|
143
|
+
super(*keys)
|
114
144
|
end
|
115
145
|
|
116
146
|
def merge!(other_hash)
|
@@ -135,6 +165,28 @@ module Sinatra
|
|
135
165
|
super(other_hash.is_a?(self.class) ? other_hash : self.class[other_hash])
|
136
166
|
end
|
137
167
|
|
168
|
+
if method_defined?(:transform_values!) # Added in Ruby 2.4
|
169
|
+
def transform_values(&block)
|
170
|
+
dup.transform_values!(&block)
|
171
|
+
end
|
172
|
+
|
173
|
+
def transform_values!
|
174
|
+
super
|
175
|
+
super(&method(:convert_value))
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
if method_defined?(:transform_keys!) # Added in Ruby 2.5
|
180
|
+
def transform_keys(&block)
|
181
|
+
dup.transform_keys!(&block)
|
182
|
+
end
|
183
|
+
|
184
|
+
def transform_keys!
|
185
|
+
super
|
186
|
+
super(&method(:convert_key))
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
138
190
|
private
|
139
191
|
|
140
192
|
def convert_key(key)
|
data/lib/sinatra/version.rb
CHANGED
data/sinatra.gemspec
CHANGED
@@ -5,7 +5,7 @@ Gem::Specification.new 'sinatra', version do |s|
|
|
5
5
|
s.summary = "Classy web-development dressed in a DSL"
|
6
6
|
s.authors = ["Blake Mizerany", "Ryan Tomayko", "Simon Rozet", "Konstantin Haase"]
|
7
7
|
s.email = "sinatrarb@googlegroups.com"
|
8
|
-
s.homepage = "http://
|
8
|
+
s.homepage = "http://sinatrarb.com/"
|
9
9
|
s.license = 'MIT'
|
10
10
|
s.files = Dir['README*.md', 'lib/**/*', 'examples/*'] + [
|
11
11
|
".yardopts",
|
@@ -23,6 +23,29 @@ Gem::Specification.new 'sinatra', version do |s|
|
|
23
23
|
s.extra_rdoc_files = s.files.select { |p| p =~ /^README/ } << 'LICENSE'
|
24
24
|
s.rdoc_options = %w[--line-numbers --inline-source --title Sinatra --main README.rdoc --encoding=UTF-8]
|
25
25
|
|
26
|
+
if s.respond_to?(:metadata)
|
27
|
+
s.metadata = {
|
28
|
+
'source_code_uri' => 'https://github.com/sinatra/sinatra',
|
29
|
+
'changelog_uri' => 'https://github.com/sinatra/sinatra/blob/master/CHANGELOG.md',
|
30
|
+
'homepage_uri' => 'http://sinatrarb.com/',
|
31
|
+
'bug_tracker_uri' => 'https://github.com/sinatra/sinatra/issues',
|
32
|
+
'mailing_list_uri' => 'http://groups.google.com/group/sinatrarb',
|
33
|
+
'documentation_uri' => 'https://www.rubydoc.info/gems/sinatra'
|
34
|
+
}
|
35
|
+
else
|
36
|
+
msg = "RubyGems 2.0 or newer is required to protect against public "\
|
37
|
+
"gem pushes. You can update your rubygems version by running:\n\n"\
|
38
|
+
"gem install rubygems-update\n"\
|
39
|
+
"update_rubygems\n"\
|
40
|
+
"gem update --system"
|
41
|
+
raise <<-EOF
|
42
|
+
RubyGems 2.0 or newer is required to protect against public gem pushes. You can update your rubygems version by running:
|
43
|
+
gem install rubygems-update
|
44
|
+
update_rubygems:
|
45
|
+
gem update --system
|
46
|
+
EOF
|
47
|
+
end
|
48
|
+
|
26
49
|
s.required_ruby_version = '>= 2.2.0'
|
27
50
|
|
28
51
|
s.add_dependency 'rack', '~> 2.0'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Blake Mizerany
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2018-
|
14
|
+
date: 2018-09-15 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rack
|
@@ -47,14 +47,14 @@ dependencies:
|
|
47
47
|
requirements:
|
48
48
|
- - '='
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: 2.0.
|
50
|
+
version: 2.0.4
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
55
|
- - '='
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version: 2.0.
|
57
|
+
version: 2.0.4
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: mustermann
|
60
60
|
requirement: !ruby/object:Gem::Requirement
|
@@ -121,10 +121,16 @@ files:
|
|
121
121
|
- lib/sinatra/show_exceptions.rb
|
122
122
|
- lib/sinatra/version.rb
|
123
123
|
- sinatra.gemspec
|
124
|
-
homepage: http://
|
124
|
+
homepage: http://sinatrarb.com/
|
125
125
|
licenses:
|
126
126
|
- MIT
|
127
|
-
metadata:
|
127
|
+
metadata:
|
128
|
+
source_code_uri: https://github.com/sinatra/sinatra
|
129
|
+
changelog_uri: https://github.com/sinatra/sinatra/blob/master/CHANGELOG.md
|
130
|
+
homepage_uri: http://sinatrarb.com/
|
131
|
+
bug_tracker_uri: https://github.com/sinatra/sinatra/issues
|
132
|
+
mailing_list_uri: http://groups.google.com/group/sinatrarb
|
133
|
+
documentation_uri: https://www.rubydoc.info/gems/sinatra
|
128
134
|
post_install_message:
|
129
135
|
rdoc_options:
|
130
136
|
- "--line-numbers"
|
@@ -148,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
154
|
version: '0'
|
149
155
|
requirements: []
|
150
156
|
rubyforge_project:
|
151
|
-
rubygems_version: 2.
|
157
|
+
rubygems_version: 2.6.8
|
152
158
|
signing_key:
|
153
159
|
specification_version: 4
|
154
160
|
summary: Classy web-development dressed in a DSL
|