incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject svn commit: r1099763 - /incubator/deltacloud/trunk/server/lib/sinatra/rack_matrix_params.rb
Date Thu, 05 May 2011 11:57:14 GMT
Author: mfojtik
Date: Thu May  5 11:57:14 2011
New Revision: 1099763

URL: http://svn.apache.org/viewvc?rev=1099763&view=rev
Log:
Fix for Webrick incorrectly handling matrix params (DTACLOUD-34)

Modified:
    incubator/deltacloud/trunk/server/lib/sinatra/rack_matrix_params.rb

Modified: incubator/deltacloud/trunk/server/lib/sinatra/rack_matrix_params.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/sinatra/rack_matrix_params.rb?rev=1099763&r1=1099762&r2=1099763&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/sinatra/rack_matrix_params.rb (original)
+++ incubator/deltacloud/trunk/server/lib/sinatra/rack_matrix_params.rb Thu May  5 11:57:14
2011
@@ -40,6 +40,7 @@ module Rack
     def call(env)
       # Copy PATH_INFO to REQUEST_URI if Rack::Test
       env['REQUEST_URI'] = env['PATH_INFO'] if env['rack.test']
+      env['REQUEST_PATH'] = env['PATH_INFO'] if env['rack.test']
 
       # Split URI to components and then extract ;var=value pairs
       uri_components = env['REQUEST_URI'].split('/')
@@ -66,8 +67,12 @@ module Rack
 
       # For other methods it's a way complicated ;-)
       if env['REQUEST_METHOD']!='POST' and not matrix_params.keys.empty?
+        if env['REQUEST_PATH'] == '/'
+          env['REQUEST_URI'] = env['REQUEST_PATH']
+          env['REQUEST_PATH'] = env['PATH_INFO']
+        end
 	# Rewrite current path and query string and strip all matrix params from it
-	env['REQUEST_PATH'], env['PATH_INFO'] = env['REQUEST_URI'].gsub(/;([^\/]*)/, '').gsub(/\?(.*)$/,
'')
+        env['REQUEST_PATH'] = env['REQUEST_PATH'].gsub(/;([^\/]*)/, '').gsub(/\?(.*)$/, '')
 	env['PATH_INFO'] = env['REQUEST_PATH']
 	env['QUERY_STRING'].gsub!(/;([^\/]*)/, '')
 	new_params = matrix_params.collect do |component, params|



Mime
View raw message