Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The next step in understanding Sinatra’s internals is to examine the flow of a request, from parsing to delivery of a response back to the client. To do so, we need to examine the role of Rack (which we’ve mentioned briefly earlier) in the Sinatra landscape.
Rack is a specification implemented by not only Sinatra, but also
Rails, Merb, Ramaze, and a number of other Ruby projects. It’s an
extremely simple protocol specifying how an HTTP server (such as Thin,
which we’ve used throughout the book) interfaces with an application
object, like Sinatra::Application,
without having to know anything about Sinatra in particular. In short,
Rack defines the higher-level vocabulary that hardware and software can
use to communicate. The Rack homepage, http://rack.rubyforge.org, is shown in Figure 3-4.