Permalink
Browse files

restore rewrite_path_info and rewrite_partial_path_info to base class

  • Loading branch information...
joshbuddy committed Jul 28, 2011
1 parent 9e8536b commit 408fd91e34336de079c97edb1c25b7160219572b
Showing with 11 additions and 11 deletions.
  1. +10 −0 lib/http_router.rb
  2. +1 −1 lib/http_router/node/path.rb
  3. +0 −10 lib/http_router/node/root.rb
View
@@ -195,6 +195,16 @@ def clone(klass = self.class)
cloned_router
end
+ def rewrite_partial_path_info(env, request)
+ env['PATH_INFO'] = "/#{request.path.join('/')}"
+ env['SCRIPT_NAME'] += request.rack_request.path_info[0, request.rack_request.path_info.size - env['PATH_INFO'].size]
+ end
+
+ def rewrite_path_info(env, request)
+ env['SCRIPT_NAME'] += request.rack_request.path_info
+ env['PATH_INFO'] = ''
+ end
+
private
def no_response(env, perform_call = true)
supported_methods = @known_methods.select do |m|
@@ -38,7 +38,7 @@ def to_code
env['router.request'] = request
env['router.params'] ||= {}
#{"env['router.params'].merge!(Hash[#{param_names.inspect}.zip(request.params)])" if dynamic?}
- rewrite#{"_partial" if route.match_partially?}_path_info(env, request)
+ @router.rewrite#{"_partial" if route.match_partially?}_path_info(env, request)
response = @router.process_destination_path(#{path_ivar}, env)
router.pass_on_response(response) ? throw(:pass) : throw(:success, response)
else
@@ -29,16 +29,6 @@ def inject_root_ivar(obj)
end
private
- def rewrite_partial_path_info(env, request)
- env['PATH_INFO'] = "/#{request.path.join('/')}"
- env['SCRIPT_NAME'] += request.rack_request.path_info[0, request.rack_request.path_info.size - env['PATH_INFO'].size]
- end
-
- def rewrite_path_info(env, request)
- env['SCRIPT_NAME'] += request.rack_request.path_info
- env['PATH_INFO'] = ''
- end
-
def compile
root.extend(root.methods_module)
instance_eval "def [](request)\n#{to_code}\nnil\nend", __FILE__, __LINE__

0 comments on commit 408fd91

Please sign in to comment.