deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michal Fojtik <mfoj...@redhat.com>
Subject Re: [PATCH core 1/7] Core: Make MatrixParams not overide PATH_INFO
Date Tue, 11 Sep 2012 11:48:37 GMT

On Sep 11, 2012, at 12:22 PM, Michal Fojtik <mfojtik@redhat.com> wrote:

> 
> On Sep 10, 2012, at 9:13 PM, David Lutterkort <lutter@redhat.com> wrote:
> 
>> On Mon, 2012-09-10 at 11:35 +0200, mfojtik@redhat.com wrote:
>>> From: Michal Fojtik <mfojtik@redhat.com>
>>> 
>>> * Overiding PATH_INFO with REQUEST_URI cause incorrect
>>> incorrect mapping of application.
>>> 
>>> Signed-off-by: Michal fojtik <mfojtik@redhat.com>
>> 
>> Sadly, NAK, since I get a 'stack level too deep' error when I request a
>> non-existing machine via CIMI, for example
>> http://localhost:3001/cimi/machines/instX
>> 
>> The same issue also leads to a test failure in
>> tests/cimi/collections/machines_test.rb:38
>> 
>> This is all on F16 with Ruby 1.8.7
> 
> Oh sorry for that, I forgot to run 1.8.7 tests.
> I fixed that by this simple patch:
> 
> diff --git a/server/lib/sinatra/rack_accept.rb b/server/lib/sinatra/rack_accept.rb
> index 2ac42ce..eb7cdff 100644
> --- a/server/lib/sinatra/rack_accept.rb
> +++ b/server/lib/sinatra/rack_accept.rb
> @@ -50,7 +50,7 @@ module Rack
>       # This method is used to overide the default content_type returned from
>       # rack-accept middleware.
>       def self.included(klass)
> -        klass.class_eval do
> +        klass.instance_eval do
>           alias :content_type_without_save :content_type
>           def content_type(*args)
>             content_type_without_save(*args)
> 
> This fixed the issue on 1.8 and also 1.9 works. Also I don't think we are
> using this 'enhanced' content_type method somewhere. From what I see it
> just sets 'rack-accept.formats' in request.env which is then used nowhere...

OK forget it ;-) This caused failure for 1.9. I found that there is an
extra 'helpers Rack::RespondTo::Helpers' in CIMI server that causes this
bug. Seems like the aliased method is being protected from second aliasing
on Ruby 1.9, but on 1.8 there is no such protection....

Uploaded revision 4 of patch:

http://tracker-mfojtik.rhcloud.com/set/53

  -- Michal

> 
> I'll record new patch set to tracker, thanks!
> 
>  -- Michal
> 
> 
> Michal Fojtik
> http://deltacloud.org
> mfojtik@redhat.com
> 
> 
> 

Michal Fojtik
http://deltacloud.org
mfojtik@redhat.com




Mime
View raw message