rails_reroute 0.2.6 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/default_variables.rb +35 -0
- data/lib/rails_reroute.rb +13 -14
- data/rails_reroute.gemspec +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1a983a05c0141e0ef9174adb8b2d5dcd1085cc8
|
4
|
+
data.tar.gz: 4e81869f7a4a049fe86d7d4ce5c33c8a5261094c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b5a8f8648a9b6d7fd0b42c54bc6c86596002dd0e2031b5b514a02586d2184277a9737367b5e792882ac64d689eef0f4906f39460949f91761251fb29566595e
|
7
|
+
data.tar.gz: 293752610774d2c94108d4eafc15cfec3092bc8af8a9ab4a04212e46da80761c36225c1205d08c1017cbcb88b5679ac712c280b4735f9a5d0e4727ec1bcc44fa
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module RailsReroute
|
2
|
+
DEFAULT_VARIABLES = Set.new(%W[
|
3
|
+
CONTENT_TYPE
|
4
|
+
CONTENT_LENGTH
|
5
|
+
HTTPS
|
6
|
+
AUTH_TYPE
|
7
|
+
HTTP_COOKIE
|
8
|
+
GATEWAY_INTERFACE
|
9
|
+
PATH_INFO
|
10
|
+
PATH_TRANSLATED
|
11
|
+
QUERY_STRING
|
12
|
+
REMOTE_ADDR
|
13
|
+
REMOTE_HOST
|
14
|
+
REMOTE_IDENT
|
15
|
+
REMOTE_USER
|
16
|
+
REQUEST_METHOD
|
17
|
+
SCRIPT_NAME
|
18
|
+
SERVER_NAME
|
19
|
+
SERVER_PORT
|
20
|
+
SERVER_PROTOCOL
|
21
|
+
SERVER_SOFTWARE
|
22
|
+
HTTP_TE
|
23
|
+
HTTP_CONNECTION
|
24
|
+
HTTP_ACCEPT_ENCODING
|
25
|
+
HTTP_AKAMAI_ORIGIN_HOP
|
26
|
+
HTTP_VIA
|
27
|
+
HTTP_X_AKAMAI_EDGESCAPE
|
28
|
+
HTTP_X_FORWARDED_FOR
|
29
|
+
HTTP_TRUE_CLIENT_IP
|
30
|
+
HTTP_HOST
|
31
|
+
HTTP_CACHE_CONTROL
|
32
|
+
HTTP_REFERER
|
33
|
+
HTTP_USER_AGENT
|
34
|
+
]).freeze
|
35
|
+
end
|
data/lib/rails_reroute.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'default_variables'
|
2
|
+
|
1
3
|
module RailsReroute
|
2
4
|
class Railtie < Rails::Railtie
|
3
5
|
initializer "rails_reroute.initializer" do
|
@@ -10,21 +12,18 @@ module RailsReroute
|
|
10
12
|
@_response_body = @_response.body
|
11
13
|
end
|
12
14
|
|
13
|
-
def reroute_default_variables
|
14
|
-
%w( CONTENT_TYPE CONTENT_LENGTH
|
15
|
-
HTTPS AUTH_TYPE HTTP_COOKIE GATEWAY_INTERFACE
|
16
|
-
PATH_INFO PATH_TRANSLATED QUERY_STRING
|
17
|
-
REMOTE_ADDR REMOTE_HOST REMOTE_IDENT REMOTE_USER
|
18
|
-
REQUEST_METHOD SCRIPT_NAME
|
19
|
-
SERVER_NAME SERVER_PORT SERVER_PROTOCOL SERVER_SOFTWARE
|
20
|
-
HTTP_TE HTTP_CONNECTION HTTP_ACCEPT_ENCODING HTTP_AKAMAI_ORIGIN_HOP HTTP_VIA HTTP_X_AKAMAI_EDGESCAPE
|
21
|
-
HTTP_X_FORWARDED_FOR HTTP_TRUE_CLIENT_IP HTTP_HOST HTTP_CACHE_CONTROL HTTP_REFERER HTTP_USER_AGENT )
|
22
|
-
end
|
23
|
-
|
24
15
|
def reroute_new_env new_route
|
25
|
-
new_paths = {
|
26
|
-
|
27
|
-
|
16
|
+
new_paths = {
|
17
|
+
"PATH_INFO" => "#{new_route}",
|
18
|
+
"REQUEST_URI"=>"#{env["rack.url_scheme"]}://#{env["HTTP_HOST"]}#{new_route}",
|
19
|
+
"REQUEST_PATH"=>"#{new_route}",
|
20
|
+
"ORIGINAL_REQUEST_URI" => env["REQUEST_URI"]
|
21
|
+
}
|
22
|
+
|
23
|
+
env.select! do |key, value|
|
24
|
+
DEFAULT_VARIABLES.include?(key) || key.include?("rack")
|
25
|
+
end
|
26
|
+
|
28
27
|
env.merge! new_paths
|
29
28
|
end
|
30
29
|
|
data/rails_reroute.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_reroute
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathaniel Barnes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Reroute rails requests fully
|
14
14
|
email:
|
@@ -17,11 +17,12 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
-
-
|
20
|
+
- .gitignore
|
21
21
|
- Gemfile
|
22
22
|
- LICENSE
|
23
23
|
- README.md
|
24
24
|
- Rakefile
|
25
|
+
- lib/default_variables.rb
|
25
26
|
- lib/rails_reroute.rb
|
26
27
|
- rails_reroute.gemspec
|
27
28
|
homepage: http://github.com/NateBarnes/rails_reroute
|
@@ -33,17 +34,17 @@ require_paths:
|
|
33
34
|
- lib
|
34
35
|
required_ruby_version: !ruby/object:Gem::Requirement
|
35
36
|
requirements:
|
36
|
-
- -
|
37
|
+
- - '>='
|
37
38
|
- !ruby/object:Gem::Version
|
38
39
|
version: '0'
|
39
40
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
40
41
|
requirements:
|
41
|
-
- -
|
42
|
+
- - '>='
|
42
43
|
- !ruby/object:Gem::Version
|
43
44
|
version: '0'
|
44
45
|
requirements: []
|
45
46
|
rubyforge_project: rails_reroute
|
46
|
-
rubygems_version: 2.
|
47
|
+
rubygems_version: 2.4.5
|
47
48
|
signing_key:
|
48
49
|
specification_version: 4
|
49
50
|
summary: Reroute rails requests fully
|