Class: Rack::SSLFacebook
- Inherits:
-
Object
- Object
- Rack::SSLFacebook
- Defined in:
- lib/rack/ssl_facebook.rb
Constant Summary collapse
- YEAR =
31536000
Class Method Summary collapse
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ SSLFacebook
constructor
A new instance of SSLFacebook.
Constructor Details
#initialize(app, options = {}) ⇒ SSLFacebook
Returns a new instance of SSLFacebook.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rack/ssl_facebook.rb', line 12 def initialize(app, = {}) @app = app @hsts = [:hsts] @hsts = {} if @hsts.nil? || @hsts == true @hsts = self.class..merge(@hsts) if @hsts @exclude = [:exclude] @host = [:host] @port = [:port] end |
Class Method Details
.default_hsts_options ⇒ Object
8 9 10 |
# File 'lib/rack/ssl_facebook.rb', line 8 def self. { :expires => YEAR, :subdomains => false } end |
Instance Method Details
#call(env) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rack/ssl_facebook.rb', line 24 def call(env) if @exclude && @exclude.call(env) @app.call(env) elsif scheme(env) == 'https' status, headers, body = @app.call(env) headers = hsts_headers.merge(headers) (headers) [status, headers, body] else redirect_to_https(env) end end |