rack-secure_only 0.4.0 → 0.4.1
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.
- data/README.rdoc +19 -17
- data/VERSION +1 -1
- data/lib/rack/secure_only/request.rb +2 -2
- data/rack-secure_only.gemspec +4 -4
- data/spec/rack/secure_only_spec.rb +1 -1
- metadata +15 -4
data/README.rdoc
CHANGED
@@ -9,6 +9,8 @@ This means the redirect will also work on heroku.com
|
|
9
9
|
|
10
10
|
This can be disabled by setting the :use_http_x_forwarded_proto option to false.
|
11
11
|
|
12
|
+
It is currently only tested on ruby 1.9
|
13
|
+
|
12
14
|
== Installation
|
13
15
|
|
14
16
|
sudo gem install rack-secure_only
|
@@ -51,23 +53,23 @@ to determine if the current request is http or https
|
|
51
53
|
require 'rack-secure_only'
|
52
54
|
|
53
55
|
run lambda { |env|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
56
|
+
req = Request.new(env)
|
57
|
+
|
58
|
+
res_body = ""
|
59
|
+
|
60
|
+
if req.https?
|
61
|
+
res_body = "You just made a request on https"
|
62
|
+
elsif req.http?
|
63
|
+
res_body = "You just made a request on http"
|
64
|
+
elsif req.https?(false) # do not check the HTTP_X_FORWARDED_PROTO header
|
65
|
+
res_body = "You just made a request on a url with scheme https"
|
66
|
+
elsif req.http?(false) # do not check the HTTP_X_FORWARDED_PROTO header
|
67
|
+
res_body = "You just made a request on a url with scheme http, I did not check the HTTP_X_FORWARDED_PROTO header"
|
68
|
+
end
|
69
|
+
|
70
|
+
res_body << " and the HTTP_X_FORWARDED_PROTO header was set to" + req.forwarded_proto
|
71
|
+
|
72
|
+
[200, { 'Content-Type' => 'text/plain' }, res_body]
|
71
73
|
}
|
72
74
|
|
73
75
|
== Note on Patches/Pull Requests
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
@@ -2,8 +2,8 @@ require "rack/request"
|
|
2
2
|
|
3
3
|
module Rack
|
4
4
|
|
5
|
-
# The secure_only
|
6
|
-
# to
|
5
|
+
# The secure_only extension add some convenience methods
|
6
|
+
# to determine if the request is a http or a https request
|
7
7
|
#
|
8
8
|
class Request
|
9
9
|
|
data/rack-secure_only.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rack-secure_only}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Klaas Speller"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-07-22}
|
13
13
|
s.description = %q{Redirect http to https and the other way around}
|
14
14
|
s.email = %q{klaasspeller@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -35,7 +35,7 @@ Gem::Specification.new do |s|
|
|
35
35
|
s.homepage = %q{http://github.com/spllr/rack-secure_only}
|
36
36
|
s.rdoc_options = ["--charset=UTF-8"]
|
37
37
|
s.require_paths = ["lib"]
|
38
|
-
s.rubygems_version = %q{1.3.
|
38
|
+
s.rubygems_version = %q{1.3.7}
|
39
39
|
s.summary = %q{Redirect http to https and the other way around}
|
40
40
|
s.test_files = [
|
41
41
|
"spec/rack/secure_only/request_spec.rb",
|
@@ -47,7 +47,7 @@ Gem::Specification.new do |s|
|
|
47
47
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
48
48
|
s.specification_version = 3
|
49
49
|
|
50
|
-
if Gem::Version.new(Gem::
|
50
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
51
51
|
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
52
52
|
s.add_development_dependency(%q<rack-test>, [">= 0.5.3"])
|
53
53
|
s.add_runtime_dependency(%q<rack>, [">= 1.1.0"])
|
@@ -37,7 +37,7 @@ describe Rack::SecureOnly do
|
|
37
37
|
|
38
38
|
describe "with HTTP_X_FORWARDED_PROTO header set to https (like with heroku ssl)" do
|
39
39
|
before(:each) do
|
40
|
-
@response = @request.get('
|
40
|
+
@response = @request.get('http://www.example.com/secure', { 'HTTP_X_FORWARDED_PROTO' => 'https' })
|
41
41
|
end
|
42
42
|
|
43
43
|
it "should do no redirect" do
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-secure_only
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 13
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
9
|
+
- 1
|
10
|
+
version: 0.4.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Klaas Speller
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-07-22 00:00:00 +02:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: rspec
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 13
|
27
30
|
segments:
|
28
31
|
- 1
|
29
32
|
- 2
|
@@ -35,9 +38,11 @@ dependencies:
|
|
35
38
|
name: rack-test
|
36
39
|
prerelease: false
|
37
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
38
42
|
requirements:
|
39
43
|
- - ">="
|
40
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 13
|
41
46
|
segments:
|
42
47
|
- 0
|
43
48
|
- 5
|
@@ -49,9 +54,11 @@ dependencies:
|
|
49
54
|
name: rack
|
50
55
|
prerelease: false
|
51
56
|
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
52
58
|
requirements:
|
53
59
|
- - ">="
|
54
60
|
- !ruby/object:Gem::Version
|
61
|
+
hash: 19
|
55
62
|
segments:
|
56
63
|
- 1
|
57
64
|
- 1
|
@@ -93,23 +100,27 @@ rdoc_options:
|
|
93
100
|
require_paths:
|
94
101
|
- lib
|
95
102
|
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
none: false
|
96
104
|
requirements:
|
97
105
|
- - ">="
|
98
106
|
- !ruby/object:Gem::Version
|
107
|
+
hash: 3
|
99
108
|
segments:
|
100
109
|
- 0
|
101
110
|
version: "0"
|
102
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
|
+
none: false
|
103
113
|
requirements:
|
104
114
|
- - ">="
|
105
115
|
- !ruby/object:Gem::Version
|
116
|
+
hash: 3
|
106
117
|
segments:
|
107
118
|
- 0
|
108
119
|
version: "0"
|
109
120
|
requirements: []
|
110
121
|
|
111
122
|
rubyforge_project:
|
112
|
-
rubygems_version: 1.3.
|
123
|
+
rubygems_version: 1.3.7
|
113
124
|
signing_key:
|
114
125
|
specification_version: 3
|
115
126
|
summary: Redirect http to https and the other way around
|