U:RDoc::TopLevel[ i I"README.md:ETcRDoc::Parser::Markdowno:RDoc::Markup::Document:@parts[OS:RDoc::Markup::Heading:
leveli: textI"!rdoc-image:contrib/logo.webp;To:RDoc::Markup::BlockQuote;[o:RDoc::Markup::Paragraph;[I"NOTE: Rack v3.0.0 was recently released. Please check the {Upgrade Guide}[UPGRADE-GUIDE.md] for more details about migrating your existing
servers, middlewares and applications. For detailed information on specific
changes, check the {Change Log}[CHANGELOG.md].;To;
;[I"Rack provides a minimal, modular, and adaptable interface for developing web
applications in Ruby. By wrapping HTTP requests and responses in the simplest
way possible, it unifies and distills the bridge between web servers, web
frameworks, and web application into a single method call.;To;
;[I"~The exact details of this are described in the {Rack Specification}[SPEC.rdoc], which all
Rack applications should conform to.;TS; ;
i;I"Installation;To;
;[I"‹Add the rack gem to your application bundle, or follow the instructions provided
by a {supported web framework}[#supported-web-frameworks]:;To:RDoc::Markup::Verbatim;[I"†# Install it generally:
$ gem install rack --pre
# or, add it to your current application gemfile:
$ bundle add rack --version 3.0.0
;T:@format: basho;
;[I"vIf you need features from Rack::Session
or bin/rackup
please add those gems separately.;To;;[I"'$ gem install rack-session rackup
;T;;S; ;
i;I"
Usage;To;
;[I"MCreate a file called config.ru
with the following contents:;To;;[I"3run do |env|
[200, {}, ["Hello World"]]
end
;T;: rubyo;
;[I"]Run this using the rackup gem or another {supported web server}[#supported-web-servers].;To;;[I"L$ gem install rackup
$ rackup
$ curl http://localhost:9292
Hello World
;T;;S; ;
i;I"Supported web servers;To;
;[I"=Rack is supported by a wide range of servers, including:;To:RDoc::Markup::List:
@type:BULLET:@items[o:RDoc::Markup::ListItem:@label0;[o;
;[I",{Agoo}[https://github.com/ohler55/agoo];To;;0;[o;
;[I"L{Falcon}[https://github.com/socketry/falcon] (Rack 3 Compatible);To;;0;[o;
;[I"2{Iodine}[https://github.com/boazsegev/iodine];To;;0;[o;
;[I"*{NGINX Unit}[https://unit.nginx.org/];To;;0;[o;
;[I"i{Phusion Passenger}[https://www.phusionpassenger.com/] (which is mod_rack for
Apache and for nginx);To;;0;[o;
;[I"{Puma}[https://puma.io/];To;;0;[o;
;[I"0{Thin}[https://github.com/macournoyer/thin];To;;0;[o;
;[I"){Unicorn}[https://yhbt.net/unicorn/];To;;0;[o;
;[I":{uWSGI}[https://uwsgi-docs.readthedocs.io/en/latest/];To;;0;[o;
;[I">{Lamby}[https://lamby.custominktech.com] (for AWS Lambda);To;
;[I"ÌYou will need to consult the server documentation to find out what features and
limitations they may have. In general, any valid Rack app will run the same on
all these servers, without changing anything.;TS; ;
i;I"Rackup;To;
;[I"ïRack provides a separate gem, {rackup}[https://github.com/rack/rackup] which is
a generic interface for running a Rack application on supported servers, which
include WEBRick
, Puma
, Falcon
and others.;TS; ;
i;I"Supported web frameworks;To;
;[I"RThese frameworks and many others support the {Rack Specification}[SPEC.rdoc]:;To;;;;[
o;;0;[o;
;[I"2{Camping}[https://github.com/camping/camping];To;;0;[o;
;[I"${Hanami}[https://hanamirb.org/];To;;0;[o;
;[I"&{Padrino}[https://padrinorb.com/];To;;0;[o;
;[I"K{Roda}[https://github.com/jeremyevans/roda] (Rack 3 Compatible);To;;0;[o;
;[I".{Ruby on Rails}[https://rubyonrails.org/];To;;0;[o;
;[I"&{Sinatra}[https://sinatrarb.com/];To;;0;[o;
;[I"L{Utopia}[https://github.com/socketry/utopia] (Rack 3 Compatible);To;;0;[o;
;[I".{WABuR}[https://github.com/ohler55/wabur];TS; ;
i;I"0Older (possibly unsupported) web frameworks;To;;;;[o;;0;[o;
;[I"!{Ramaze}[http://ramaze.net/];To;;0;[o;
;[I"1{Rum}[https://github.com/leahneukirchen/rum];TS; ;
i;I"+Available middleware shipped with Rack;To;
;[I"šBetween the server and the framework, Rack can be customized to your
applications needs using middleware. Rack itself ships with the following
middleware:;To;;;;[o;;0;[o;
;[I"HRack::CommonLogger
for creating Apache-style logfiles.;To;;0;[o;
;[I"ªRack::ConditionalGet
for returning {Not Modified}[https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/304]
responses when the response has not changed.;To;;0;[o;
;[I"[Rack::Config
for modifying the environment before processing the request.;To;;0;[o;
;[I"kRack::ContentLength
for setting a content-length
header based on body
size.;To;;0;[o;
;[I"iRack::ContentType
for setting a default content-type
header for responses.;To;;0;[o;
;[I"ERack::Deflater
for compressing responses with gzip.;To;;0;[o;
;[I"aRack::ETag
for setting etag
header on bodies that can be buffered.;To;;0;[o;
;[I"rRack::Events
for providing easy hooks when a request is received and when
the response is sent.;To;;0;[o;
;[I"7Rack::Files
for serving static files.;To;;0;[o;
;[I"KRack::Head
for returning an empty body for HEAD requests.;To;;0;[o;
;[I"]Rack::Lint
for checking conformance to the {Rack Specification}[SPEC.rdoc].;To;;0;[o;
;[I"DRack::Lock
for serializing requests using a mutex.;To;;0;[o;
;[I"MRack::Logger
for setting a logger to handle logging errors.;To;;0;[o;
;[I"hRack::MethodOverride
for modifying the request method based on a submitted
parameter.;To;;0;[o;
;[I"|Rack::Recursive
for including data from other paths in the application, and
for performing internal redirects.;To;;0;[o;
;[I"PRack::Reloader
for reloading files if they have been modified.;To;;0;[o;
;[I"lRack::Runtime
for including a response header with the time taken to process
the request.;To;;0;[o;
;[I"yRack::Sendfile
for working with web servers that can use optimized file
serving for file system paths.;To;;0;[o;
;[I"‹Rack::ShowException
for catching unhandled exceptions and presenting them in
a nice and helpful way with clickable backtrace.;To;;0;[o;
;[I"`Rack::ShowStatus
for using nice error pages for empty client error
responses.;To;;0;[o;
;[I"MRack::Static
for more configurable serving of static files.;To;;0;[o;
;[I"^Rack::TempfileReaper
for removing temporary files creating during a request.;To;
;[I"¬All these components use the same interface, which is described in detail in the
{Rack Specification}[SPEC.rdoc]. These optional components can be used in any way you wish.;TS; ;
i;I"Convenience interfaces;To;
;[I"ÔIf you want to develop outside of existing frameworks, implement your own ones,
or develop middleware, Rack provides many helpers to create Rack applications
quickly and without doing the same web stuff all over:;To;;;;[o;;0;[o;
;[I"aRack::Request
which also provides query string parsing and multipart
handling.;To;;0;[o;
;[I"`Rack::Response
for convenient generation of HTTP replies and cookie
handling.;To;;0;[o;
;[I"–Rack::MockRequest
and Rack::MockResponse
for efficient and quick testing
of Rack application without real HTTP round-trips.;To;;0;[o;
;[I"‹Rack::Cascade
for trying additional Rack applications if an application
returns a not found or method not supported response.;To;;0;[o;
;[I"eRack::Directory
for serving files under a given directory, with directory
indexes.;To;;0;[o;
;[I"CRack::MediaType
for parsing content-type headers.;To;;0;[o;
;[I"RRack::Mime
for determining content-type based on file extension.;To;;0;[o;
;[I"lRack::RewindableInput
for making any IO object rewindable, using a temporary
file buffer.;To;;0;[o;
;[I"YRack::URLMap
to route to multiple applications inside the same process.;TS; ;
i;I"Configuration;To;
;[I"eRack exposes several configuration parameters to control various features of the
implementation.;TS; ;
i;I"#param_depth_limit
;To;;[I"2Rack::Utils.param_depth_limit = 32 # default
;T;;o;
;[I"wThe maximum amount of nesting allowed in parameters. For example, if set to 3,
this query string would be allowed:;To;;[I"?a[b][c]=d
;T;0o;
;[I"0but this query string would not be allowed:;To;;[I"?a[b][c][d]=e
;T;0o;
;[I"SLimiting the depth prevents a possible stack overflow when parsing parameters.;TS; ;
i;I"&multipart_file_limit
;To;;[I"6Rack::Utils.multipart_file_limit = 128 # default
;T;;o;
;[I"The maximum number of parts with a filename a request can contain. Accepting
too many parts can lead to the server running out of file handles.;To;
;[I"{The default is 128, which means that a single request can't upload more than 128
files at once. Set to 0 for no limit.;To;
;[I"YCan also be set via the RACK_MULTIPART_FILE_LIMIT
environment variable.;To;
;[I"}(This is also aliased as multipart_part_limit
and RACK_MULTIPART_PART_LIMIT
for compatibility);TS; ;
i;I",multipart_total_part_limit
;To;
;[I"wThe maximum total number of parts a request can contain of any type, including
both file and non-file form fields.;To;
;[I"_The default is 4096, which means that a single request can't contain more than
4096 parts.;To;
;[I"Set to 0 for no limit.;To;
;[I"_Can also be set via the RACK_MULTIPART_TOTAL_PART_LIMIT
environment variable.;TS; ;
i;I"Changelog;To;
;[I"&See {CHANGELOG.md}[CHANGELOG.md].;TS; ;
i;I"Contributing;To;
;[I"jSee {CONTRIBUTING.md}[CONTRIBUTING.md] for specific details about how to make a
contribution to Rack.;To;
;[I"gPlease post bugs, suggestions and patches to {GitHub Issues}[https://github.com/rack/rack/issues].;To;
;[I"UPlease check our {Security Policy}[https://github.com/rack/rack/security/policy]
for responsible disclosure and security bug reporting process. Due to wide usage
of the library, it is strongly preferred that we manage timing in order to
provide viable patches at the time of disclosure. Your assistance in this matter
is greatly appreciated.;TS; ;
i;I"
See Also;TS; ;
i;I"rack-contrib
;To;
;[I"ÚThe plethora of useful middleware created the need for a project that collects
fresh Rack middleware. rack-contrib
includes a variety of add-on components
for Rack and it is easy to contribute new modules.;To;;;;[o;;0;[o;
;[I")https://github.com/rack/rack-contrib;TS; ;
i;I"rack-session
;To;
;[I"5Provides convenient session management for Rack.;To;;;;[o;;0;[o;
;[I")https://github.com/rack/rack-session;TS; ;
i;I"Thanks;To;
;[I"&The Rack Core Team, consisting of;To;;;;[o;;0;[o;
;[I"@Aaron Patterson {tenderlove}[https://github.com/tenderlove];To;;0;[o;
;[I"Scytrin dai Kinthra {scytrin}[https://github.com/scytrin];To;;0;[o;
;[I"HLeah Neukirchen {leahneukirchen}[https://github.com/leahneukirchen];To;;0;[o;
;[I"3James Tucker {raggi}[https://github.com/raggi];To;;0;[o;
;[I".Josh Peek {josh}[https://github.com/josh];To;;0;[o;
;[I":José Valim {josevalim}[https://github.com/josevalim];To;;0;[o;
;[I"Rack::Deflater.;To;;0;[o;
;[I"4Tim Fletcher, for the HTTP authentication code.;To;;0;[o;
;[I"PLuc Heinrich for the Cookie sessions, the static file handler and bugfixes.;To;;0;[o;
;[I"0Armin Ronacher, for the logo and racktools.;To;;0;[o;
;[I"Alex Beregszaszi, Alexander Kahn, Anil Wadghule, Aredridel, Ben Alpert, Dan
Kubb, Daniel Roethlisberger, Matt Todd, Tom Robinson, Phil Hagelberg, S. Brent
Faulkner, Bosko Milekic, Daniel RodrÃguez Troitiño, Genki Takiuchi, Geoffrey
Grosenbach, Julien Sanchez, Kamal Fariz Mahyuddin, Masayoshi Takahashi,
Patrick Aljordm, Mig, Kazuhiro Nishiyama, Jon Bardin, Konstantin Haase, Larry
Siden, Matias Korhonen, Sam Ruby, Simon Chiang, Tim Connor, Timur Batyrshin,
and Zach Brock for bug fixing and other improvements.;To;;0;[o;
;[I"]Eric Wong, Hongli Lai, Jeremy Kemper for their continuous support and API
improvements.;To;;0;[o;
;[I"8Yehuda Katz and Carl Lerche for refactoring rackup.;To;;0;[o;
;[I"7Brian Candler, for Rack::ContentType
.;To;;0;[o;
;[I"0Graham Batty, for improved handler loading.;To;;0;[o;
;[I"9Stephen Bannasch, for bug reports and documentation.;To;;0;[o;
;[I"OGary Wright, for proposing a better Rack::Response
interface.;To;;0;[o;
;[I"KJonathan Buch, for improvements regarding Rack::Response
.;To;;0;[o;
;[I"BArmin Röhrl, for tracking down bugs in the Cookie generator.;To;;0;[o;
;[I"JAlexander Kellett for testing the Gem and reviewing the announcement.;To;;0;[o;
;[I"GMarcus Rückert, for help with configuring and debugging lighttpd.;To;;0;[o;
;[I"]The WSGI team for the well-done and documented work they've done and Rack
builds up on.;To;;0;[o;
;[I"BAll bug reporters and patch contributors not mentioned above.;TS; ;
i;I"License;To;
;[I";Rack is released under the {MIT License}[MIT-LICENSE].;T:
@file@:0@omit_headings_from_table_of_contents_below0