tyler-ssl_requirement 1.0.4 → 1.1.0
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.
- data/VERSION.yml +2 -2
- data/lib/ssl_requirement.rb +5 -5
- data/lib/url_rewriter.rb +13 -15
- metadata +2 -2
data/VERSION.yml
CHANGED
data/lib/ssl_requirement.rb
CHANGED
@@ -27,11 +27,6 @@ module SslRequirement
|
|
27
27
|
@@ssl_host = host
|
28
28
|
end
|
29
29
|
|
30
|
-
def self.included(controller)
|
31
|
-
controller.extend(ClassMethods)
|
32
|
-
controller.before_filter(:ensure_proper_protocol)
|
33
|
-
end
|
34
|
-
|
35
30
|
def self.disable_ssl_check?
|
36
31
|
@@disable_ssl_check ||= false
|
37
32
|
end
|
@@ -73,6 +68,11 @@ module SslRequirement
|
|
73
68
|
end
|
74
69
|
|
75
70
|
private
|
71
|
+
def self.included(controller)
|
72
|
+
controller.extend(ClassMethods)
|
73
|
+
controller.before_filter(:ensure_proper_protocol)
|
74
|
+
end
|
75
|
+
|
76
76
|
def ensure_proper_protocol
|
77
77
|
return true if SslRequirement.disable_ssl_check?
|
78
78
|
return true if ssl_allowed?
|
data/lib/url_rewriter.rb
CHANGED
@@ -1,27 +1,25 @@
|
|
1
1
|
require 'action_controller/url_rewriter'
|
2
|
+
require 'action_controller/routing/optimisations'
|
2
3
|
|
3
4
|
module ActionController
|
4
5
|
class UrlRewriter
|
5
|
-
|
6
6
|
# Add a secure option to the rewrite method.
|
7
7
|
def rewrite_with_secure_option(options = {})
|
8
8
|
secure = options.delete(:secure)
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
9
|
+
options.merge!(:only_path => false, :protocol => secure ? 'https' : 'http') unless SslRequirement.disable_ssl_check?
|
10
|
+
rewrite_without_secure_option options
|
11
|
+
end
|
12
|
+
alias_method_chain :rewrite, :secure_option
|
13
|
+
end
|
14
|
+
|
15
|
+
module Routing
|
16
|
+
module Optimisation
|
17
|
+
class PositionalArgumentsWithAdditionalParams
|
18
|
+
def guard_condition_with_secure_option
|
19
|
+
guard_condition_without_secure_option + ' && !args.last.has_key?(:secure)'
|
20
20
|
end
|
21
|
+
alias_method_chain :guard_condition, :secure_option
|
21
22
|
end
|
22
|
-
|
23
|
-
rewrite_without_secure_option(options)
|
24
23
|
end
|
25
|
-
alias_method_chain :rewrite, :secure_option
|
26
24
|
end
|
27
25
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tyler-ssl_requirement
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RailsJedi
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2008-12-
|
13
|
+
date: 2008-12-30 00:00:00 -08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|