rack-ssl 1.2.0 → 1.3.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 +9 -5
  2. metadata +12 -11
@@ -16,8 +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]
20
- @subdomain = options[:subdomain]
19
+ @exclude = options[:exclude]
20
+ @host = options[:host]
21
21
  end
22
22
 
23
23
  def call(env)
@@ -46,10 +46,14 @@ module Rack
46
46
  end
47
47
 
48
48
  def redirect_to_https(env)
49
- req = Request.new(env)
50
- location = "https://#{[@subdomain, req.host].compact.join('.')}#{req.fullpath}"
49
+ req = Request.new(env)
50
+ url = URI(req.url)
51
+ url.scheme = "https"
52
+ url.host = @host if @host
53
+ headers = hsts_headers.merge('Content-Type' => 'text/html',
54
+ 'Location' => url.to_s)
51
55
 
52
- [301, hsts_headers.merge({'Content-Type' => "text/html", 'Location' => location}), []]
56
+ [301, headers, []]
53
57
  end
54
58
 
55
59
  # http://tools.ietf.org/html/draft-hodges-strict-transport-sec-02
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: 31
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 2
8
+ - 3
9
9
  - 0
10
- version: 1.2.0
10
+ version: 1.3.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: 2011-01-12 00:00:00 -06:00
18
+ date: 2011-02-16 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -32,17 +32,18 @@ dependencies:
32
32
  version: "0"
33
33
  type: :runtime
34
34
  version_requirements: *id001
35
- description: Force SSL/TLS in your app.
35
+ description: " Rack middleware to force SSL/TLS.\n"
36
36
  email: josh@joshpeek.com
37
37
  executables: []
38
38
 
39
39
  extensions: []
40
40
 
41
- extra_rdoc_files:
42
- - LICENSE
43
- - README.md
41
+ extra_rdoc_files: []
42
+
44
43
  files:
45
44
  - lib/rack/ssl.rb
45
+ - LICENSE
46
+ - README.md
46
47
  has_rdoc: true
47
48
  homepage: https://github.com/josh/rack-ssl
48
49
  licenses: []
@@ -72,10 +73,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
73
  version: "0"
73
74
  requirements: []
74
75
 
75
- rubyforge_project:
76
- rubygems_version: 1.4.2
76
+ rubyforge_project: rack-ssl
77
+ rubygems_version: 1.4.1
77
78
  signing_key:
78
79
  specification_version: 3
79
- summary: Rack middleware to force SSL
80
+ summary: Force SSL/TLS in your app.
80
81
  test_files: []
81
82