…natra compatable with the master/0.5 branchs of rack
Fixed how the Sinatra application's path is set. Previously it was derived exclusively from $0, but this was causing problems when running Sinatra under Rack because $0 is the web server (e.g., thin, passenger, etc) and thus Sinatra would incorrectly set things like the default views path. This fix adds a new locate_app_file method that uses a number of techniques to guess the Sinatra application's path.
The Static event handler is now instantiated with a reference back to the Sinatra app instead of using the global singleton. While here, bump streaming buffer size from 4K to 8K -- word around the campfire is that reading in 8K chunks results in a bit less IO on most modern systems.
The default :stream option value was not being picked up properly leading all calls to send_file (including those served with Static) to read the entire file into a string before sending. Further, the body was then being returned as a string, which causes Rack to iterate over the contents line-wise.
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.