You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure if this is a padrino issue, something with the underlying sinatra, or even just a problem with my understanding, but I'll describe the steps I took to recreate the problem.
After creating a fresh padrino project following the steps listed on the padrino landing page, update app.rb to include:
enable :sessions
set :protection, true
set :protect_from_csrf, false
set :allow_disabled_csrf, true
get '/' do
"Hello World"
end
put '/b/:b/:c', :csrf_protection => false do
logger.warn params.inspect
"Hello World"
end
get %r{/b/(?<aa>\w+)/(?<bb>\w+)} do
logger.warn params.inspect
"Hello World"
end
Once that's done, you should notice that:
GET localhost:3000/b/x/y HTTP/1.1
..will succeed
and PUT localhost:3000/b/x/y HTTP/1.1
...will also succeed
The next step is to reverse the order of the get and the put: e.g.
enable :sessions
set :protection, true
set :protect_from_csrf, false
set :allow_disabled_csrf, true
get '/' do
"Hello World"
end
get %r{/b/(?<aa>\w+)/(?<bb>\w+)} do
logger.warn params.inspect
"Hello World"
end
put '/b/:b/:c', :csrf_protection => false do
logger.warn params.inspect
"Hello World"
end
Now...
GET localhost:3000/b/x/y HTTP/1.1
..will succeed
and PUT localhost:3000/b/x/y HTTP/1.1
...will fail with the following error message and stack trace:
I'm not sure if this is a padrino issue, something with the underlying sinatra, or even just a problem with my understanding, but I'll describe the steps I took to recreate the problem.
After creating a fresh padrino project following the steps listed on the padrino landing page, update app.rb to include:
Once that's done, you should notice that:
GET localhost:3000/b/x/y HTTP/1.1
..will succeed
and
PUT localhost:3000/b/x/y HTTP/1.1
...will also succeed
The next step is to reverse the order of the
get
and theput
: e.g.Now...
GET localhost:3000/b/x/y HTTP/1.1
..will succeed
and
PUT localhost:3000/b/x/y HTTP/1.1
...will fail with the following error message and stack trace:
The text was updated successfully, but these errors were encountered: