rack-www 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 67bab3314c14a6baf165bf7697f2640e290cd9f9
4
- data.tar.gz: 39c53a98db554ad2a7d178d9c62aa0fdac9b5deb
3
+ metadata.gz: da7f0cfe7b164575cae38adb196629c11f18f6a7
4
+ data.tar.gz: e7d06b79e38106649e038ef948ebe504927072de
5
5
  SHA512:
6
- metadata.gz: 8b3c507ada98ad3a4489c21a791b660257cb67db00ade55983ca8fecb2d5e35c77042736ad8295e257a75790558d8b14c17d874e8dc2c09e4689431302d3c307
7
- data.tar.gz: 429293155e765b0fda94c704577b80f00a990715fb3a50be42a68c444d65f563006b2e8695d45761386a9cf8b0e23a77b6f1cb5d0ffe2695be51c202b00e9402
6
+ metadata.gz: f9aee65608b0332c10002c0302bba3888878154829f3c54325879a0658d23ea5d95786ce9e3fd9a6d1012c7752cd52c375bf87b2d8414c135b3ee512ade5857a
7
+ data.tar.gz: e67fe65e9ec3c270b0ebddf5081762e0c3599e392ff47d42ab033c1f0365224d15afadbb693aff827e099644547835f32b3f4f5515cd7e689434d19e3ca4773f
data/.gitignore CHANGED
@@ -1,2 +1,35 @@
1
1
  *.gem
2
2
  *.rbc
3
+ .DS_Store
4
+ *.gem
5
+ *.rbc
6
+ /.config
7
+ /coverage/
8
+ /InstalledFiles
9
+ /pkg/
10
+ /spec/reports/
11
+ /test/tmp/
12
+ /test/version_tmp/
13
+ /tmp/
14
+ /log/
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+
21
+ ## Documentation cache and generated files:
22
+ /.yardoc/
23
+ /_yardoc/
24
+ /doc/
25
+ /rdoc/
26
+
27
+ ## Environment normalisation:
28
+ /.bundle/
29
+ /lib/bundler/man/
30
+
31
+ ## Vagrant files
32
+ /vagrant/.vagrant/
33
+
34
+ /lib/stokstad/config/mongoid.yml
35
+ Gemfile.lock
@@ -1,38 +1,54 @@
1
- ## 2.1
1
+ Changelog
2
+ =========
2
3
 
3
- - Ignore rack-www when request host is an IP address
4
+ Version 2.2.0 (August 11, 2016)
5
+ -----------------------------
4
6
 
5
- ## 2.0
7
+ * Do not append port for SSL redirect
6
8
 
7
- - Update EVERYTHING
9
+ Version 2.1.0
10
+ -----------------------------
8
11
 
9
- ## 1.5
12
+ * Ignore rack-www when request host is an IP address
10
13
 
11
- - Bug fixes
14
+ Version 2.0.0
15
+ -----------------------------
12
16
 
13
- ## 1.4
17
+ * Update EVERYTHING
14
18
 
15
- - Respect server port
16
- - Body responds to :each
17
- - Rack::Lint on tests
19
+ Version 1.5
20
+ -----------------------------
18
21
 
19
- ## 1.3
22
+ * Bug fixes
20
23
 
21
- - Added possibility to redirects to any given :subdomain [Ryan Weald (https://github.com/rweald)]
22
- - Added more tests
24
+ Version 1.4
25
+ -----------------------------
23
26
 
24
- ## 1.2
27
+ * Respect server port
28
+ * Body responds to :each
29
+ * Rack::Lint on tests
25
30
 
26
- - Redirects to the right url without calling the app
27
- - Keep the path when redirecting
28
- - Keep the query string when redirecting
29
- - Added more tests
31
+ Version 1.3
32
+ -----------------------------
30
33
 
31
- ## 1.1
34
+ * Added possibility to redirect to any given :subdomain [Ryan Weald (https://github.com/rweald)]
35
+ * Added more tests
32
36
 
33
- - Added possibility to redirects with www or without www
34
- - Added possibility to set a param :message to show while redirecting
37
+ Version 1.2
38
+ -----------------------------
35
39
 
36
- ## 1.0
40
+ * Redirects to the right url without calling the app
41
+ * Keep the path when redirecting
42
+ * Keep the query string when redirecting
43
+ * Added more tests
37
44
 
38
- - Redirects all traffic to www
45
+ Version 1.1
46
+ -----------------------------
47
+
48
+ * Added possibility to redirects with www or without www
49
+ * Added possibility to set a param :message to show while redirecting
50
+
51
+ Version 1.0
52
+ -----------------------------
53
+
54
+ * Redirects all traffic to www
data/Guardfile CHANGED
@@ -1,8 +1,5 @@
1
1
  guard :minitest do
2
- # with Minitest::Unit
3
- watch(%r{^test/(.*)\/?test_(.*)\.rb$})
4
- watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
5
- watch(%r{^test/test_helper\.rb$}) { 'test' }
2
+ watch(%r{^(.*)\/?.rb$}) { 'test' }
6
3
  end
7
4
 
8
5
  guard :rubocop do
data/README.md CHANGED
@@ -53,6 +53,8 @@ You can optionally specify predicate to determine if redirect should take place:
53
53
  }
54
54
  ```
55
55
 
56
+ It ignores any redirects when using IP addresses.
57
+
56
58
  ### Options
57
59
 
58
60
  - :www => default is true, redirects all traffic to www;
@@ -81,7 +81,7 @@ module Rack
81
81
 
82
82
  def extract_host(env)
83
83
  [env['SERVER_NAME'].to_s.gsub(/^(#{@subdomain}\.|www\.)/, ''),
84
- env['SERVER_PORT'] == '80' ? '' : ":#{env['SERVER_PORT']}",
84
+ %w(80 443).include?(env['SERVER_PORT']) ? '' : ":#{env['SERVER_PORT']}",
85
85
  env['PATH_INFO'],
86
86
  env['QUERY_STRING'].empty? ? '' : '?' + env['QUERY_STRING'].to_s]
87
87
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'rack-www'
3
- s.version = '2.1.0'
3
+ s.version = '2.2.0'
4
4
  s.date = '2015-12-02'
5
5
  s.homepage = 'https://github.com/stjhimy/rack-www'
6
6
  s.email = 'stjhimy@gmail.com'
@@ -48,6 +48,13 @@ class SubdomainTest < TestClass
48
48
  assert_equal last_response.body, ''
49
49
  end
50
50
 
51
+ def test_multiple_subdomains
52
+ self.app = Rack::WWW.new(default_app, subdomain: 'foo.bar')
53
+ get 'http://example.com/'
54
+ assert_equal 'http://foo.bar.example.com/',
55
+ last_response.headers['Location']
56
+ end
57
+
51
58
  def test_ignore_www_when_ip_request
52
59
  get 'http://111.111.111.111/'
53
60
  assert_equal last_response.status, 200
@@ -11,6 +11,12 @@ class FalseWWW < TestClass
11
11
  last_response.headers['Location']
12
12
  end
13
13
 
14
+ def test_www_false_with_ssl
15
+ get 'https://www.example.com/'
16
+ assert_equal 'https://example.com/',
17
+ last_response.headers['Location']
18
+ end
19
+
14
20
  def test_www_false_with_path
15
21
  get 'http://www.example.com/path/1'
16
22
  assert_equal 'http://example.com/path/1',
@@ -25,6 +25,11 @@ class TrueWWW < TestClass
25
25
  assert_equal 'http://www.example.com/', last_response.headers['Location']
26
26
  end
27
27
 
28
+ def test_www_true_with_ssl
29
+ get 'https://example.com/'
30
+ assert_equal 'https://www.example.com/', last_response.headers['Location']
31
+ end
32
+
28
33
  def test_www_true_with_path
29
34
  get 'http://example.com/path/1'
30
35
  assert_equal 'http://www.example.com/path/1',
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-www
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jhimy Fernandes Villar
@@ -119,7 +119,6 @@ files:
119
119
  - ".ruby-version"
120
120
  - CHANGELOG.md
121
121
  - Gemfile
122
- - Gemfile.lock
123
122
  - Guardfile
124
123
  - LICENSE
125
124
  - README.md
@@ -1,83 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- rack-www (2.1.0)
5
- rack (~> 1.0)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- ast (2.1.0)
11
- astrolabe (1.3.1)
12
- parser (~> 2.2)
13
- coderay (1.1.0)
14
- ffi (1.9.10)
15
- formatador (0.2.5)
16
- guard (2.13.0)
17
- formatador (>= 0.2.4)
18
- listen (>= 2.7, <= 4.0)
19
- lumberjack (~> 1.0)
20
- nenv (~> 0.1)
21
- notiffany (~> 0.0)
22
- pry (>= 0.9.12)
23
- shellany (~> 0.0)
24
- thor (>= 0.18.1)
25
- guard-compat (1.2.1)
26
- guard-minitest (2.4.4)
27
- guard-compat (~> 1.2)
28
- minitest (>= 3.0)
29
- guard-rubocop (1.2.0)
30
- guard (~> 2.0)
31
- rubocop (~> 0.20)
32
- listen (3.0.5)
33
- rb-fsevent (>= 0.9.3)
34
- rb-inotify (>= 0.9)
35
- lumberjack (1.0.9)
36
- method_source (0.8.2)
37
- minitest (5.8.3)
38
- nenv (0.2.0)
39
- notiffany (0.0.8)
40
- nenv (~> 0.1)
41
- shellany (~> 0.0)
42
- parser (2.2.3.0)
43
- ast (>= 1.1, < 3.0)
44
- powerpack (0.1.1)
45
- pry (0.10.3)
46
- coderay (~> 1.1.0)
47
- method_source (~> 0.8.1)
48
- slop (~> 3.4)
49
- rack (1.6.4)
50
- rack-test (0.6.3)
51
- rack (>= 1.0)
52
- rainbow (2.0.0)
53
- rake (10.4.2)
54
- rb-fsevent (0.9.6)
55
- rb-inotify (0.9.5)
56
- ffi (>= 0.5.0)
57
- rubocop (0.35.1)
58
- astrolabe (~> 1.3)
59
- parser (>= 2.2.3.0, < 3.0)
60
- powerpack (~> 0.1)
61
- rainbow (>= 1.99.1, < 3.0)
62
- ruby-progressbar (~> 1.7)
63
- tins (<= 1.6.0)
64
- ruby-progressbar (1.7.5)
65
- shellany (0.0.1)
66
- slop (3.6.0)
67
- thor (0.19.1)
68
- tins (1.6.0)
69
-
70
- PLATFORMS
71
- ruby
72
-
73
- DEPENDENCIES
74
- guard (~> 2.13)
75
- guard-minitest (~> 2.4)
76
- guard-rubocop (~> 1.2)
77
- minitest (~> 5.8)
78
- rack-test (~> 0.6)
79
- rack-www!
80
- rake (~> 10.4)
81
-
82
- BUNDLED WITH
83
- 1.10.6