rack-canonical-host 0.2.3 → 1.0.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.
- checksums.yaml +5 -5
- data/.travis.yml +9 -11
- data/Appraisals +11 -3
- data/CHANGELOG.md +5 -1
- data/README.md +4 -4
- data/gemfiles/rack_1.5.gemfile +1 -1
- data/gemfiles/rack_1.5.gemfile.lock +47 -0
- data/gemfiles/rack_1.6.gemfile +1 -1
- data/gemfiles/rack_1.6.gemfile.lock +47 -0
- data/gemfiles/rack_2.0.gemfile +1 -1
- data/gemfiles/rack_2.0.gemfile.lock +47 -0
- data/gemfiles/rack_2.1.gemfile +7 -0
- data/gemfiles/rack_2.1.gemfile.lock +47 -0
- data/gemfiles/rack_2.2.gemfile +7 -0
- data/gemfiles/rack_2.2.gemfile.lock +47 -0
- data/lib/rack/canonical_host/redirect.rb +10 -6
- data/lib/rack/canonical_host/version.rb +1 -1
- data/spec/rack/canonical_host_spec.rb +43 -39
- metadata +10 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 36437f7276540d9097e0dfaccebde73e146de68039a3477013f94d2c96f5a2d9
|
|
4
|
+
data.tar.gz: bb2183b48c3379140f7119eb410c9b9b6a64ec2dd8ed9a7e0a5a86a01ef63e76
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 797fd843b45adb8ce8abff067c04d52792fbafb2a4752120b9b3f56502dc6c5e4c51356f810831a3199a13f00df33935139ef38a5186ea6a866f0851fe6d822b
|
|
7
|
+
data.tar.gz: d8733e910110b3dc6365ea862bbdb3e87984c34de9581adc27ce7ee3dcfc36661f1415b080845b24e74fa1eef853c1a75096b74bec65834338fb86e3760db93a
|
data/.travis.yml
CHANGED
|
@@ -7,17 +7,15 @@ gemfile:
|
|
|
7
7
|
- gemfiles/rack_1.5.gemfile
|
|
8
8
|
- gemfiles/rack_1.6.gemfile
|
|
9
9
|
- gemfiles/rack_2.0.gemfile
|
|
10
|
+
- gemfiles/rack_2.1.gemfile
|
|
11
|
+
- gemfiles/rack_2.2.gemfile
|
|
10
12
|
|
|
11
13
|
rvm:
|
|
12
|
-
- 2.
|
|
13
|
-
- 2.
|
|
14
|
-
- 2.
|
|
15
|
-
- 2.
|
|
16
|
-
- 2.
|
|
14
|
+
- 2.3.8
|
|
15
|
+
- 2.4.9
|
|
16
|
+
- 2.5.8
|
|
17
|
+
- 2.6.5
|
|
18
|
+
- 2.7.0
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
- rvm: 2.0.0
|
|
21
|
-
gemfile: gemfiles/rack_2.0.gemfile
|
|
22
|
-
- rvm: 2.1.10
|
|
23
|
-
gemfile: gemfiles/rack_2.0.gemfile
|
|
20
|
+
before_install:
|
|
21
|
+
- gem install bundler -v 1.17.2
|
data/Appraisals
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
appraise 'rack-1.5' do
|
|
2
|
-
gem 'rack', '~> 1.5'
|
|
2
|
+
gem 'rack', '~> 1.5.0'
|
|
3
3
|
end
|
|
4
4
|
|
|
5
5
|
appraise 'rack-1.6' do
|
|
6
|
-
gem 'rack', '~> 1.6'
|
|
6
|
+
gem 'rack', '~> 1.6.0'
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
appraise 'rack-2.0' do
|
|
10
|
-
gem 'rack', '~> 2.0'
|
|
10
|
+
gem 'rack', '~> 2.0.0'
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
appraise 'rack-2.1' do
|
|
14
|
+
gem 'rack', '~> 2.1.0'
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
appraise 'rack-2.2' do
|
|
18
|
+
gem 'rack', '~> 2.2.0'
|
|
11
19
|
end
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.0 (2020-04-16)
|
|
4
|
+
|
|
5
|
+
* Use equality to determine string matches on `:if` and `:ignore`
|
|
6
|
+
|
|
3
7
|
## 0.2.3 (2017-04-20)
|
|
4
8
|
|
|
5
9
|
* Add regexp support for `:ignore` option ([Daniel Searles][squaresurf])
|
|
@@ -73,7 +77,7 @@
|
|
|
73
77
|
[jschuur]: http://github.com/jschuur
|
|
74
78
|
[nbibler]: http://github.com/nbibler
|
|
75
79
|
[rubymaverick]: http://github.com/ericallam
|
|
76
|
-
[
|
|
80
|
+
[squaresurf]: https://github.com/squaresurf
|
|
77
81
|
[tma]: http://github.com/tma
|
|
78
82
|
[tylerhunt]: http://github.com/tylerhunt
|
|
79
83
|
[zoso10]: http://github.com/zoso10
|
data/README.md
CHANGED
|
@@ -4,10 +4,9 @@ Rack middleware that lets you define a single host name as the canonical host
|
|
|
4
4
|
for your application. Requests for other host names will then be redirected to
|
|
5
5
|
the canonical host.
|
|
6
6
|
|
|
7
|
-
[](https://gemnasium.com/tylerhunt/rack-canonical-host)
|
|
7
|
+
[](http://rubygems.org/gems/rack-canonical-host)
|
|
8
|
+
[](https://travis-ci.org/tylerhunt/rack-canonical-host)
|
|
9
|
+
[](https://codeclimate.com/github/tylerhunt/rack-canonical-host)
|
|
11
10
|
|
|
12
11
|
## Installation
|
|
13
12
|
|
|
@@ -35,6 +34,7 @@ Here’s a simple example of what the `config.ru` in a Rails application might
|
|
|
35
34
|
look like after adding the `Rack::CanonicalHost` middleware.
|
|
36
35
|
|
|
37
36
|
```ruby
|
|
37
|
+
require 'rack/canonical_host'
|
|
38
38
|
require ::File.expand_path('../config/environment', __FILE__)
|
|
39
39
|
|
|
40
40
|
use Rack::CanonicalHost, 'example.com'
|
data/gemfiles/rack_1.5.gemfile
CHANGED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: ..
|
|
3
|
+
specs:
|
|
4
|
+
rack-canonical-host (1.0.0)
|
|
5
|
+
addressable (> 0, < 3)
|
|
6
|
+
rack (>= 1.0.0, < 3)
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
addressable (2.7.0)
|
|
12
|
+
public_suffix (>= 2.0.2, < 5.0)
|
|
13
|
+
appraisal (2.2.0)
|
|
14
|
+
bundler
|
|
15
|
+
rake
|
|
16
|
+
thor (>= 0.14.0)
|
|
17
|
+
diff-lcs (1.3)
|
|
18
|
+
public_suffix (4.0.4)
|
|
19
|
+
rack (1.5.5)
|
|
20
|
+
rake (13.0.1)
|
|
21
|
+
rspec (3.9.0)
|
|
22
|
+
rspec-core (~> 3.9.0)
|
|
23
|
+
rspec-expectations (~> 3.9.0)
|
|
24
|
+
rspec-mocks (~> 3.9.0)
|
|
25
|
+
rspec-core (3.9.1)
|
|
26
|
+
rspec-support (~> 3.9.1)
|
|
27
|
+
rspec-expectations (3.9.1)
|
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
29
|
+
rspec-support (~> 3.9.0)
|
|
30
|
+
rspec-mocks (3.9.1)
|
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
32
|
+
rspec-support (~> 3.9.0)
|
|
33
|
+
rspec-support (3.9.2)
|
|
34
|
+
thor (1.0.1)
|
|
35
|
+
|
|
36
|
+
PLATFORMS
|
|
37
|
+
ruby
|
|
38
|
+
|
|
39
|
+
DEPENDENCIES
|
|
40
|
+
appraisal (~> 2.2)
|
|
41
|
+
rack (~> 1.5.0)
|
|
42
|
+
rack-canonical-host!
|
|
43
|
+
rake
|
|
44
|
+
rspec (~> 3.0)
|
|
45
|
+
|
|
46
|
+
BUNDLED WITH
|
|
47
|
+
1.17.2
|
data/gemfiles/rack_1.6.gemfile
CHANGED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: ..
|
|
3
|
+
specs:
|
|
4
|
+
rack-canonical-host (1.0.0)
|
|
5
|
+
addressable (> 0, < 3)
|
|
6
|
+
rack (>= 1.0.0, < 3)
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
addressable (2.7.0)
|
|
12
|
+
public_suffix (>= 2.0.2, < 5.0)
|
|
13
|
+
appraisal (2.2.0)
|
|
14
|
+
bundler
|
|
15
|
+
rake
|
|
16
|
+
thor (>= 0.14.0)
|
|
17
|
+
diff-lcs (1.3)
|
|
18
|
+
public_suffix (4.0.4)
|
|
19
|
+
rack (1.6.13)
|
|
20
|
+
rake (13.0.1)
|
|
21
|
+
rspec (3.9.0)
|
|
22
|
+
rspec-core (~> 3.9.0)
|
|
23
|
+
rspec-expectations (~> 3.9.0)
|
|
24
|
+
rspec-mocks (~> 3.9.0)
|
|
25
|
+
rspec-core (3.9.1)
|
|
26
|
+
rspec-support (~> 3.9.1)
|
|
27
|
+
rspec-expectations (3.9.1)
|
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
29
|
+
rspec-support (~> 3.9.0)
|
|
30
|
+
rspec-mocks (3.9.1)
|
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
32
|
+
rspec-support (~> 3.9.0)
|
|
33
|
+
rspec-support (3.9.2)
|
|
34
|
+
thor (1.0.1)
|
|
35
|
+
|
|
36
|
+
PLATFORMS
|
|
37
|
+
ruby
|
|
38
|
+
|
|
39
|
+
DEPENDENCIES
|
|
40
|
+
appraisal (~> 2.2)
|
|
41
|
+
rack (~> 1.6.0)
|
|
42
|
+
rack-canonical-host!
|
|
43
|
+
rake
|
|
44
|
+
rspec (~> 3.0)
|
|
45
|
+
|
|
46
|
+
BUNDLED WITH
|
|
47
|
+
1.17.2
|
data/gemfiles/rack_2.0.gemfile
CHANGED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: ..
|
|
3
|
+
specs:
|
|
4
|
+
rack-canonical-host (1.0.0)
|
|
5
|
+
addressable (> 0, < 3)
|
|
6
|
+
rack (>= 1.0.0, < 3)
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
addressable (2.7.0)
|
|
12
|
+
public_suffix (>= 2.0.2, < 5.0)
|
|
13
|
+
appraisal (2.2.0)
|
|
14
|
+
bundler
|
|
15
|
+
rake
|
|
16
|
+
thor (>= 0.14.0)
|
|
17
|
+
diff-lcs (1.3)
|
|
18
|
+
public_suffix (4.0.4)
|
|
19
|
+
rack (2.0.9)
|
|
20
|
+
rake (13.0.1)
|
|
21
|
+
rspec (3.9.0)
|
|
22
|
+
rspec-core (~> 3.9.0)
|
|
23
|
+
rspec-expectations (~> 3.9.0)
|
|
24
|
+
rspec-mocks (~> 3.9.0)
|
|
25
|
+
rspec-core (3.9.1)
|
|
26
|
+
rspec-support (~> 3.9.1)
|
|
27
|
+
rspec-expectations (3.9.1)
|
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
29
|
+
rspec-support (~> 3.9.0)
|
|
30
|
+
rspec-mocks (3.9.1)
|
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
32
|
+
rspec-support (~> 3.9.0)
|
|
33
|
+
rspec-support (3.9.2)
|
|
34
|
+
thor (1.0.1)
|
|
35
|
+
|
|
36
|
+
PLATFORMS
|
|
37
|
+
ruby
|
|
38
|
+
|
|
39
|
+
DEPENDENCIES
|
|
40
|
+
appraisal (~> 2.2)
|
|
41
|
+
rack (~> 2.0.0)
|
|
42
|
+
rack-canonical-host!
|
|
43
|
+
rake
|
|
44
|
+
rspec (~> 3.0)
|
|
45
|
+
|
|
46
|
+
BUNDLED WITH
|
|
47
|
+
1.17.2
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: ..
|
|
3
|
+
specs:
|
|
4
|
+
rack-canonical-host (1.0.0)
|
|
5
|
+
addressable (> 0, < 3)
|
|
6
|
+
rack (>= 1.0.0, < 3)
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
addressable (2.7.0)
|
|
12
|
+
public_suffix (>= 2.0.2, < 5.0)
|
|
13
|
+
appraisal (2.2.0)
|
|
14
|
+
bundler
|
|
15
|
+
rake
|
|
16
|
+
thor (>= 0.14.0)
|
|
17
|
+
diff-lcs (1.3)
|
|
18
|
+
public_suffix (4.0.4)
|
|
19
|
+
rack (2.1.2)
|
|
20
|
+
rake (13.0.1)
|
|
21
|
+
rspec (3.9.0)
|
|
22
|
+
rspec-core (~> 3.9.0)
|
|
23
|
+
rspec-expectations (~> 3.9.0)
|
|
24
|
+
rspec-mocks (~> 3.9.0)
|
|
25
|
+
rspec-core (3.9.1)
|
|
26
|
+
rspec-support (~> 3.9.1)
|
|
27
|
+
rspec-expectations (3.9.1)
|
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
29
|
+
rspec-support (~> 3.9.0)
|
|
30
|
+
rspec-mocks (3.9.1)
|
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
32
|
+
rspec-support (~> 3.9.0)
|
|
33
|
+
rspec-support (3.9.2)
|
|
34
|
+
thor (1.0.1)
|
|
35
|
+
|
|
36
|
+
PLATFORMS
|
|
37
|
+
ruby
|
|
38
|
+
|
|
39
|
+
DEPENDENCIES
|
|
40
|
+
appraisal (~> 2.2)
|
|
41
|
+
rack (~> 2.1.0)
|
|
42
|
+
rack-canonical-host!
|
|
43
|
+
rake
|
|
44
|
+
rspec (~> 3.0)
|
|
45
|
+
|
|
46
|
+
BUNDLED WITH
|
|
47
|
+
1.17.2
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: ..
|
|
3
|
+
specs:
|
|
4
|
+
rack-canonical-host (1.0.0)
|
|
5
|
+
addressable (> 0, < 3)
|
|
6
|
+
rack (>= 1.0.0, < 3)
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
addressable (2.7.0)
|
|
12
|
+
public_suffix (>= 2.0.2, < 5.0)
|
|
13
|
+
appraisal (2.2.0)
|
|
14
|
+
bundler
|
|
15
|
+
rake
|
|
16
|
+
thor (>= 0.14.0)
|
|
17
|
+
diff-lcs (1.3)
|
|
18
|
+
public_suffix (4.0.4)
|
|
19
|
+
rack (2.2.2)
|
|
20
|
+
rake (13.0.1)
|
|
21
|
+
rspec (3.9.0)
|
|
22
|
+
rspec-core (~> 3.9.0)
|
|
23
|
+
rspec-expectations (~> 3.9.0)
|
|
24
|
+
rspec-mocks (~> 3.9.0)
|
|
25
|
+
rspec-core (3.9.1)
|
|
26
|
+
rspec-support (~> 3.9.1)
|
|
27
|
+
rspec-expectations (3.9.1)
|
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
29
|
+
rspec-support (~> 3.9.0)
|
|
30
|
+
rspec-mocks (3.9.1)
|
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
32
|
+
rspec-support (~> 3.9.0)
|
|
33
|
+
rspec-support (3.9.2)
|
|
34
|
+
thor (1.0.1)
|
|
35
|
+
|
|
36
|
+
PLATFORMS
|
|
37
|
+
ruby
|
|
38
|
+
|
|
39
|
+
DEPENDENCIES
|
|
40
|
+
appraisal (~> 2.2)
|
|
41
|
+
rack (~> 2.2.0)
|
|
42
|
+
rack-canonical-host!
|
|
43
|
+
rake
|
|
44
|
+
rspec (~> 3.0)
|
|
45
|
+
|
|
46
|
+
BUNDLED WITH
|
|
47
|
+
1.17.2
|
|
@@ -42,8 +42,14 @@ module Rack
|
|
|
42
42
|
|
|
43
43
|
private
|
|
44
44
|
|
|
45
|
-
def any_match?(patterns,
|
|
46
|
-
patterns.any? { |pattern|
|
|
45
|
+
def any_match?(patterns, host)
|
|
46
|
+
patterns.any? { |pattern|
|
|
47
|
+
case pattern
|
|
48
|
+
when Regexp then host =~ pattern
|
|
49
|
+
when String then host == pattern
|
|
50
|
+
else false
|
|
51
|
+
end
|
|
52
|
+
}
|
|
47
53
|
end
|
|
48
54
|
|
|
49
55
|
def headers
|
|
@@ -57,15 +63,13 @@ module Rack
|
|
|
57
63
|
def enabled?
|
|
58
64
|
return true if conditions.empty?
|
|
59
65
|
|
|
60
|
-
|
|
61
|
-
any_match?(conditions, request_uri.host)
|
|
66
|
+
any_match?(conditions, request_uri.host)
|
|
62
67
|
end
|
|
63
68
|
|
|
64
69
|
def ignored?
|
|
65
70
|
return false if ignore.empty?
|
|
66
71
|
|
|
67
|
-
|
|
68
|
-
any_match?(ignore, request_uri.host)
|
|
72
|
+
any_match?(ignore, request_uri.host)
|
|
69
73
|
end
|
|
70
74
|
|
|
71
75
|
def known?
|
|
@@ -110,71 +110,75 @@ RSpec.describe Rack::CanonicalHost do
|
|
|
110
110
|
include_context 'a matching request'
|
|
111
111
|
end
|
|
112
112
|
|
|
113
|
-
context 'with :ignore
|
|
114
|
-
|
|
113
|
+
context 'with :ignore option' do
|
|
114
|
+
context 'with string' do
|
|
115
|
+
let(:app) { build_app('example.com', :ignore => 'example.net') }
|
|
115
116
|
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
include_context 'a matching request'
|
|
118
|
+
include_context 'a non-matching request'
|
|
118
119
|
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
context 'with a request to an ignored host' do
|
|
121
|
+
let(:url) { 'http://example.net/full/path' }
|
|
121
122
|
|
|
122
|
-
|
|
123
|
+
it { should_not be_redirect }
|
|
123
124
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
it 'calls the inner app' do
|
|
126
|
+
expect(inner_app).to receive(:call).with(env)
|
|
127
|
+
call_app
|
|
128
|
+
end
|
|
127
129
|
end
|
|
128
130
|
end
|
|
129
|
-
end
|
|
130
131
|
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
context 'with regular expression' do
|
|
133
|
+
let(:app) { build_app('example.com', :ignore => /ex.*\.net/) }
|
|
133
134
|
|
|
134
|
-
|
|
135
|
-
|
|
135
|
+
include_context 'a matching request'
|
|
136
|
+
include_context 'a non-matching request'
|
|
136
137
|
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
context 'with a request to an ignored host' do
|
|
139
|
+
let(:url) { 'http://example.net/full/path' }
|
|
139
140
|
|
|
140
|
-
|
|
141
|
+
it { should_not be_redirect }
|
|
141
142
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
it 'calls the inner app' do
|
|
144
|
+
expect(inner_app).to receive(:call).with(env)
|
|
145
|
+
call_app
|
|
146
|
+
end
|
|
145
147
|
end
|
|
146
148
|
end
|
|
147
149
|
end
|
|
148
150
|
|
|
149
151
|
context 'with :if option' do
|
|
150
|
-
|
|
152
|
+
context 'with string' do
|
|
153
|
+
let(:app) { build_app('www.example.com', :if => 'example.com') }
|
|
151
154
|
|
|
152
|
-
|
|
153
|
-
|
|
155
|
+
context 'with a request to a matching host' do
|
|
156
|
+
let(:url) { 'http://example.com/full/path' }
|
|
154
157
|
|
|
155
|
-
|
|
156
|
-
|
|
158
|
+
it { should redirect_to('http://www.example.com/full/path') }
|
|
159
|
+
end
|
|
157
160
|
|
|
158
|
-
|
|
159
|
-
|
|
161
|
+
context 'with a request to a non-matching host' do
|
|
162
|
+
let(:url) { 'http://api.example.com/full/path' }
|
|
160
163
|
|
|
161
|
-
|
|
164
|
+
it { should_not be_redirect }
|
|
165
|
+
end
|
|
162
166
|
end
|
|
163
|
-
end
|
|
164
167
|
|
|
165
|
-
|
|
166
|
-
|
|
168
|
+
context 'with a regular expression' do
|
|
169
|
+
let(:app) { build_app('example.com', :if => '.*\.example\.com') }
|
|
167
170
|
|
|
168
|
-
|
|
169
|
-
|
|
171
|
+
context 'with a request to a matching host' do
|
|
172
|
+
let(:url) { 'http://www.example.com/full/path' }
|
|
170
173
|
|
|
171
|
-
|
|
172
|
-
|
|
174
|
+
it { should_not redirect_to('http://example.com/full/path') }
|
|
175
|
+
end
|
|
173
176
|
|
|
174
|
-
|
|
175
|
-
|
|
177
|
+
context 'with a request to a non-matching host' do
|
|
178
|
+
let(:url) { 'http://www.example.net/full/path' }
|
|
176
179
|
|
|
177
|
-
|
|
180
|
+
it { should_not be_redirect }
|
|
181
|
+
end
|
|
178
182
|
end
|
|
179
183
|
end
|
|
180
184
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rack-canonical-host
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tyler Hunt
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2020-04-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|
|
@@ -108,8 +108,15 @@ files:
|
|
|
108
108
|
- README.md
|
|
109
109
|
- Rakefile
|
|
110
110
|
- gemfiles/rack_1.5.gemfile
|
|
111
|
+
- gemfiles/rack_1.5.gemfile.lock
|
|
111
112
|
- gemfiles/rack_1.6.gemfile
|
|
113
|
+
- gemfiles/rack_1.6.gemfile.lock
|
|
112
114
|
- gemfiles/rack_2.0.gemfile
|
|
115
|
+
- gemfiles/rack_2.0.gemfile.lock
|
|
116
|
+
- gemfiles/rack_2.1.gemfile
|
|
117
|
+
- gemfiles/rack_2.1.gemfile.lock
|
|
118
|
+
- gemfiles/rack_2.2.gemfile
|
|
119
|
+
- gemfiles/rack_2.2.gemfile.lock
|
|
113
120
|
- lib/rack-canonical-host.rb
|
|
114
121
|
- lib/rack/canonical_host.rb
|
|
115
122
|
- lib/rack/canonical_host/redirect.rb
|
|
@@ -137,8 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
137
144
|
- !ruby/object:Gem::Version
|
|
138
145
|
version: '0'
|
|
139
146
|
requirements: []
|
|
140
|
-
|
|
141
|
-
rubygems_version: 2.6.8
|
|
147
|
+
rubygems_version: 3.0.3
|
|
142
148
|
signing_key:
|
|
143
149
|
specification_version: 4
|
|
144
150
|
summary: Rack middleware for defining a canonical host name.
|