rack-ssl-enforcer 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -78,8 +78,10 @@ module Rack
78
78
  if keys.any? {|option| @options.key?(option)}
79
79
  keys.any? do |key|
80
80
  rules = [@options[key]].flatten.compact
81
- rules.any? do |pattern|
82
- matches?(key, pattern, req)
81
+ unless rules.empty?
82
+ rules.send(key == :except_hosts || key == :except ? "all?" : "any?") do |pattern|
83
+ matches?(key, pattern, req)
84
+ end
83
85
  end
84
86
  end
85
87
  else
@@ -141,7 +143,8 @@ module Rack
141
143
 
142
144
  # see http://en.wikipedia.org/wiki/Strict_Transport_Security
143
145
  def set_hsts_headers!(headers)
144
- opts = { :expires => 31536000, :subdomains => true }.merge(@options[:hsts] || {})
146
+ opts = { :expires => 31536000, :subdomains => true }
147
+ opts.merge!(@options[:hsts]) if @options[:hsts].is_a? Hash
145
148
  value = "max-age=#{opts[:expires]}"
146
149
  value += "; includeSubDomains" if opts[:subdomains]
147
150
  headers.merge!({ 'Strict-Transport-Security' => value })
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  class SslEnforcer
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-ssl-enforcer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
5
- prerelease:
4
+ prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 2
9
- - 1
10
- version: 0.2.1
8
+ - 2
9
+ version: 0.2.2
11
10
  platform: ruby
12
11
  authors:
13
12
  - Tobias Matthies
@@ -16,7 +15,7 @@ autorequire:
16
15
  bindir: bin
17
16
  cert_chain: []
18
17
 
19
- date: 2011-02-15 00:00:00 +01:00
18
+ date: 2011-03-13 00:00:00 +01:00
20
19
  default_executable:
21
20
  dependencies:
22
21
  - !ruby/object:Gem::Dependency
@@ -27,7 +26,6 @@ dependencies:
27
26
  requirements:
28
27
  - - ~>
29
28
  - !ruby/object:Gem::Version
30
- hash: 19
31
29
  segments:
32
30
  - 0
33
31
  - 3
@@ -43,7 +41,6 @@ dependencies:
43
41
  requirements:
44
42
  - - ~>
45
43
  - !ruby/object:Gem::Version
46
- hash: 23
47
44
  segments:
48
45
  - 0
49
46
  - 1
@@ -59,7 +56,6 @@ dependencies:
59
56
  requirements:
60
57
  - - ~>
61
58
  - !ruby/object:Gem::Version
62
- hash: 3
63
59
  segments:
64
60
  - 1
65
61
  - 0
@@ -75,7 +71,6 @@ dependencies:
75
71
  requirements:
76
72
  - - ~>
77
73
  - !ruby/object:Gem::Version
78
- hash: 9
79
74
  segments:
80
75
  - 2
81
76
  - 1
@@ -91,7 +86,6 @@ dependencies:
91
86
  requirements:
92
87
  - - ~>
93
88
  - !ruby/object:Gem::Version
94
- hash: 37
95
89
  segments:
96
90
  - 2
97
91
  - 11
@@ -107,7 +101,6 @@ dependencies:
107
101
  requirements:
108
102
  - - ~>
109
103
  - !ruby/object:Gem::Version
110
- hash: 31
111
104
  segments:
112
105
  - 1
113
106
  - 2
@@ -123,7 +116,6 @@ dependencies:
123
116
  requirements:
124
117
  - - ~>
125
118
  - !ruby/object:Gem::Version
126
- hash: 3
127
119
  segments:
128
120
  - 0
129
121
  - 5
@@ -161,7 +153,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
161
153
  requirements:
162
154
  - - ">="
163
155
  - !ruby/object:Gem::Version
164
- hash: 3
165
156
  segments:
166
157
  - 0
167
158
  version: "0"
@@ -170,7 +161,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
161
  requirements:
171
162
  - - ">="
172
163
  - !ruby/object:Gem::Version
173
- hash: 23
174
164
  segments:
175
165
  - 1
176
166
  - 3
@@ -179,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
169
  requirements: []
180
170
 
181
171
  rubyforge_project: rack-ssl-enforcer
182
- rubygems_version: 1.5.0
172
+ rubygems_version: 1.3.7
183
173
  signing_key:
184
174
  specification_version: 3
185
175
  summary: A simple Rack middleware to enforce SSL