Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

No work properly in Ruby 1.9.2-p0 #50

Closed
rust opened this Issue Aug 20, 2010 · 9 comments

Comments

Projects
None yet
6 participants

rust commented Aug 20, 2010

Because of changes of Kernel#caller, sinatra application can't work. So please add /<internal:/ to Sinatra::Base::CALLERS_TO_IGNORE.

public
  CALLERS_TO_IGNORE = [
    /\/sinatra(\/(base|main|showexceptions))?\.rb$/, # all sinatra code
    /lib\/tilt.*\.rb$/,    # all tilt code
    /\(.*\)/,              # generated code
    /custom_require\.rb$/, # rubygems require hacks
    /<internal:/, # ruby 1.9.2-p0 hacks
    /active_support/,      # active_support require hacks
  ]

l15n commented Aug 20, 2010

Confirmed by running the example on http://www.sinatrarb.com/ with debugging flags.

$ ruby -d hi.rb
Exception `LoadError' at <internal:lib/rubygems/custom_require>:29 - no such file to load -- rubygems/defaults/operating_system
Exception `LoadError' at <internal:lib/rubygems/custom_require>:37 - no such file to load -- rubygems/defaults/operating_system
Exception `LoadError' at <internal:lib/rubygems/custom_require>:29 - no such file to load -- rubygems/defaults/ruby
Exception `LoadError' at <internal:lib/rubygems/custom_require>:37 - no such file to load -- rubygems/defaults/ruby
Exception `LoadError' at <internal:lib/rubygems/custom_require>:29 - no such file to load -- sinatra
Exception `LoadError' at <internal:lib/rubygems/custom_require>:29 - no such file to load -- tilt
Exception `LoadError' at <internal:lib/rubygems/custom_require>:37 - no such file to load -- tilt
/home/l15n/.rvm/gems/ruby-1.9.2-p0/gems/sinatra-1.0/lib/sinatra/base.rb:1010: warning: method redefined; discarding old run
/home/l15n/.rvm/gems/ruby-1.9.2-p0/gems/sinatra-1.0/lib/sinatra/base.rb:1120: warning: previous definition of run was here
/home/l15n/.rvm/gems/ruby-1.9.2-p0/gems/sinatra-1.0/lib/sinatra/base.rb:1010: warning: method redefined; discarding old run?
/home/l15n/.rvm/gems/ruby-1.9.2-p0/gems/sinatra-1.0/lib/sinatra/base.rb:701: warning: previous definition of run? was here
/home/l15n/.rvm/gems/ruby-1.9.2-p0/gems/sinatra-1.0/lib/sinatra/base.rb:1010: warning: method redefined; discarding old run=
/home/l15n/.rvm/gems/ruby-1.9.2-p0/gems/sinatra-1.0/lib/sinatra/base.rb:702: warning: previous definition of run= was here
Exception `Errno::ENOENT' at /home/l15n/.rvm/gems/ruby-1.9.2-p0/gems/sinatra-1.0/lib/sinatra/base.rb:753 - No such file or directory - <internal:lib/rubygems/custom_require>

l15n commented Aug 20, 2010

Note: fixed in sorah's fork.

http://github.com/sorah/sinatra

Owner

rkh commented Aug 20, 2010

Simon, Ryan, Blake: Can we somehow help getting a new release out there? Preparing patches, etc? I think this bug fix is somewhat urgent. Also, new release has been in the pipes for some months now.

lamnk commented Aug 25, 2010

I also have the same problem. Sinatra on 1.9.2-p0 refuses to run.

grasp commented Aug 27, 2010

not run in here also :(

Any updates on this? I can only manage to get an app to run when setting the :run option to true.

For example, the following does NOT work:
require 'sinatra'

get '/' do
  "foo"
end

And this does:

require 'sinatra'

enable :run

get '/' do
  "foo"
end

grasp commented Aug 31, 2010

see post50:

add this line

/<internal:/, # ruby 1.9.2-p0 hacks

and it works

Owner

rkh commented Sep 7, 2010

Fixed by #56.

Owner

rkh commented Sep 25, 2010

Fix has been merged.

@zzak zzak pushed a commit to zzak/sinatra that referenced this issue Jul 22, 2016

@rkh rkh Merge pull request #50 from shime/master
capture documentation
9509829

@zzak zzak pushed a commit to zzak/sinatra that referenced this issue Jul 22, 2016

@rkh rkh Merge pull request #50 from shime/master
capture documentation
f15e6b5

@zzak zzak pushed a commit that referenced this issue Aug 12, 2016

@bugant bugant Add regression test for issue #50
Running specs you get

Failures:

  1) Rack::Protection::JsonCsrf with drop_session as default reaction reset the session
     Failure/Error: get('/', {}, 'HTTP_REFERER' => 'http://evil.com', 'rack.session' => session)
     NoMethodError:
       undefined method `detect' for nil:NilClass
     # ./lib/rack/protection/base.rb:107:in `html?'
     # ./lib/rack/protection/frame_options.rb:32:in `call'
     # ./spec/json_csrf_spec.rb:54:in `block (3 levels) in <top (required)>'
ac79948

@zzak zzak pushed a commit that referenced this issue Aug 12, 2016

@bugant bugant FIX: check for nil response on JsonCsrf protection
Some reaction do not return a response, think for example drop_session. In that case a nil response
would be returned, see issue #50.
fa58e05

@zzak zzak pushed a commit that referenced this issue Aug 12, 2016

@rkh rkh let json_csrf always deny, fixes #50 5d4f1d8

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment