Server IP : 66.29.132.122 / Your IP : 3.141.198.230 Web Server : LiteSpeed System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : admazpex ( 531) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/self/root/proc/thread-self/root/proc/thread-self/root/opt/alt/ruby19/lib64/ruby/gems/1.9.1/doc/rack-1.6.4/rdoc/Rack/ |
Upload File : |
<?xml version="1.0" encoding="US-ASCII"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta content="text/html; charset=US-ASCII" http-equiv="Content-Type" /> <title>Class: Rack::Request</title> <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" /> <script src="../js/jquery.js" type="text/javascript" charset="utf-8"></script> <script src="../js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script> <script src="../js/quicksearch.js" type="text/javascript" charset="utf-8"></script> <script src="../js/darkfish.js" type="text/javascript" charset="utf-8"></script> </head> <body id="top" class="class"> <div id="metadata"> <div id="home-metadata"> <div id="home-section" class="section"> <h3 class="section-header"> <a href="../index.html">Home</a> <a href="../index.html#classes">Classes</a> <a href="../index.html#methods">Methods</a> </h3> </div> </div> <div id="file-metadata"> <div id="file-list-section" class="section"> <h3 class="section-header">In Files</h3> <div class="section-body"> <ul> <li><a href="../lib/rack/request_rb.html?TB_iframe=true&height=550&width=785" class="thickbox" title="lib/rack/request.rb">lib/rack/request.rb</a></li> </ul> </div> </div> </div> <div id="class-metadata"> <!-- Parent Class --> <div id="parent-class-section" class="section"> <h3 class="section-header">Parent</h3> <p class="link"><a href="../Object.html">Object</a></p> </div> <!-- Method Quickref --> <div id="method-list-section" class="section"> <h3 class="section-header">Methods</h3> <ul class="link-list"> <li><a href="#method-c-new">::new</a></li> <li><a href="#method-i-GET">#GET</a></li> <li><a href="#method-i-POST">#POST</a></li> <li><a href="#method-i-5B-5D">#[]</a></li> <li><a href="#method-i-5B-5D-3D">#[]=</a></li> <li><a href="#method-i-accept_encoding">#accept_encoding</a></li> <li><a href="#method-i-accept_language">#accept_language</a></li> <li><a href="#method-i-base_url">#base_url</a></li> <li><a href="#method-i-body">#body</a></li> <li><a href="#method-i-content_charset">#content_charset</a></li> <li><a href="#method-i-content_length">#content_length</a></li> <li><a href="#method-i-content_type">#content_type</a></li> <li><a href="#method-i-cookies">#cookies</a></li> <li><a href="#method-i-delete-3F">#delete?</a></li> <li><a href="#method-i-delete_param">#delete_param</a></li> <li><a href="#method-i-form_data-3F">#form_data?</a></li> <li><a href="#method-i-fullpath">#fullpath</a></li> <li><a href="#method-i-get-3F">#get?</a></li> <li><a href="#method-i-head-3F">#head?</a></li> <li><a href="#method-i-host">#host</a></li> <li><a href="#method-i-host_with_port">#host_with_port</a></li> <li><a href="#method-i-ip">#ip</a></li> <li><a href="#method-i-link-3F">#link?</a></li> <li><a href="#method-i-logger">#logger</a></li> <li><a href="#method-i-media_type">#media_type</a></li> <li><a href="#method-i-media_type_params">#media_type_params</a></li> <li><a href="#method-i-options-3F">#options?</a></li> <li><a href="#method-i-params">#params</a></li> <li><a href="#method-i-parse_http_accept_header">#parse_http_accept_header</a></li> <li><a href="#method-i-parse_multipart">#parse_multipart</a></li> <li><a href="#method-i-parse_query">#parse_query</a></li> <li><a href="#method-i-parseable_data-3F">#parseable_data?</a></li> <li><a href="#method-i-patch-3F">#patch?</a></li> <li><a href="#method-i-path">#path</a></li> <li><a href="#method-i-path_info">#path_info</a></li> <li><a href="#method-i-path_info-3D">#path_info=</a></li> <li><a href="#method-i-port">#port</a></li> <li><a href="#method-i-post-3F">#post?</a></li> <li><a href="#method-i-put-3F">#put?</a></li> <li><a href="#method-i-query_string">#query_string</a></li> <li><a href="#method-i-referer">#referer</a></li> <li><a href="#method-i-referrer">#referrer</a></li> <li><a href="#method-i-reject_trusted_ip_addresses">#reject_trusted_ip_addresses</a></li> <li><a href="#method-i-request_method">#request_method</a></li> <li><a href="#method-i-scheme">#scheme</a></li> <li><a href="#method-i-script_name">#script_name</a></li> <li><a href="#method-i-script_name-3D">#script_name=</a></li> <li><a href="#method-i-session">#session</a></li> <li><a href="#method-i-session_options">#session_options</a></li> <li><a href="#method-i-split_ip_addresses">#split_ip_addresses</a></li> <li><a href="#method-i-ssl-3F">#ssl?</a></li> <li><a href="#method-i-trace-3F">#trace?</a></li> <li><a href="#method-i-trusted_proxy-3F">#trusted_proxy?</a></li> <li><a href="#method-i-unlink-3F">#unlink?</a></li> <li><a href="#method-i-update_param">#update_param</a></li> <li><a href="#method-i-url">#url</a></li> <li><a href="#method-i-user_agent">#user_agent</a></li> <li><a href="#method-i-values_at">#values_at</a></li> <li><a href="#method-i-xhr-3F">#xhr?</a></li> </ul> </div> </div> <div id="project-metadata"> <div id="fileindex-section" class="section project-section"> <h3 class="section-header">Files</h3> <ul> <li class="file"><a href="../KNOWN-ISSUES.html">KNOWN-ISSUES</a></li> </ul> </div> <div id="classindex-section" class="section project-section"> <h3 class="section-header">Class/Module Index <span class="search-toggle"><img src="../images/find.png" height="16" width="16" alt="[+]" title="show/hide quicksearch" /></span></h3> <form action="#" method="get" accept-charset="utf-8" class="initially-hidden"> <fieldset> <legend>Quicksearch</legend> <input type="text" name="quicksearch" value="" class="quicksearch-field" /> </fieldset> </form> <ul class="link-list"> <li><a href="../Rack.html">Rack</a></li> <li><a href="../Rack/Auth.html">Rack::Auth</a></li> <li><a href="../Rack/Auth/AbstractHandler.html">Rack::Auth::AbstractHandler</a></li> <li><a href="../Rack/Auth/AbstractRequest.html">Rack::Auth::AbstractRequest</a></li> <li><a href="../Rack/Auth/Basic.html">Rack::Auth::Basic</a></li> <li><a href="../Rack/Auth/Basic/Request.html">Rack::Auth::Basic::Request</a></li> <li><a href="../Rack/Auth/Digest.html">Rack::Auth::Digest</a></li> <li><a href="../Rack/Auth/Digest/MD5.html">Rack::Auth::Digest::MD5</a></li> <li><a href="../Rack/Auth/Digest/Nonce.html">Rack::Auth::Digest::Nonce</a></li> <li><a href="../Rack/Auth/Digest/Params.html">Rack::Auth::Digest::Params</a></li> <li><a href="../Rack/Auth/Digest/Request.html">Rack::Auth::Digest::Request</a></li> <li><a href="../Rack/BodyProxy.html">Rack::BodyProxy</a></li> <li><a href="../Rack/Builder.html">Rack::Builder</a></li> <li><a href="../Rack/Cascade.html">Rack::Cascade</a></li> <li><a href="../Rack/Chunked.html">Rack::Chunked</a></li> <li><a href="../Rack/Chunked/Body.html">Rack::Chunked::Body</a></li> <li><a href="../Rack/CommonLogger.html">Rack::CommonLogger</a></li> <li><a href="../Rack/ConditionalGet.html">Rack::ConditionalGet</a></li> <li><a href="../Rack/Config.html">Rack::Config</a></li> <li><a href="../Rack/ContentLength.html">Rack::ContentLength</a></li> <li><a href="../Rack/ContentType.html">Rack::ContentType</a></li> <li><a href="../Rack/Deflater.html">Rack::Deflater</a></li> <li><a href="../Rack/Deflater/DeflateStream.html">Rack::Deflater::DeflateStream</a></li> <li><a href="../Rack/Deflater/GzipStream.html">Rack::Deflater::GzipStream</a></li> <li><a href="../Rack/Directory.html">Rack::Directory</a></li> <li><a href="../Rack/ETag.html">Rack::ETag</a></li> <li><a href="../Rack/File.html">Rack::File</a></li> <li><a href="../Rack/ForwardRequest.html">Rack::ForwardRequest</a></li> <li><a href="../Rack/Handler.html">Rack::Handler</a></li> <li><a href="../Rack/Handler/CGI.html">Rack::Handler::CGI</a></li> <li><a href="../Rack/Handler/EventedMongrel.html">Rack::Handler::EventedMongrel</a></li> <li><a href="../Rack/Handler/FastCGI.html">Rack::Handler::FastCGI</a></li> <li><a href="../Rack/Handler/LSWS.html">Rack::Handler::LSWS</a></li> <li><a href="../Rack/Handler/Mongrel.html">Rack::Handler::Mongrel</a></li> <li><a href="../Rack/Handler/SCGI.html">Rack::Handler::SCGI</a></li> <li><a href="../Rack/Handler/SwiftipliedMongrel.html">Rack::Handler::SwiftipliedMongrel</a></li> <li><a href="../Rack/Handler/Thin.html">Rack::Handler::Thin</a></li> <li><a href="../Rack/Handler/WEBrick.html">Rack::Handler::WEBrick</a></li> <li><a href="../Rack/Head.html">Rack::Head</a></li> <li><a href="../Rack/Lint.html">Rack::Lint</a></li> <li><a href="../Rack/Lobster.html">Rack::Lobster</a></li> <li><a href="../Rack/Lock.html">Rack::Lock</a></li> <li><a href="../Rack/Logger.html">Rack::Logger</a></li> <li><a href="../Rack/MethodOverride.html">Rack::MethodOverride</a></li> <li><a href="../Rack/Mime.html">Rack::Mime</a></li> <li><a href="../Rack/MockRequest.html">Rack::MockRequest</a></li> <li><a href="../Rack/MockRequest/FatalWarner.html">Rack::MockRequest::FatalWarner</a></li> <li><a href="../Rack/MockRequest/FatalWarning.html">Rack::MockRequest::FatalWarning</a></li> <li><a href="../Rack/MockResponse.html">Rack::MockResponse</a></li> <li><a href="../Rack/Multipart.html">Rack::Multipart</a></li> <li><a href="../Rack/Multipart/Generator.html">Rack::Multipart::Generator</a></li> <li><a href="../Rack/Multipart/MultipartPartLimitError.html">Rack::Multipart::MultipartPartLimitError</a></li> <li><a href="../Rack/Multipart/Parser.html">Rack::Multipart::Parser</a></li> <li><a href="../Rack/Multipart/UploadedFile.html">Rack::Multipart::UploadedFile</a></li> <li><a href="../Rack/NullLogger.html">Rack::NullLogger</a></li> <li><a href="../Rack/Recursive.html">Rack::Recursive</a></li> <li><a href="../Rack/Reloader.html">Rack::Reloader</a></li> <li><a href="../Rack/Reloader/Stat.html">Rack::Reloader::Stat</a></li> <li><a href="../Rack/Request.html">Rack::Request</a></li> <li><a href="../Rack/Response.html">Rack::Response</a></li> <li><a href="../Rack/Response/Helpers.html">Rack::Response::Helpers</a></li> <li><a href="../Rack/RewindableInput.html">Rack::RewindableInput</a></li> <li><a href="../Rack/RewindableInput/Tempfile.html">Rack::RewindableInput::Tempfile</a></li> <li><a href="../Rack/Runtime.html">Rack::Runtime</a></li> <li><a href="../Rack/Sendfile.html">Rack::Sendfile</a></li> <li><a href="../Rack/Server.html">Rack::Server</a></li> <li><a href="../Rack/Server/Options.html">Rack::Server::Options</a></li> <li><a href="../Rack/Session.html">Rack::Session</a></li> <li><a href="../Rack/Session/Abstract.html">Rack::Session::Abstract</a></li> <li><a href="../Rack/Session/Abstract/ID.html">Rack::Session::Abstract::ID</a></li> <li><a href="../Rack/Session/Abstract/SessionHash.html">Rack::Session::Abstract::SessionHash</a></li> <li><a href="../Rack/Session/Cookie.html">Rack::Session::Cookie</a></li> <li><a href="../Rack/Session/Cookie/Base64.html">Rack::Session::Cookie::Base64</a></li> <li><a href="../Rack/Session/Cookie/Base64/JSON.html">Rack::Session::Cookie::Base64::JSON</a></li> <li><a href="../Rack/Session/Cookie/Base64/Marshal.html">Rack::Session::Cookie::Base64::Marshal</a></li> <li><a href="../Rack/Session/Cookie/Base64/ZipJSON.html">Rack::Session::Cookie::Base64::ZipJSON</a></li> <li><a href="../Rack/Session/Cookie/Identity.html">Rack::Session::Cookie::Identity</a></li> <li><a href="../Rack/Session/Memcache.html">Rack::Session::Memcache</a></li> <li><a href="../Rack/Session/Pool.html">Rack::Session::Pool</a></li> <li><a href="../Rack/ShowExceptions.html">Rack::ShowExceptions</a></li> <li><a href="../Rack/ShowStatus.html">Rack::ShowStatus</a></li> <li><a href="../Rack/Static.html">Rack::Static</a></li> <li><a href="../Rack/TempfileReaper.html">Rack::TempfileReaper</a></li> <li><a href="../Rack/URLMap.html">Rack::URLMap</a></li> <li><a href="../Rack/Utils.html">Rack::Utils</a></li> <li><a href="../Rack/Utils/Context.html">Rack::Utils::Context</a></li> <li><a href="../Rack/Utils/HeaderHash.html">Rack::Utils::HeaderHash</a></li> <li><a href="../Rack/Utils/InvalidParameterError.html">Rack::Utils::InvalidParameterError</a></li> <li><a href="../Rack/Utils/KeySpaceConstrainedParams.html">Rack::Utils::KeySpaceConstrainedParams</a></li> <li><a href="../Rack/Multipart.html">Rack::Utils::Multipart</a></li> <li><a href="../Rack/Utils/OkJson.html">Rack::Utils::OkJson</a></li> <li><a href="../Rack/Utils/OkJson/Error.html">Rack::Utils::OkJson::Error</a></li> <li><a href="../Rack/Utils/OkJson/Utf8Error.html">Rack::Utils::OkJson::Utf8Error</a></li> <li><a href="../Rack/Utils/ParameterTypeError.html">Rack::Utils::ParameterTypeError</a></li> <li><a href="../FCGI.html">FCGI</a></li> <li><a href="../FCGI/Stream.html">FCGI::Stream</a></li> <li><a href="../WEBrick.html">WEBrick</a></li> <li><a href="../WEBrick/HTTPResponse.html">WEBrick::HTTPResponse</a></li> <li><a href="../Object.html">Object</a></li> </ul> <div id="no-class-search-results" style="display: none;">No matching classes.</div> </div> </div> </div> <div id="documentation"> <h1 class="class">Rack::Request</h1> <div id="description" class="description"> <p><a href="Request.html">Rack::Request</a> provides a convenient interface to a <a href="../Rack.html">Rack</a> environment. It is stateless, the environment <tt>env</tt> passed to the constructor will be directly modified.</p> <pre>req = Rack::Request.new(env) req.post? req.params["data"]</pre> </div><!-- description --> <div id="5Buntitled-5D" class="documentation-section"> <!-- Constants --> <div id="constants-list" class="section"> <h3 class="section-header">Constants</h3> <dl> <dt><a name="DEFAULT_PORTS">DEFAULT_PORTS</a></dt> <dd class="description"><p>Default ports depending on scheme. Used to decide whether or not to include the port in a generated URI.</p></dd> <dt><a name="FORM_DATA_MEDIA_TYPES">FORM_DATA_MEDIA_TYPES</a></dt> <dd class="description"><p>The set of form-data media-types. Requests that do not indicate one of the media types presents in this list will not be eligible for form-data / param parsing.</p></dd> <dt><a name="PARSEABLE_DATA_MEDIA_TYPES">PARSEABLE_DATA_MEDIA_TYPES</a></dt> <dd class="description"><p>The set of media-types. Requests that do not indicate one of the media types presents in this list will not be eligible for param parsing like soap attachments or generic multiparts</p></dd> </dl> </div> <!-- Attributes --> <div id="attribute-method-details" class="method-section section"> <h3 class="section-header">Attributes</h3> <div id="env-attribute-method" class="method-detail"> <a name="env"></a> <div class="method-heading attribute-method-heading"> <span class="method-name">env</span><span class="attribute-access-type">[R]</span> </div> <div class="method-description"> <p>The environment of the request.</p> </div> </div> </div><!-- attribute-method-details --> <!-- Methods --> <div id="public-class-method-details" class="method-section section"> <h3 class="section-header">Public Class Methods</h3> <div id="new-method" class="method-detail "> <a name="method-c-new"></a> <div class="method-heading"> <span class="method-name">new</span><span class="method-args">(env)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="new-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 16</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">env</span>) <span class="ruby-ivar">@env</span> = <span class="ruby-identifier">env</span> <span class="ruby-keyword">end</span></pre> </div><!-- new-source --> </div> </div><!-- new-method --> </div><!-- public-class-method-details --> <div id="public-instance-method-details" class="method-section section"> <h3 class="section-header">Public Instance Methods</h3> <div id="GET-method" class="method-detail "> <a name="method-i-GET"></a> <div class="method-heading"> <span class="method-name">GET</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>Returns the data received in the query string.</p> <div class="method-source-code" id="GET-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 187</span> <span class="ruby-keyword">def</span> <span class="ruby-constant">GET</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@env</span>[<span class="ruby-string">"rack.request.query_string"</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">query_string</span> <span class="ruby-ivar">@env</span>[<span class="ruby-string">"rack.request.query_hash"</span>] <span class="ruby-keyword">else</span> <span class="ruby-identifier">p</span> = <span class="ruby-identifier">parse_query</span>({ <span class="ruby-value">:query</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">query_string</span>, <span class="ruby-value">:separator</span> =<span class="ruby-operator">></span> <span class="ruby-string">'&;'</span> }) <span class="ruby-ivar">@env</span>[<span class="ruby-string">"rack.request.query_string"</span>] = <span class="ruby-identifier">query_string</span> <span class="ruby-ivar">@env</span>[<span class="ruby-string">"rack.request.query_hash"</span>] = <span class="ruby-identifier">p</span> <span class="ruby-keyword">end</span> <span class="ruby-keyword">end</span></pre> </div><!-- GET-source --> </div> </div><!-- GET-method --> <div id="POST-method" class="method-detail "> <a name="method-i-POST"></a> <div class="method-heading"> <span class="method-name">POST</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>Returns the data received in the request body.</p> <p>This method support both application/x-www-form-urlencoded and multipart/form-data.</p> <div class="method-source-code" id="POST-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 201</span> <span class="ruby-keyword">def</span> <span class="ruby-constant">POST</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@env</span>[<span class="ruby-string">"rack.input"</span>].<span class="ruby-identifier">nil?</span> <span class="ruby-identifier">raise</span> <span class="ruby-string">"Missing rack.input"</span> <span class="ruby-keyword">elsif</span> <span class="ruby-ivar">@env</span>[<span class="ruby-string">"rack.request.form_input"</span>].<span class="ruby-identifier">equal?</span> <span class="ruby-ivar">@env</span>[<span class="ruby-string">"rack.input"</span>] <span class="ruby-ivar">@env</span>[<span class="ruby-string">"rack.request.form_hash"</span>] <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">form_data?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">parseable_data?</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@env</span>[<span class="ruby-string">"rack.request.form_hash"</span>] = <span class="ruby-identifier">parse_multipart</span>(<span class="ruby-identifier">env</span>) <span class="ruby-identifier">form_vars</span> = <span class="ruby-ivar">@env</span>[<span class="ruby-string">"rack.input"</span>].<span class="ruby-identifier">read</span> <span class="ruby-comment"># Fix for Safari Ajax postings that always append \0</span> <span class="ruby-comment"># form_vars.sub!(/\0\z/, '') # performance replacement:</span> <span class="ruby-identifier">form_vars</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">-1</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">form_vars</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">\00 \</span> <span class="ruby-ivar">@env</span>[<span class="ruby-string">"rack.request.form_vars"</span>] = <span class="ruby-identifier">form_vars</span> <span class="ruby-ivar">@env</span>[<span class="ruby-string">"rack.request.form_hash"</span>] = <span class="ruby-identifier">parse_query</span>({ <span class="ruby-value">:query</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">form_vars</span>, <span class="ruby-value">:separator</span> =<span class="ruby-operator">></span> <span class="ruby-string">'&'</span> }) <span class="ruby-ivar">@env</span>[<span class="ruby-string">"rack.input"</span>].<span class="ruby-identifier">rewind</span> <span class="ruby-keyword">end</span> <span class="ruby-ivar">@env</span>[<span class="ruby-string">"rack.request.form_input"</span>] = <span class="ruby-ivar">@env</span>[<span class="ruby-string">"rack.input"</span>] <span class="ruby-ivar">@env</span>[<span class="ruby-string">"rack.request.form_hash"</span>] <span class="ruby-keyword">else</span> {} <span class="ruby-keyword">end</span> <span class="ruby-keyword">end</span></pre> </div><!-- POST-source --> </div> </div><!-- POST-method --> <div id="5B-5D-method" class="method-detail "> <a name="method-i-5B-5D"></a> <div class="method-heading"> <span class="method-name">[]</span><span class="method-args">(key)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>shortcut for <a href="http://key">request.params</a></p> <div class="method-source-code" id="5B-5D-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 269</span> <span class="ruby-keyword">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">key</span>) <span class="ruby-identifier">params</span>[<span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>] <span class="ruby-keyword">end</span></pre> </div><!-- 5B-5D-source --> </div> </div><!-- 5B-5D-method --> <div id="5B-5D-3D-method" class="method-detail "> <a name="method-i-5B-5D-3D"></a> <div class="method-heading"> <span class="method-name">[]=</span><span class="method-args">(key, value)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>shortcut for <a href="http://key">request.params</a> = value</p> <p>Note that modifications will not be persisted in the env. Use <a href="Request.html#method-i-update_param">update_param</a> or <a href="Request.html#method-i-delete_param">delete_param</a> if you want to destructively modify params.</p> <div class="method-source-code" id="5B-5D-3D-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 276</span> <span class="ruby-keyword">def</span> <span class="ruby-operator">[]=</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>) <span class="ruby-identifier">params</span>[<span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">value</span> <span class="ruby-keyword">end</span></pre> </div><!-- 5B-5D-3D-source --> </div> </div><!-- 5B-5D-3D-method --> <div id="accept_encoding-method" class="method-detail "> <a name="method-i-accept_encoding"></a> <div class="method-heading"> <span class="method-name">accept_encoding</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="accept_encoding-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 336</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">accept_encoding</span> <span class="ruby-identifier">parse_http_accept_header</span>(<span class="ruby-ivar">@env</span>[<span class="ruby-string">"HTTP_ACCEPT_ENCODING"</span>]) <span class="ruby-keyword">end</span></pre> </div><!-- accept_encoding-source --> </div> </div><!-- accept_encoding-method --> <div id="accept_language-method" class="method-detail "> <a name="method-i-accept_language"></a> <div class="method-heading"> <span class="method-name">accept_language</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="accept_language-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 340</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">accept_language</span> <span class="ruby-identifier">parse_http_accept_header</span>(<span class="ruby-ivar">@env</span>[<span class="ruby-string">"HTTP_ACCEPT_LANGUAGE"</span>]) <span class="ruby-keyword">end</span></pre> </div><!-- accept_language-source --> </div> </div><!-- accept_language-method --> <div id="base_url-method" class="method-detail "> <a name="method-i-base_url"></a> <div class="method-heading"> <span class="method-name">base_url</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="base_url-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 317</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">base_url</span> <span class="ruby-identifier">url</span> = <span class="ruby-node">"#{scheme}://#{host}"</span> <span class="ruby-identifier">url</span> <span class="ruby-operator"><<</span> <span class="ruby-node">":#{port}"</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">port</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">DEFAULT_PORTS</span>[<span class="ruby-identifier">scheme</span>] <span class="ruby-identifier">url</span> <span class="ruby-keyword">end</span></pre> </div><!-- base_url-source --> </div> </div><!-- base_url-method --> <div id="body-method" class="method-detail "> <a name="method-i-body"></a> <div class="method-heading"> <span class="method-name">body</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="body-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 20</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">body</span>; <span class="ruby-ivar">@env</span>[<span class="ruby-string">"rack.input"</span>] <span class="ruby-keyword">end</span></pre> </div><!-- body-source --> </div> </div><!-- body-method --> <div id="content_charset-method" class="method-detail "> <a name="method-i-content_charset"></a> <div class="method-heading"> <span class="method-name">content_charset</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>The character set of the request body if a "charset" media type parameter was given, or nil if no "charset" was specified. Note that, per RFC2616, text/* media types that specify no explicit charset are to be considered ISO-8859-1.</p> <div class="method-source-code" id="content_charset-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 62</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">content_charset</span> <span class="ruby-identifier">media_type_params</span>[<span class="ruby-string">'charset'</span>] <span class="ruby-keyword">end</span></pre> </div><!-- content_charset-source --> </div> </div><!-- content_charset-method --> <div id="content_length-method" class="method-detail "> <a name="method-i-content_length"></a> <div class="method-heading"> <span class="method-name">content_length</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="content_length-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 25</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">content_length</span>; <span class="ruby-ivar">@env</span>[<span class="ruby-string">'CONTENT_LENGTH'</span>] <span class="ruby-keyword">end</span></pre> </div><!-- content_length-source --> </div> </div><!-- content_length-method --> <div id="content_type-method" class="method-detail "> <a name="method-i-content_type"></a> <div class="method-heading"> <span class="method-name">content_type</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="content_type-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 27</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">content_type</span> <span class="ruby-identifier">content_type</span> = <span class="ruby-ivar">@env</span>[<span class="ruby-string">'CONTENT_TYPE'</span>] <span class="ruby-identifier">content_type</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">content_type</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">?</span> <span class="ruby-keyword">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">content_type</span> <span class="ruby-keyword">end</span></pre> </div><!-- content_type-source --> </div> </div><!-- content_type-method --> <div id="cookies-method" class="method-detail "> <a name="method-i-cookies"></a> <div class="method-heading"> <span class="method-name">cookies</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="cookies-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 295</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">cookies</span> <span class="ruby-identifier">hash</span> = <span class="ruby-ivar">@env</span>[<span class="ruby-string">"rack.request.cookie_hash"</span>] <span class="ruby-operator">||=</span> {} <span class="ruby-identifier">string</span> = <span class="ruby-ivar">@env</span>[<span class="ruby-string">"HTTP_COOKIE"</span>] <span class="ruby-keyword">return</span> <span class="ruby-identifier">hash</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">string</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@env</span>[<span class="ruby-string">"rack.request.cookie_string"</span>] <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">clear</span> <span class="ruby-comment"># According to RFC 2109:</span> <span class="ruby-comment"># If multiple cookies satisfy the criteria above, they are ordered in</span> <span class="ruby-comment"># the Cookie header such that those with more specific Path attributes</span> <span class="ruby-comment"># precede those with less specific. Ordering with respect to other</span> <span class="ruby-comment"># attributes (e.g., Domain) is unspecified.</span> <span class="ruby-identifier">cookies</span> = <span class="ruby-constant">Utils</span>.<span class="ruby-identifier">parse_query</span>(<span class="ruby-identifier">string</span>, <span class="ruby-string">';,'</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Utils</span>.<span class="ruby-identifier">unescape</span>(<span class="ruby-identifier">s</span>) <span class="ruby-keyword">rescue</span> <span class="ruby-identifier">s</span> } <span class="ruby-identifier">cookies</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-constant">Array</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">v</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">v</span> } <span class="ruby-ivar">@env</span>[<span class="ruby-string">"rack.request.cookie_string"</span>] = <span class="ruby-identifier">string</span> <span class="ruby-identifier">hash</span> <span class="ruby-keyword">end</span></pre> </div><!-- cookies-source --> </div> </div><!-- cookies-method --> <div id="delete-3F-method" class="method-detail "> <a name="method-i-delete-3F"></a> <div class="method-heading"> <span class="method-name">delete?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>Checks the HTTP request method (or verb) to see if it was of type DELETE</p> <div class="method-source-code" id="delete-3F-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 116</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">delete?</span>; <span class="ruby-identifier">request_method</span> <span class="ruby-operator">==</span> <span class="ruby-string">"DELETE"</span> <span class="ruby-keyword">end</span></pre> </div><!-- delete-3F-source --> </div> </div><!-- delete-3F-method --> <div id="delete_param-method" class="method-detail "> <a name="method-i-delete_param"></a> <div class="method-heading"> <span class="method-name">delete_param</span><span class="method-args">(k)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>Destructively delete a parameter, whether it's in <a href="Request.html#method-i-GET">GET</a> or <a href="Request.html#method-i-POST">POST</a>. Returns the value of the deleted parameter.</p> <p>If the parameter is in both <a href="Request.html#method-i-GET">GET</a> and <a href="Request.html#method-i-POST">POST</a>, the <a href="Request.html#method-i-POST">POST</a> value takes precedence since that's how <a href="Request.html#method-i-params">params</a> works.</p> <p><a href="http://'rack.input'">env</a> is not touched.</p> <div class="method-source-code" id="delete_param-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 262</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">delete_param</span>(<span class="ruby-identifier">k</span>) <span class="ruby-identifier">v</span> = [ <span class="ruby-keyword">self</span>.<span class="ruby-constant">POST</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">k</span>), <span class="ruby-keyword">self</span>.<span class="ruby-constant">GET</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">k</span>) ].<span class="ruby-identifier">compact</span>.<span class="ruby-identifier">first</span> <span class="ruby-ivar">@params</span> = <span class="ruby-keyword">nil</span> <span class="ruby-identifier">v</span> <span class="ruby-keyword">end</span></pre> </div><!-- delete_param-source --> </div> </div><!-- delete_param-method --> <div id="form_data-3F-method" class="method-detail "> <a name="method-i-form_data-3F"></a> <div class="method-heading"> <span class="method-name">form_data?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>Determine whether the request body contains form-data by checking the request Content-Type for one of the media-types: "application/x-www-form-urlencoded" or "multipart/form-data". The list of form-data media types can be modified through the <tt>FORM_DATA_MEDIA_TYPES</tt> array.</p> <p>A request body is also assumed to contain form-data when no Content-Type header is provided and the <a href="Request.html#method-i-request_method">request_method</a> is <a href="Request.html#method-i-POST">POST</a>.</p> <div class="method-source-code" id="form_data-3F-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 174</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">form_data?</span> <span class="ruby-identifier">type</span> = <span class="ruby-identifier">media_type</span> <span class="ruby-identifier">meth</span> = <span class="ruby-identifier">env</span>[<span class="ruby-string">"rack.methodoverride.original_method"</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">env</span>[<span class="ruby-constant">REQUEST_METHOD</span>] (<span class="ruby-identifier">meth</span> <span class="ruby-operator">==</span> <span class="ruby-string">'POST'</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">nil?</span>) <span class="ruby-operator">||</span> <span class="ruby-constant">FORM_DATA_MEDIA_TYPES</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">type</span>) <span class="ruby-keyword">end</span></pre> </div><!-- form_data-3F-source --> </div> </div><!-- form_data-3F-method --> <div id="fullpath-method" class="method-detail "> <a name="method-i-fullpath"></a> <div class="method-heading"> <span class="method-name">fullpath</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="fullpath-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 332</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">fullpath</span> <span class="ruby-identifier">query_string</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">path</span> <span class="ruby-operator">:</span> <span class="ruby-node">"#{path}?#{query_string}"</span> <span class="ruby-keyword">end</span></pre> </div><!-- fullpath-source --> </div> </div><!-- fullpath-method --> <div id="get-3F-method" class="method-detail "> <a name="method-i-get-3F"></a> <div class="method-heading"> <span class="method-name">get?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>Checks the HTTP request method (or verb) to see if it was of type <a href="Request.html#method-i-GET">GET</a></p> <div class="method-source-code" id="get-3F-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 119</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">get?</span>; <span class="ruby-identifier">request_method</span> <span class="ruby-operator">==</span> <span class="ruby-constant">GET</span> <span class="ruby-keyword">end</span></pre> </div><!-- get-3F-source --> </div> </div><!-- get-3F-method --> <div id="head-3F-method" class="method-detail "> <a name="method-i-head-3F"></a> <div class="method-heading"> <span class="method-name">head?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>Checks the HTTP request method (or verb) to see if it was of type HEAD</p> <div class="method-source-code" id="head-3F-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 122</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">head?</span>; <span class="ruby-identifier">request_method</span> <span class="ruby-operator">==</span> <span class="ruby-constant">HEAD</span> <span class="ruby-keyword">end</span></pre> </div><!-- head-3F-source --> </div> </div><!-- head-3F-method --> <div id="host-method" class="method-detail "> <a name="method-i-host"></a> <div class="method-heading"> <span class="method-name">host</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="host-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 106</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">host</span> <span class="ruby-comment"># Remove port number.</span> <span class="ruby-identifier">host_with_port</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/:\d+\z/</span>, <span class="ruby-string">''</span>) <span class="ruby-keyword">end</span></pre> </div><!-- host-source --> </div> </div><!-- host-method --> <div id="host_with_port-method" class="method-detail "> <a name="method-i-host_with_port"></a> <div class="method-heading"> <span class="method-name">host_with_port</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="host_with_port-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 84</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">host_with_port</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">forwarded</span> = <span class="ruby-ivar">@env</span>[<span class="ruby-string">"HTTP_X_FORWARDED_HOST"</span>] <span class="ruby-identifier">forwarded</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/,\s?/</span>).<span class="ruby-identifier">last</span> <span class="ruby-keyword">else</span> <span class="ruby-ivar">@env</span>[<span class="ruby-string">'HTTP_HOST'</span>] <span class="ruby-operator">||</span> <span class="ruby-node">"#{@env['SERVER_NAME'] || @env['SERVER_ADDR']}:#{@env['SERVER_PORT']}"</span> <span class="ruby-keyword">end</span> <span class="ruby-keyword">end</span></pre> </div><!-- host_with_port-source --> </div> </div><!-- host_with_port-method --> <div id="ip-method" class="method-detail "> <a name="method-i-ip"></a> <div class="method-heading"> <span class="method-name">ip</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="ip-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 348</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">ip</span> <span class="ruby-identifier">remote_addrs</span> = <span class="ruby-identifier">split_ip_addresses</span>(<span class="ruby-ivar">@env</span>[<span class="ruby-string">'REMOTE_ADDR'</span>]) <span class="ruby-identifier">remote_addrs</span> = <span class="ruby-identifier">reject_trusted_ip_addresses</span>(<span class="ruby-identifier">remote_addrs</span>) <span class="ruby-keyword">return</span> <span class="ruby-identifier">remote_addrs</span>.<span class="ruby-identifier">first</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">remote_addrs</span>.<span class="ruby-identifier">any?</span> <span class="ruby-identifier">forwarded_ips</span> = <span class="ruby-identifier">split_ip_addresses</span>(<span class="ruby-ivar">@env</span>[<span class="ruby-string">'HTTP_X_FORWARDED_FOR'</span>]) <span class="ruby-keyword">return</span> <span class="ruby-identifier">reject_trusted_ip_addresses</span>(<span class="ruby-identifier">forwarded_ips</span>).<span class="ruby-identifier">last</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@env</span>[<span class="ruby-string">"REMOTE_ADDR"</span>] <span class="ruby-keyword">end</span></pre> </div><!-- ip-source --> </div> </div><!-- ip-method --> <div id="link-3F-method" class="method-detail "> <a name="method-i-link-3F"></a> <div class="method-heading"> <span class="method-name">link?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>Checks the HTTP request method (or verb) to see if it was of type LINK</p> <div class="method-source-code" id="link-3F-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 128</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">link?</span>; <span class="ruby-identifier">request_method</span> <span class="ruby-operator">==</span> <span class="ruby-string">"LINK"</span> <span class="ruby-keyword">end</span></pre> </div><!-- link-3F-source --> </div> </div><!-- link-3F-method --> <div id="logger-method" class="method-detail "> <a name="method-i-logger"></a> <div class="method-heading"> <span class="method-name">logger</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="logger-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 34</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">logger</span>; <span class="ruby-ivar">@env</span>[<span class="ruby-string">'rack.logger'</span>] <span class="ruby-keyword">end</span></pre> </div><!-- logger-source --> </div> </div><!-- logger-method --> <div id="media_type-method" class="method-detail "> <a name="method-i-media_type"></a> <div class="method-heading"> <span class="method-name">media_type</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>The media type (type/subtype) portion of the CONTENT_TYPE header without any media type parameters. e.g., when CONTENT_TYPE is "text/plain;charset=utf-8", the media-type is "text/plain".</p> <p>For more information on the use of media types in HTTP, see: <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7">www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7</a></p> <div class="method-source-code" id="media_type-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 42</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">media_type</span> <span class="ruby-identifier">content_type</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">content_type</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\s*[;,]\s*/</span>, <span class="ruby-value">2</span>).<span class="ruby-identifier">first</span>.<span class="ruby-identifier">downcase</span> <span class="ruby-keyword">end</span></pre> </div><!-- media_type-source --> </div> </div><!-- media_type-method --> <div id="media_type_params-method" class="method-detail "> <a name="method-i-media_type_params"></a> <div class="method-heading"> <span class="method-name">media_type_params</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>The media type parameters provided in CONTENT_TYPE as a Hash, or an empty Hash if no CONTENT_TYPE or media-type parameters were provided. e.g., when the CONTENT_TYPE is "text/plain;charset=utf-8", this method responds with the following Hash:</p> <pre>{ 'charset' => 'utf-8' }</pre> <div class="method-source-code" id="media_type_params-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 51</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">media_type_params</span> <span class="ruby-keyword">return</span> {} <span class="ruby-keyword">if</span> <span class="ruby-identifier">content_type</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-constant">Hash</span>[*<span class="ruby-identifier">content_type</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\s*[;,]\s*/</span>)[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]. <span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">'='</span>, <span class="ruby-value">2</span>) }. <span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> [<span class="ruby-identifier">k</span>.<span class="ruby-identifier">downcase</span>, <span class="ruby-identifier">strip_doublequotes</span>(<span class="ruby-identifier">v</span>)] }.<span class="ruby-identifier">flatten</span>] <span class="ruby-keyword">end</span></pre> </div><!-- media_type_params-source --> </div> </div><!-- media_type_params-method --> <div id="options-3F-method" class="method-detail "> <a name="method-i-options-3F"></a> <div class="method-heading"> <span class="method-name">options?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>Checks the HTTP request method (or verb) to see if it was of type OPTIONS</p> <div class="method-source-code" id="options-3F-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 125</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">options?</span>; <span class="ruby-identifier">request_method</span> <span class="ruby-operator">==</span> <span class="ruby-string">"OPTIONS"</span> <span class="ruby-keyword">end</span></pre> </div><!-- options-3F-source --> </div> </div><!-- options-3F-method --> <div id="params-method" class="method-detail "> <a name="method-i-params"></a> <div class="method-heading"> <span class="method-name">params</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>The union of <a href="Request.html#method-i-GET">GET</a> and <a href="Request.html#method-i-POST">POST</a> data.</p> <p>Note that modifications will not be persisted in the env. Use <a href="Request.html#method-i-update_param">update_param</a> or <a href="Request.html#method-i-delete_param">delete_param</a> if you want to destructively modify params.</p> <div class="method-source-code" id="params-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 229</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">params</span> <span class="ruby-ivar">@params</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">self</span>.<span class="ruby-constant">GET</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-keyword">self</span>.<span class="ruby-constant">POST</span>) <span class="ruby-keyword">rescue</span> <span class="ruby-constant">EOFError</span> <span class="ruby-keyword">self</span>.<span class="ruby-constant">GET</span>.<span class="ruby-identifier">dup</span> <span class="ruby-keyword">end</span></pre> </div><!-- params-source --> </div> </div><!-- params-method --> <div id="parseable_data-3F-method" class="method-detail "> <a name="method-i-parseable_data-3F"></a> <div class="method-heading"> <span class="method-name">parseable_data?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>Determine whether the request body contains data by checking the request <a href="Request.html#method-i-media_type">media_type</a> against registered parse-data media-types</p> <div class="method-source-code" id="parseable_data-3F-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 182</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">parseable_data?</span> <span class="ruby-constant">PARSEABLE_DATA_MEDIA_TYPES</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">media_type</span>) <span class="ruby-keyword">end</span></pre> </div><!-- parseable_data-3F-source --> </div> </div><!-- parseable_data-3F-method --> <div id="patch-3F-method" class="method-detail "> <a name="method-i-patch-3F"></a> <div class="method-heading"> <span class="method-name">patch?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>Checks the HTTP request method (or verb) to see if it was of type PATCH</p> <div class="method-source-code" id="patch-3F-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 131</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">patch?</span>; <span class="ruby-identifier">request_method</span> <span class="ruby-operator">==</span> <span class="ruby-string">"PATCH"</span> <span class="ruby-keyword">end</span></pre> </div><!-- patch-3F-source --> </div> </div><!-- patch-3F-method --> <div id="path-method" class="method-detail "> <a name="method-i-path"></a> <div class="method-heading"> <span class="method-name">path</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="path-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 328</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">path</span> <span class="ruby-identifier">script_name</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">path_info</span> <span class="ruby-keyword">end</span></pre> </div><!-- path-source --> </div> </div><!-- path-method --> <div id="path_info-method" class="method-detail "> <a name="method-i-path_info"></a> <div class="method-heading"> <span class="method-name">path_info</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="path_info-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 22</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">path_info</span>; <span class="ruby-ivar">@env</span>[<span class="ruby-constant">PATH_INFO</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-keyword">end</span></pre> </div><!-- path_info-source --> </div> </div><!-- path_info-method --> <div id="path_info-3D-method" class="method-detail "> <a name="method-i-path_info-3D"></a> <div class="method-heading"> <span class="method-name">path_info=</span><span class="method-args">(s)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="path_info-3D-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 112</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">path_info=</span>(<span class="ruby-identifier">s</span>); <span class="ruby-ivar">@env</span>[<span class="ruby-string">"PATH_INFO"</span>] = <span class="ruby-identifier">s</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-keyword">end</span></pre> </div><!-- path_info-3D-source --> </div> </div><!-- path_info-3D-method --> <div id="port-method" class="method-detail "> <a name="method-i-port"></a> <div class="method-heading"> <span class="method-name">port</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="port-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 92</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">port</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">port</span> = <span class="ruby-identifier">host_with_port</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/:/</span>)[<span class="ruby-value">1</span>] <span class="ruby-identifier">port</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">port</span> = <span class="ruby-ivar">@env</span>[<span class="ruby-string">'HTTP_X_FORWARDED_PORT'</span>] <span class="ruby-identifier">port</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-keyword">elsif</span> <span class="ruby-ivar">@env</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-string">"HTTP_X_FORWARDED_HOST"</span>) <span class="ruby-constant">DEFAULT_PORTS</span>[<span class="ruby-identifier">scheme</span>] <span class="ruby-keyword">elsif</span> <span class="ruby-ivar">@env</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-string">"HTTP_X_FORWARDED_PROTO"</span>) <span class="ruby-constant">DEFAULT_PORTS</span>[<span class="ruby-ivar">@env</span>[<span class="ruby-string">'HTTP_X_FORWARDED_PROTO'</span>].<span class="ruby-identifier">split</span>(<span class="ruby-string">','</span>)[<span class="ruby-value">0</span>]] <span class="ruby-keyword">else</span> <span class="ruby-ivar">@env</span>[<span class="ruby-string">"SERVER_PORT"</span>].<span class="ruby-identifier">to_i</span> <span class="ruby-keyword">end</span> <span class="ruby-keyword">end</span></pre> </div><!-- port-source --> </div> </div><!-- port-method --> <div id="post-3F-method" class="method-detail "> <a name="method-i-post-3F"></a> <div class="method-heading"> <span class="method-name">post?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>Checks the HTTP request method (or verb) to see if it was of type <a href="Request.html#method-i-POST">POST</a></p> <div class="method-source-code" id="post-3F-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 134</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">post?</span>; <span class="ruby-identifier">request_method</span> <span class="ruby-operator">==</span> <span class="ruby-string">"POST"</span> <span class="ruby-keyword">end</span></pre> </div><!-- post-3F-source --> </div> </div><!-- post-3F-method --> <div id="put-3F-method" class="method-detail "> <a name="method-i-put-3F"></a> <div class="method-heading"> <span class="method-name">put?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>Checks the HTTP request method (or verb) to see if it was of type PUT</p> <div class="method-source-code" id="put-3F-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 137</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">put?</span>; <span class="ruby-identifier">request_method</span> <span class="ruby-operator">==</span> <span class="ruby-string">"PUT"</span> <span class="ruby-keyword">end</span></pre> </div><!-- put-3F-source --> </div> </div><!-- put-3F-method --> <div id="query_string-method" class="method-detail "> <a name="method-i-query_string"></a> <div class="method-heading"> <span class="method-name">query_string</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="query_string-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 24</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">query_string</span>; <span class="ruby-ivar">@env</span>[<span class="ruby-constant">QUERY_STRING</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-keyword">end</span></pre> </div><!-- query_string-source --> </div> </div><!-- query_string-method --> <div id="referer-method" class="method-detail "> <a name="method-i-referer"></a> <div class="method-heading"> <span class="method-name">referer</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>the referer of the client</p> <div class="method-source-code" id="referer-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 286</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">referer</span> <span class="ruby-ivar">@env</span>[<span class="ruby-string">'HTTP_REFERER'</span>] <span class="ruby-keyword">end</span></pre> </div><!-- referer-source --> </div> <div class="aliases"> Also aliased as: <a href="Request.html#method-i-referrer">referrer</a> </div> </div><!-- referer-method --> <div id="referrer-method" class="method-detail method-alias"> <a name="method-i-referrer"></a> <div class="method-heading"> <span class="method-name">referrer</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> </div> <div class="aliases"> Alias for: <a href="Request.html#method-i-referer">referer</a> </div> </div><!-- referrer-method --> <div id="request_method-method" class="method-detail "> <a name="method-i-request_method"></a> <div class="method-heading"> <span class="method-name">request_method</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="request_method-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 23</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">request_method</span>; <span class="ruby-ivar">@env</span>[<span class="ruby-string">"REQUEST_METHOD"</span>] <span class="ruby-keyword">end</span></pre> </div><!-- request_method-source --> </div> </div><!-- request_method-method --> <div id="scheme-method" class="method-detail "> <a name="method-i-scheme"></a> <div class="method-heading"> <span class="method-name">scheme</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="scheme-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 66</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">scheme</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@env</span>[<span class="ruby-string">'HTTPS'</span>] <span class="ruby-operator">==</span> <span class="ruby-string">'on'</span> <span class="ruby-string">'https'</span> <span class="ruby-keyword">elsif</span> <span class="ruby-ivar">@env</span>[<span class="ruby-string">'HTTP_X_FORWARDED_SSL'</span>] <span class="ruby-operator">==</span> <span class="ruby-string">'on'</span> <span class="ruby-string">'https'</span> <span class="ruby-keyword">elsif</span> <span class="ruby-ivar">@env</span>[<span class="ruby-string">'HTTP_X_FORWARDED_SCHEME'</span>] <span class="ruby-ivar">@env</span>[<span class="ruby-string">'HTTP_X_FORWARDED_SCHEME'</span>] <span class="ruby-keyword">elsif</span> <span class="ruby-ivar">@env</span>[<span class="ruby-string">'HTTP_X_FORWARDED_PROTO'</span>] <span class="ruby-ivar">@env</span>[<span class="ruby-string">'HTTP_X_FORWARDED_PROTO'</span>].<span class="ruby-identifier">split</span>(<span class="ruby-string">','</span>)[<span class="ruby-value">0</span>] <span class="ruby-keyword">else</span> <span class="ruby-ivar">@env</span>[<span class="ruby-string">"rack.url_scheme"</span>] <span class="ruby-keyword">end</span> <span class="ruby-keyword">end</span></pre> </div><!-- scheme-source --> </div> </div><!-- scheme-method --> <div id="script_name-method" class="method-detail "> <a name="method-i-script_name"></a> <div class="method-heading"> <span class="method-name">script_name</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="script_name-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 21</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">script_name</span>; <span class="ruby-ivar">@env</span>[<span class="ruby-constant">SCRIPT_NAME</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-keyword">end</span></pre> </div><!-- script_name-source --> </div> </div><!-- script_name-method --> <div id="script_name-3D-method" class="method-detail "> <a name="method-i-script_name-3D"></a> <div class="method-heading"> <span class="method-name">script_name=</span><span class="method-args">(s)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="script_name-3D-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 111</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">script_name=</span>(<span class="ruby-identifier">s</span>); <span class="ruby-ivar">@env</span>[<span class="ruby-string">"SCRIPT_NAME"</span>] = <span class="ruby-identifier">s</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-keyword">end</span></pre> </div><!-- script_name-3D-source --> </div> </div><!-- script_name-3D-method --> <div id="session-method" class="method-detail "> <a name="method-i-session"></a> <div class="method-heading"> <span class="method-name">session</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="session-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 32</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">session</span>; <span class="ruby-ivar">@env</span>[<span class="ruby-string">'rack.session'</span>] <span class="ruby-operator">||=</span> {} <span class="ruby-keyword">end</span></pre> </div><!-- session-source --> </div> </div><!-- session-method --> <div id="session_options-method" class="method-detail "> <a name="method-i-session_options"></a> <div class="method-heading"> <span class="method-name">session_options</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="session_options-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 33</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">session_options</span>; <span class="ruby-ivar">@env</span>[<span class="ruby-string">'rack.session.options'</span>] <span class="ruby-operator">||=</span> {} <span class="ruby-keyword">end</span></pre> </div><!-- session_options-source --> </div> </div><!-- session_options-method --> <div id="ssl-3F-method" class="method-detail "> <a name="method-i-ssl-3F"></a> <div class="method-heading"> <span class="method-name">ssl?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="ssl-3F-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 80</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">ssl?</span> <span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-string">'https'</span> <span class="ruby-keyword">end</span></pre> </div><!-- ssl-3F-source --> </div> </div><!-- ssl-3F-method --> <div id="trace-3F-method" class="method-detail "> <a name="method-i-trace-3F"></a> <div class="method-heading"> <span class="method-name">trace?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>Checks the HTTP request method (or verb) to see if it was of type TRACE</p> <div class="method-source-code" id="trace-3F-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 140</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">trace?</span>; <span class="ruby-identifier">request_method</span> <span class="ruby-operator">==</span> <span class="ruby-string">"TRACE"</span> <span class="ruby-keyword">end</span></pre> </div><!-- trace-3F-source --> </div> </div><!-- trace-3F-method --> <div id="trusted_proxy-3F-method" class="method-detail "> <a name="method-i-trusted_proxy-3F"></a> <div class="method-heading"> <span class="method-name">trusted_proxy?</span><span class="method-args">(ip)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="trusted_proxy-3F-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 344</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">trusted_proxy?</span>(<span class="ruby-identifier">ip</span>) <span class="ruby-identifier">ip</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/\A127\.0\.0\.1\Z|\A(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.|\A::1\Z|\Afd[0-9a-f]{2}:.+|\Alocalhost\Z|\Aunix\Z|\Aunix:/</span> <span class="ruby-keyword">end</span></pre> </div><!-- trusted_proxy-3F-source --> </div> </div><!-- trusted_proxy-3F-method --> <div id="unlink-3F-method" class="method-detail "> <a name="method-i-unlink-3F"></a> <div class="method-heading"> <span class="method-name">unlink?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>Checks the HTTP request method (or verb) to see if it was of type UNLINK</p> <div class="method-source-code" id="unlink-3F-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 143</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">unlink?</span>; <span class="ruby-identifier">request_method</span> <span class="ruby-operator">==</span> <span class="ruby-string">"UNLINK"</span> <span class="ruby-keyword">end</span></pre> </div><!-- unlink-3F-source --> </div> </div><!-- unlink-3F-method --> <div id="update_param-method" class="method-detail "> <a name="method-i-update_param"></a> <div class="method-heading"> <span class="method-name">update_param</span><span class="method-args">(k, v)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>Destructively update a parameter, whether it's in <a href="Request.html#method-i-GET">GET</a> and/or <a href="Request.html#method-i-POST">POST</a>. Returns nil.</p> <p>The parameter is updated wherever it was previous defined, so <a href="Request.html#method-i-GET">GET</a>, <a href="Request.html#method-i-POST">POST</a>, or both. If it wasn't previously defined, it's inserted into <a href="Request.html#method-i-GET">GET</a>.</p> <p><a href="http://'rack.input'">env</a> is not touched.</p> <div class="method-source-code" id="update_param-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 240</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">update_param</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span>) <span class="ruby-identifier">found</span> = <span class="ruby-keyword">false</span> <span class="ruby-keyword">if</span> <span class="ruby-keyword">self</span>.<span class="ruby-constant">GET</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">k</span>) <span class="ruby-identifier">found</span> = <span class="ruby-keyword">true</span> <span class="ruby-keyword">self</span>.<span class="ruby-constant">GET</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span> <span class="ruby-keyword">end</span> <span class="ruby-keyword">if</span> <span class="ruby-keyword">self</span>.<span class="ruby-constant">POST</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">k</span>) <span class="ruby-identifier">found</span> = <span class="ruby-keyword">true</span> <span class="ruby-keyword">self</span>.<span class="ruby-constant">POST</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span> <span class="ruby-keyword">end</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">found</span> <span class="ruby-keyword">self</span>.<span class="ruby-constant">GET</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span> <span class="ruby-keyword">end</span> <span class="ruby-ivar">@params</span> = <span class="ruby-keyword">nil</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">end</span></pre> </div><!-- update_param-source --> </div> </div><!-- update_param-method --> <div id="url-method" class="method-detail "> <a name="method-i-url"></a> <div class="method-heading"> <span class="method-name">url</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>Tries to return a remake of the original request URL as a string.</p> <div class="method-source-code" id="url-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 324</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">url</span> <span class="ruby-identifier">base_url</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">fullpath</span> <span class="ruby-keyword">end</span></pre> </div><!-- url-source --> </div> </div><!-- url-method --> <div id="user_agent-method" class="method-detail "> <a name="method-i-user_agent"></a> <div class="method-heading"> <span class="method-name">user_agent</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="user_agent-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 291</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">user_agent</span> <span class="ruby-ivar">@env</span>[<span class="ruby-string">'HTTP_USER_AGENT'</span>] <span class="ruby-keyword">end</span></pre> </div><!-- user_agent-source --> </div> </div><!-- user_agent-method --> <div id="values_at-method" class="method-detail "> <a name="method-i-values_at"></a> <div class="method-heading"> <span class="method-name">values_at</span><span class="method-args">(*keys)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p>like Hash#values_at</p> <div class="method-source-code" id="values_at-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 281</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">values_at</span>(*<span class="ruby-identifier">keys</span>) <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">key</span>] } <span class="ruby-keyword">end</span></pre> </div><!-- values_at-source --> </div> </div><!-- values_at-method --> <div id="xhr-3F-method" class="method-detail "> <a name="method-i-xhr-3F"></a> <div class="method-heading"> <span class="method-name">xhr?</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="xhr-3F-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 313</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">xhr?</span> <span class="ruby-ivar">@env</span>[<span class="ruby-string">"HTTP_X_REQUESTED_WITH"</span>] <span class="ruby-operator">==</span> <span class="ruby-string">"XMLHttpRequest"</span> <span class="ruby-keyword">end</span></pre> </div><!-- xhr-3F-source --> </div> </div><!-- xhr-3F-method --> </div><!-- public-instance-method-details --> <div id="protected-instance-method-details" class="method-section section"> <h3 class="section-header">Protected Instance Methods</h3> <div id="parse_http_accept_header-method" class="method-detail "> <a name="method-i-parse_http_accept_header"></a> <div class="method-heading"> <span class="method-name">parse_http_accept_header</span><span class="method-args">(header)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="parse_http_accept_header-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 378</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">parse_http_accept_header</span>(<span class="ruby-identifier">header</span>) <span class="ruby-identifier">header</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\s*,\s*/</span>).<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">part</span><span class="ruby-operator">|</span> <span class="ruby-identifier">attribute</span>, <span class="ruby-identifier">parameters</span> = <span class="ruby-identifier">part</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\s*;\s*/</span>, <span class="ruby-value">2</span>) <span class="ruby-identifier">quality</span> = <span class="ruby-value">1.0</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">parameters</span> <span class="ruby-keyword">and</span> <span class="ruby-regexp">/\Aq=([\d.]+)/</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">parameters</span> <span class="ruby-identifier">quality</span> = <span class="ruby-node">$1</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-keyword">end</span> [<span class="ruby-identifier">attribute</span>, <span class="ruby-identifier">quality</span>] <span class="ruby-keyword">end</span> <span class="ruby-keyword">end</span></pre> </div><!-- parse_http_accept_header-source --> </div> </div><!-- parse_http_accept_header-method --> <div id="parse_multipart-method" class="method-detail "> <a name="method-i-parse_multipart"></a> <div class="method-heading"> <span class="method-name">parse_multipart</span><span class="method-args">(env)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="parse_multipart-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 374</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">parse_multipart</span>(<span class="ruby-identifier">env</span>) <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Multipart</span>.<span class="ruby-identifier">parse_multipart</span>(<span class="ruby-identifier">env</span>) <span class="ruby-keyword">end</span></pre> </div><!-- parse_multipart-source --> </div> </div><!-- parse_multipart-method --> <div id="parse_query-method" class="method-detail "> <a name="method-i-parse_query"></a> <div class="method-heading"> <span class="method-name">parse_query</span><span class="method-args">(qs)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="parse_query-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 368</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">parse_query</span>(<span class="ruby-identifier">qs</span>) <span class="ruby-identifier">d</span> = <span class="ruby-string">'&'</span> <span class="ruby-identifier">qs</span>, <span class="ruby-identifier">d</span> = <span class="ruby-identifier">qs</span>[<span class="ruby-value">:query</span>], <span class="ruby-identifier">qs</span>[<span class="ruby-value">:separator</span>] <span class="ruby-keyword">if</span> <span class="ruby-constant">Hash</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">qs</span> <span class="ruby-constant">Utils</span>.<span class="ruby-identifier">parse_nested_query</span>(<span class="ruby-identifier">qs</span>, <span class="ruby-identifier">d</span>) <span class="ruby-keyword">end</span></pre> </div><!-- parse_query-source --> </div> </div><!-- parse_query-method --> <div id="reject_trusted_ip_addresses-method" class="method-detail "> <a name="method-i-reject_trusted_ip_addresses"></a> <div class="method-heading"> <span class="method-name">reject_trusted_ip_addresses</span><span class="method-args">(ip_addresses)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="reject_trusted_ip_addresses-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 364</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">reject_trusted_ip_addresses</span>(<span class="ruby-identifier">ip_addresses</span>) <span class="ruby-identifier">ip_addresses</span>.<span class="ruby-identifier">reject</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">ip</span><span class="ruby-operator">|</span> <span class="ruby-identifier">trusted_proxy?</span>(<span class="ruby-identifier">ip</span>) } <span class="ruby-keyword">end</span></pre> </div><!-- reject_trusted_ip_addresses-source --> </div> </div><!-- reject_trusted_ip_addresses-method --> <div id="split_ip_addresses-method" class="method-detail "> <a name="method-i-split_ip_addresses"></a> <div class="method-heading"> <span class="method-name">split_ip_addresses</span><span class="method-args">(ip_addresses)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="split_ip_addresses-source"> <pre> <span class="ruby-comment"># File lib/rack/request.rb, line 360</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">split_ip_addresses</span>(<span class="ruby-identifier">ip_addresses</span>) <span class="ruby-identifier">ip_addresses</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">ip_addresses</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/[,\s]+/</span>) <span class="ruby-operator">:</span> [] <span class="ruby-keyword">end</span></pre> </div><!-- split_ip_addresses-source --> </div> </div><!-- split_ip_addresses-method --> </div><!-- protected-instance-method-details --> </div><!-- 5Buntitled-5D --> </div><!-- documentation --> <div id="validator-badges"> <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 2</small>.</p> </div> </body> </html>