rack-ssl 1.3.4 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -0
  3. data/lib/rack/ssl.rb +8 -8
  4. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 39ffec4cba9fa627c631f6918127cdffa0465347
4
- data.tar.gz: 24d2eef19474804739a8de8c83a52e88261a4ab4
3
+ metadata.gz: 7715458599c0d8e028009ef2b48f3fa74e82781b
4
+ data.tar.gz: cb6a4ba8e8b7a5c8bd64bdb68c4629e49f27a089
5
5
  SHA512:
6
- metadata.gz: 3f64885c726eb1b0fd929e23a7cb7532a0c4745daaffa567d2c6a344aec75e43e9bb22cf608a3597c4d090196179827dc61acd1fc33b189261db430fe4314736
7
- data.tar.gz: 98c4f268463a1732ee25f0e4f638750333395d9e82b1587d843f49a3b29c4e750a13b8dfd38f00ce4b7f3d511d0898443f9f46c1130a3a9a1f2f6f7b357d26de
6
+ metadata.gz: 240abd92950b661de6c5cadf0a05a506bea06fe8ff77964e868d3579af68fe4bcca62165c6b78b7ffc807c831143972f083b860ff24cb4e7ed0284be6f30723a
7
+ data.tar.gz: 875c8ba898a9526102a5910387438d65363e2200fb8bf5d0821c80d2d9a08bcfbcc52e67979e8f8c3f733284d405f021329feebe7f743328c53e410ed444879a
data/README.md CHANGED
@@ -7,7 +7,15 @@ Force SSL/TLS in your app.
7
7
  2. Set `Strict-Transport-Security` header
8
8
  3. Flag all cookies as "secure"
9
9
 
10
+
11
+ Installation
12
+ ------------
13
+
14
+ gem install rack-ssl
15
+
16
+
10
17
  Usage
11
18
  -----
12
19
 
20
+ require 'rack/ssl'
13
21
  use Rack::SSL
@@ -46,16 +46,16 @@ module Rack
46
46
  end
47
47
 
48
48
  def redirect_to_https(env)
49
- req = Request.new(env)
50
-
51
- host = @host || req.host
52
- location = "https://#{host}#{req.fullpath}"
53
-
54
- status = %w[GET HEAD].include?(req.request_method) ? 301 : 307
55
- headers = hsts_headers.merge('Content-Type' => 'text/html',
56
- 'Location' => location)
49
+ req = Request.new(env)
50
+ url = URI(req.url)
51
+ url.scheme = "https"
52
+ url.host = @host if @host
53
+ status = %w[GET HEAD].include?(req.request_method) ? 301 : 307
54
+ headers = { 'Content-Type' => 'text/html', 'Location' => url.to_s }
57
55
 
58
56
  [status, headers, []]
57
+ rescue URI::InvalidURIError
58
+ [400, {"Content-Type" => "text/plain"}, []]
59
59
  end
60
60
 
61
61
  # http://tools.ietf.org/html/draft-hodges-strict-transport-sec-02
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-ssl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Peek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-23 00:00:00.000000000 Z
11
+ date: 2014-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -35,7 +35,8 @@ files:
35
35
  - LICENSE
36
36
  - README.md
37
37
  homepage: https://github.com/josh/rack-ssl
38
- licenses: []
38
+ licenses:
39
+ - MIT
39
40
  metadata: {}
40
41
  post_install_message:
41
42
  rdoc_options: []
@@ -58,4 +59,3 @@ signing_key:
58
59
  specification_version: 4
59
60
  summary: Force SSL/TLS in your app.
60
61
  test_files: []
61
- has_rdoc: