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.
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)