Execute the before filters before looking up the event. Makes it possible for filters to rewrite request variables such as PATH_INFO and REQUEST_METHOD and have it effect which route is chosen.
The raise_errors option was implemented as part of the default error handler making it worthless in development mode or with a custom error handler. This moves the implementation to the core dispatch method. While here, clean up the Error class a bit, making it use the options provided and pass the correct HTTP status code.
Fixes case where development error handlers show up in non-development environments when the env option is set in code instead of on the command line. For example, the following app shows the development 404 page: require 'sinatra' set :env, :production
I can't stand this shit anymore.
This fixes the problem when running an app with -e development
…ts via 'set :server, handler' if Rack::Handler::Thing doesn't exist. This lets special capitalziation cases like FastCGI, CGI, and WEBrick be handled easily.
…h is code for 'all of them'
… borrowed from rails (compilable.rb)
This fixes the issue of random errors and backtraces being dumped to STDERR in development when you hit the site too-fast. The problem seemed to be that reloading was not occuring within the Mutex lock so there's a chance that objects get into some kind of weird half-state. With this patch, the mutex lock is always enabled in development and I've moved the calls to run_safely out of Application#dispatch and into Application#call so that the entire reloading process and Rack pipeline run exclusively.
When an exception whose #messages attribute is not a string is rescued, Sinatra fails to display the error page due to a TypeError. The problem is that Ruby's + implementation uses type-strong coercing (#to_str) instead of type-weak coercision (#to_s). This just forces to_s to be used, avoiding the problem. (An example of this type of exception is DataMapper::Errors. It doesn't respond to #to_str)
…development mode. Default is $0. This is for situations where $0 isn't the Sinatra application