On Sep 10, 2012, at 9:13 PM, David Lutterkort <[email protected]> wrote:

> On Mon, 2012-09-10 at 11:35 +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]>
> 
> 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...

I'll record new patch set to tracker, thanks!

  -- Michal


Michal Fojtik
http://deltacloud.org
[email protected]



Reply via email to