On Thu, 2012-09-06 at 14:20 +0200, [email protected] wrote:
> From: Michal Fojtik <[email protected]>
> 
> * Overiding PATH_INFO with REQUEST_URI cause incorrect
>   incorrect mapping of application.
> 
> Signed-off-by: Michal fojtik <[email protected]>
> ---
>  server/lib/deltacloud/core_ext/string.rb |    4 ++++
>  server/lib/sinatra/rack_matrix_params.rb |   20 +++++++++++++-------
>  2 files changed, 17 insertions(+), 7 deletions(-)

Actually, there's still a bit of logic in rack_matrix_params.rb that is
more complicated than it needs to be: can you add the attached patch to
your patch series ?

David

>From c2988411a8a661698b35945184c8f099e4d7a0b8 Mon Sep 17 00:00:00 2001
From: David Lutterkort <[email protected]>
Date: Thu, 6 Sep 2012 16:54:43 -0700
Subject: [PATCH] Core: simplify how we remove matrix params from the URL

---
 server/lib/sinatra/rack_matrix_params.rb |   12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/server/lib/sinatra/rack_matrix_params.rb b/server/lib/sinatra/rack_matrix_params.rb
index 8a489d3..50db4a0 100644
--- a/server/lib/sinatra/rack_matrix_params.rb
+++ b/server/lib/sinatra/rack_matrix_params.rb
@@ -79,15 +79,9 @@ module Rack
       #         does not trip over them
 
       # (1) Rewrite current path by stripping all matrix params from it
-      if env['REQUEST_PATH'] == '/'
-        env['REQUEST_URI'] = env['REQUEST_PATH']
-        env['REQUEST_PATH'] = env['PATH_INFO']
-      end
-
-      # This is needed for OpenShift deployment / Passenger
-      if env['REQUEST_PATH']
-        env['REQUEST_PATH'] = env['REQUEST_PATH'].remove_matrix_params
-        env['PATH_INFO'] = env['PATH_INFO'].remove_matrix_params
+      ['REQUEST_PATH', 'REQUEST_URI', 'PATH_INFO'].select { |k|
+        env[k] }.each do |k|
+        env[k] = env[k].remove_matrix_params
       end
 
       # (2) Append the matrix params to the 'normal' request params
-- 
1.7.7.6

Reply via email to