http_router 0.8.4 → 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/http_router.rb +10 -0
- data/lib/http_router/node/destination.rb +1 -6
- data/lib/http_router/version.rb +1 -1
- metadata +3 -3
data/lib/http_router.rb
CHANGED
@@ -179,6 +179,16 @@ class HttpRouter
|
|
179
179
|
@redirect_trailing_slash
|
180
180
|
end
|
181
181
|
|
182
|
+
def rewrite_partial_path_info(env, request)
|
183
|
+
env['PATH_INFO'] = "/#{request.path.join('/')}"
|
184
|
+
env['SCRIPT_NAME'] += request.rack_request.path_info[0, request.rack_request.path_info.size - env['PATH_INFO'].size]
|
185
|
+
end
|
186
|
+
|
187
|
+
def rewrite_path_info(env, request)
|
188
|
+
env['SCRIPT_NAME'] += request.rack_request.path_info
|
189
|
+
env['PATH_INFO'] = ''
|
190
|
+
end
|
191
|
+
|
182
192
|
# Creates a deep-copy of the router.
|
183
193
|
def clone(klass = self.class)
|
184
194
|
cloned_router = klass.new(@options)
|
@@ -24,12 +24,7 @@ class HttpRouter
|
|
24
24
|
env['router.request'] = request
|
25
25
|
env['router.params'] ||= {}
|
26
26
|
#{"env['router.params'].merge!(Hash[#{path.param_names.inspect}.zip(request.params)])" if path.dynamic?}
|
27
|
-
#{@allow_partial ? "
|
28
|
-
env['PATH_INFO'] = \"/\#{request.path.join('/')}\"
|
29
|
-
env['SCRIPT_NAME'] += request.rack_request.path_info[0, request.rack_request.path_info.size - env['PATH_INFO'].size]" :
|
30
|
-
"env['PATH_INFO'] = ''
|
31
|
-
env['SCRIPT_NAME'] += request.rack_request.path_info"
|
32
|
-
}
|
27
|
+
#{@allow_partial ? "router.rewrite_partial_path_info(env, request)" : "router.rewrite_path_info(env, request)" }
|
33
28
|
response = @router.process_destination_path(#{path_ivar}, env)
|
34
29
|
router.pass_on_response(response) ? throw(:pass) : throw(:success, response)
|
35
30
|
else
|
data/lib/http_router/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http_router
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 53
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 8
|
9
|
-
-
|
10
|
-
version: 0.8.
|
9
|
+
- 5
|
10
|
+
version: 0.8.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Joshua Hull
|