rack-ssl 1.1.0 → 1.2.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.
Files changed (2) hide show
  1. data/lib/rack/ssl.rb +4 -2
  2. metadata +6 -6
@@ -16,7 +16,8 @@ module Rack
16
16
  @hsts = {} if @hsts.nil? || @hsts == true
17
17
  @hsts = self.class.default_hsts_options.merge(@hsts) if @hsts
18
18
 
19
- @exclude = options[:exclude]
19
+ @exclude = options[:exclude]
20
+ @subdomain = options[:subdomain]
20
21
  end
21
22
 
22
23
  def call(env)
@@ -46,7 +47,8 @@ module Rack
46
47
 
47
48
  def redirect_to_https(env)
48
49
  req = Request.new(env)
49
- location = req.url.sub(/^http:/, 'https:')
50
+ location = "https://#{[@subdomain, req.host].compact.join('.')}#{req.fullpath}"
51
+
50
52
  [301, hsts_headers.merge({'Content-Type' => "text/html", 'Location' => location}), []]
51
53
  end
52
54
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-ssl
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
5
- prerelease: false
4
+ hash: 31
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 1.1.0
10
+ version: 1.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joshua Peek
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-08 00:00:00 -06:00
18
+ date: 2011-01-12 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  requirements: []
74
74
 
75
75
  rubyforge_project:
76
- rubygems_version: 1.3.7
76
+ rubygems_version: 1.4.2
77
77
  signing_key:
78
78
  specification_version: 3
79
79
  summary: Rack middleware to force SSL