rack-host-redirect 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rack/host_redirect.rb +7 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c91524d1eaed816a11f75709f9213524b737fa6f
|
4
|
+
data.tar.gz: f9f035700622a5003f4edeffa4363653b982369e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71e278aae12ef9d2c001b39d3ea74b4a183ed5d27f95a9ef49ccdd29cd7e8d3ea0f718dee9a2de827a96d68af4f81be1246f51053686d2f3a930f467431a3778
|
7
|
+
data.tar.gz: ebb913e93360a85218665044e898384eb1fa5355c0e4274bb4ce647af8068d02245f265090c4fff3d3a7d6f221f91b1c4b7cb38e67a7a496b3036ebfa97a7aa5
|
data/lib/rack/host_redirect.rb
CHANGED
@@ -15,8 +15,9 @@ class Rack::HostRedirect
|
|
15
15
|
|
16
16
|
updated_host = (@host_mapping && @host_mapping[host]) || (@block && @block.call(host, env))
|
17
17
|
|
18
|
-
if updated_host
|
19
|
-
|
18
|
+
if updated_host && updated_host.downcase != host
|
19
|
+
location = replace_host(request.url, updated_host)
|
20
|
+
[301, {'Location' => location}, []]
|
20
21
|
else
|
21
22
|
@app.call(env)
|
22
23
|
end
|
@@ -28,9 +29,9 @@ class Rack::HostRedirect
|
|
28
29
|
hsh.inject({}) {|out, (k, v)| out[k.downcase] = v; out }
|
29
30
|
end
|
30
31
|
|
31
|
-
def
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
def replace_host url, host
|
33
|
+
url = URI.parse(url)
|
34
|
+
url.host = host
|
35
|
+
url.to_s
|
35
36
|
end
|
36
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-host-redirect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geoff Buesing
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
11
|
+
date: 2013-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -66,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
66
|
version: '0'
|
67
67
|
requirements: []
|
68
68
|
rubyforge_project:
|
69
|
-
rubygems_version: 2.0.
|
69
|
+
rubygems_version: 2.0.2
|
70
70
|
signing_key:
|
71
71
|
specification_version: 4
|
72
72
|
summary: Lean and simple host redirection via Rack middleware
|