ssl_routes 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MmU5MjVhMWY0ZjcyNDMwMDFiNGZjYmI2NmI5YTM4YzgxYjdkYWQzYw==
4
+ OWRjZTk0YmFmYjBlNmI4NmM5MGUwNzg5ODcyYmFkOTYxYzRlZTdiNA==
5
5
  data.tar.gz: !binary |-
6
- YmIyYmM1NjU5MjgxNDMxNDk3NjgyMTY1N2Q5NDU2ZjUwMDViYmQzMQ==
6
+ YjBkNTUwYWYxYWEyNzc0OThlYjNkNDM3YTg3ZWM4MDQ0NGM0MTEzNg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NjlhN2I3MTU4OWNhZDA1YmY5Mjk2MGE3MTIzMTYyMGY0MzFlMjhhYTBhMDU4
10
- ZmNlOTdiNTA2MDJmNTZmOTZjZmM5NTYxYWQ5MWM2OTgyYmUyYWE0YzkyMzcw
11
- YTc4YWIwYjk4YzI5ZGE4NmEzZmZjZTE5ZTRkZmYxM2FiZTc2NWM=
9
+ ODQwYWQyZTMyOGI1NTUwYmQ0MjEzNTJiMWY5ZDk2MWVmNGE2OTYxNzg2NTUw
10
+ ZWQyNzk0NWQzNGFhOTg0ZjMwMjZmZWZmNjY0MWU1ODQ5M2M4NjQ4MWYwMjAz
11
+ NTFkZGI1MGMzM2M1Zjc3MzBlZjRjMGNkOTc4MDRkYzljOGM0NmU=
12
12
  data.tar.gz: !binary |-
13
- Nzk4MTVhYjBmODUyNmQ1ODE5OTYxMzU4NGFkNzNlYTk3YTAwNWRlYjJiN2Q3
14
- MmE4YzIxMzMxMmZkN2IyNTdlNmJmMzQ4MGQ4N2RjNGE0MzE4Mzk0ZDE4YjJl
15
- NDVmZWE0YmEyZmQ5MzU5NjAxMzQ0NWJlNTNmYWExMTMxMWYyZmM=
13
+ ZGQ1M2Q2MzBiNTkwNDdhNTJhYThhMDFhM2FmOWFmZWYxMTZlZjYzYTQ2NWRl
14
+ YTM5MDU2MzA0MGU4NDM2ZGZlNDQ5MzQzNWFjNmVjNzhlYWM2ODcwNjVkNTBh
15
+ MDgwMjFmZWMyM2MxMGNlNjNlNDg2MGYxMmM4YTRjMTVkMWNmZmY=
@@ -39,11 +39,10 @@ module SslRoutes
39
39
  routes = Rails.application.routes
40
40
  options = routes.recognize_path request.path, {:method => request.env['REQUEST_METHOD']}
41
41
  current, target = determine_protocols(options)
42
- safari_preloading = !!request.xhr? && request.accepts.all? { |a| a.symbol != :json }
43
- if (current != target && safari_preloading && request.get?) || (current != target && !request.xhr? && request.get?)
42
+ if (current != target && !request.xhr? && request.get?)
44
43
  flash.keep
45
- response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
46
- response.headers["Pragma"] = "no-cache"
44
+ response.headers['Cache-Control'] = 'no-cache, no-store, max-age=0, must-revalidate'
45
+ response.headers['Pragma'] = 'no-cache'
47
46
  redirect_to "#{target}://#{request.host_with_port + request.fullpath}"
48
47
  return false
49
48
  end
@@ -59,8 +58,8 @@ module SslRoutes
59
58
 
60
59
  def url_for_with_ssl_support(options)
61
60
  ac = self.respond_to?(:controller) ? self.controller : self
62
- if options.is_a?(Hash) && options[:only_path] == true
63
- if ac.respond_to?(:enable_ssl) && ac.enable_ssl
61
+ if ac.respond_to?(:enable_ssl) && ac.enable_ssl
62
+ if options.is_a?(Hash)
64
63
  case options
65
64
  when Hash
66
65
  current, target = ac.determine_protocols(options)
@@ -69,12 +68,7 @@ module SslRoutes
69
68
  end
70
69
  end
71
70
  end
72
- else
73
- if options[:ssl] && ac.respond_to?(:enable_ssl) && ac.enable_ssl
74
- options.merge!({ :protocol => 'https' })
75
- end
76
71
  end
77
-
78
72
  url_for_without_ssl_support(options)
79
73
  end
80
74
 
@@ -1,5 +1,5 @@
1
1
  module SslRoutes
2
2
 
3
- VERSION = '0.2.1'
3
+ VERSION = '0.2.2'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ssl_routes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cedric Howe