$16 GRAYBYTE WORDPRESS FILE MANAGER $23

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.157
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/cpanel/ea-ruby27/root/usr/share/gems/doc/rack-2.2.22/rdoc/Rack/

HOME
Current File : /opt/cpanel/ea-ruby27/root/usr/share/gems/doc/rack-2.2.22/rdoc/Rack//Events.html
<!DOCTYPE html>

<html>
<head>
<meta charset="UTF-8">

<title>class Rack::Events - rack-2.2.22 Documentation</title>

<script type="text/javascript">
  var rdoc_rel_prefix = "../";
  var index_rel_prefix = "../";
</script>

<script src="../js/navigation.js" defer></script>
<script src="../js/search.js" defer></script>
<script src="../js/search_index.js" defer></script>
<script src="../js/searcher.js" defer></script>
<script src="../js/darkfish.js" defer></script>

<link href="../css/fonts.css" rel="stylesheet">
<link href="../css/rdoc.css" rel="stylesheet">




<body id="top" role="document" class="class">
<nav role="navigation">
  <div id="project-navigation">
    <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2>
    <a href="../index.html" rel="home">Home</a>
  </h2>

  <div id="table-of-contents-navigation">
    <a href="../table_of_contents.html#pages">Pages</a>
    <a href="../table_of_contents.html#classes">Classes</a>
    <a href="../table_of_contents.html#methods">Methods</a>
  </div>
</div>

    <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

  </div>

  

  <div id="class-metadata">
    
    <div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  
  <p class="link">Object
  
</div>

    
    
    <!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    
    <li ><a href="#method-c-new">::new</a>
    
    <li ><a href="#method-i-call">#call</a>
    
    <li ><a href="#method-i-make_request">#make_request</a>
    
    <li ><a href="#method-i-make_response">#make_response</a>
    
    <li ><a href="#method-i-on_commit">#on_commit</a>
    
    <li ><a href="#method-i-on_error">#on_error</a>
    
    <li ><a href="#method-i-on_finish">#on_finish</a>
    
    <li ><a href="#method-i-on_start">#on_start</a>
    
  </ul>
</div>

  </div>
</nav>

<main role="main" aria-labelledby="class-Rack::Events">
  <h1 id="class-Rack::Events" class="class">
    class Rack::Events
  </h1>

  <section class="description">
    
<pre>This middleware provides hooks to certain places in the request /</pre>

<p>response lifecycle.  This is so that middleware that don&#39;t need to filter the response data can safely leave it alone and not have to send messages down the traditional “rack stack”.</p>

<p>The events are:</p>
<ul><li>
<p><a href="Events.html#method-i-on_start"><code>on_start</code></a>(request, response)</p>

<p>This event is sent at the start of the request, before the next middleware in the chain is called.  This method is called with a request object, and a response object.  Right now, the response object is always nil, but in the future it may actually be a real response object.</p>
</li><li>
<p><a href="Events.html#method-i-on_commit"><code>on_commit</code></a>(request, response)</p>

<p>The response has been committed.  The application has returned, but the response has not been sent to the webserver yet.  This method is always called with a request object and the response object.  The response object is constructed from the rack triple that the application returned. Changes may still be made to the response object at this point.</p>
</li><li>
<p>on_send(request, response)</p>

<p>The webserver has started iterating over the response body and presumably has started sending data over the wire. This method is always called with a request object and the response object.  The response object is constructed from the rack triple that the application returned.  Changes SHOULD NOT be made to the response object as the webserver has already started sending data.  Any mutations will likely result in an exception.</p>
</li><li>
<p><a href="Events.html#method-i-on_finish"><code>on_finish</code></a>(request, response)</p>

<p>The webserver has closed the response, and all data has been written to the response socket.  The request and response object should both be read-only at this point.  The body MAY NOT be available on the response object as it may have been flushed to the socket.</p>
</li><li>
<p><a href="Events.html#method-i-on_error"><code>on_error</code></a>(request, response, error)</p>

<p>An exception has occurred in the application or an `on_commit` event. This method will get the request, the response (if available) and the exception that was raised.</p>
</li></ul>

<p>## Order</p>

<p>`on_start` is called on the handlers in the order that they were passed to the constructor.  `on_commit`, on_send`, `on_finish`, and `on_error` are called in the reverse order.  `on_finish` handlers are called inside an `ensure` block, so they are guaranteed to be called even if something raises an exception.  If something raises an exception in a `on_finish` method, then nothing is guaranteed.</p>

  </section>

  
  <section id="5Buntitled-5D" class="documentation-section">
    

    

    

    

    
     <section id="public-class-5Buntitled-5D-method-details" class="method-section">
       <header>
         <h3>Public Class Methods</h3>
       </header>

    
      <div id="method-c-new" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">new</span><span
            class="method-args">(app, handlers)</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/events.rb, line 102</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">app</span>, <span class="ruby-identifier">handlers</span>)
  <span class="ruby-ivar">@app</span>      = <span class="ruby-identifier">app</span>
  <span class="ruby-ivar">@handlers</span> = <span class="ruby-identifier">handlers</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
    </section>
  
     <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
       <header>
         <h3>Public Instance Methods</h3>
       </header>

    
      <div id="method-i-call" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">call</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="call-source">
            <pre><span class="ruby-comment"># File lib/rack/events.rb, line 107</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">call</span>(<span class="ruby-identifier">env</span>)
  <span class="ruby-identifier">request</span> = <span class="ruby-identifier">make_request</span> <span class="ruby-identifier">env</span>
  <span class="ruby-identifier">on_start</span> <span class="ruby-identifier">request</span>, <span class="ruby-keyword">nil</span>

  <span class="ruby-keyword">begin</span>
    <span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span> = <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">env</span>
    <span class="ruby-identifier">response</span> = <span class="ruby-identifier">make_response</span> <span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span>
    <span class="ruby-identifier">on_commit</span> <span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>
  <span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">e</span>
    <span class="ruby-identifier">on_error</span> <span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>, <span class="ruby-identifier">e</span>
    <span class="ruby-identifier">on_finish</span> <span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>
    <span class="ruby-identifier">raise</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">body</span> = <span class="ruby-constant">EventedBodyProxy</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">body</span>, <span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>, <span class="ruby-ivar">@handlers</span>) <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">on_finish</span> <span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>
  <span class="ruby-keyword">end</span>
  [<span class="ruby-identifier">response</span>.<span class="ruby-identifier">status</span>, <span class="ruby-identifier">response</span>.<span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span>]
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
    </section>
  
     <section id="private-instance-5Buntitled-5D-method-details" class="method-section">
       <header>
         <h3>Private Instance Methods</h3>
       </header>

    
      <div id="method-i-make_request" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">make_request</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="make_request-source">
            <pre><span class="ruby-comment"># File lib/rack/events.rb, line 145</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">make_request</span>(<span class="ruby-identifier">env</span>)
  <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">env</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-make_response" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">make_response</span><span
            class="method-args">(status, headers, body)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="make_response-source">
            <pre><span class="ruby-comment"># File lib/rack/events.rb, line 149</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">make_response</span>(<span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span>)
  <span class="ruby-constant">BufferedResponse</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-on_commit" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">on_commit</span><span
            class="method-args">(request, response)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="on_commit-source">
            <pre><span class="ruby-comment"># File lib/rack/events.rb, line 133</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">on_commit</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>)
  <span class="ruby-ivar">@handlers</span>.<span class="ruby-identifier">reverse_each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">handler</span><span class="ruby-operator">|</span> <span class="ruby-identifier">handler</span>.<span class="ruby-identifier">on_commit</span> <span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span> }
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-on_error" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">on_error</span><span
            class="method-args">(request, response, e)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="on_error-source">
            <pre><span class="ruby-comment"># File lib/rack/events.rb, line 129</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">on_error</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>, <span class="ruby-identifier">e</span>)
  <span class="ruby-ivar">@handlers</span>.<span class="ruby-identifier">reverse_each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">handler</span><span class="ruby-operator">|</span> <span class="ruby-identifier">handler</span>.<span class="ruby-identifier">on_error</span> <span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>, <span class="ruby-identifier">e</span> }
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-on_finish" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">on_finish</span><span
            class="method-args">(request, response)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="on_finish-source">
            <pre><span class="ruby-comment"># File lib/rack/events.rb, line 141</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">on_finish</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>)
  <span class="ruby-ivar">@handlers</span>.<span class="ruby-identifier">reverse_each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">handler</span><span class="ruby-operator">|</span> <span class="ruby-identifier">handler</span>.<span class="ruby-identifier">on_finish</span> <span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span> }
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-on_start" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">on_start</span><span
            class="method-args">(request, response)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="on_start-source">
            <pre><span class="ruby-comment"># File lib/rack/events.rb, line 137</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">on_start</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>)
  <span class="ruby-ivar">@handlers</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">handler</span><span class="ruby-operator">|</span> <span class="ruby-identifier">handler</span>.<span class="ruby-identifier">on_start</span> <span class="ruby-identifier">request</span>, <span class="ruby-keyword">nil</span> }
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
    </section>
  
  </section>

</main>


<footer id="validator-badges" role="contentinfo">
  <p><a href="https://validator.w3.org/check/referer">Validate</a>
  <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.1.1.
  <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
</footer>



Current_dir [ NOT WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
14 Mar 2026 8.32 AM
root / root
0755
Auth
--
14 Mar 2026 8.32 AM
root / root
0755
Chunked
--
14 Mar 2026 8.32 AM
root / root
0755
Deflater
--
14 Mar 2026 8.32 AM
root / root
0755
Directory
--
14 Mar 2026 8.32 AM
root / root
0755
Events
--
14 Mar 2026 8.32 AM
root / root
0755
Files
--
14 Mar 2026 8.32 AM
root / root
0755
Handler
--
14 Mar 2026 8.32 AM
root / root
0755
Lint
--
14 Mar 2026 8.32 AM
root / root
0755
MockRequest
--
14 Mar 2026 8.32 AM
root / root
0755
MockResponse
--
14 Mar 2026 8.32 AM
root / root
0755
Multipart
--
14 Mar 2026 8.32 AM
root / root
0755
QueryParser
--
14 Mar 2026 8.32 AM
root / root
0755
Reloader
--
14 Mar 2026 8.32 AM
root / root
0755
Request
--
14 Mar 2026 8.32 AM
root / root
0755
Response
--
14 Mar 2026 8.32 AM
root / root
0755
Server
--
14 Mar 2026 8.32 AM
root / root
0755
Session
--
14 Mar 2026 8.32 AM
root / root
0755
Utils
--
14 Mar 2026 8.32 AM
root / root
0755
Auth.html
2.382 KB
20 Feb 2026 12.28 PM
root / root
0644
BodyProxy.html
9.983 KB
20 Feb 2026 12.28 PM
root / root
0644
Builder.html
38.075 KB
20 Feb 2026 12.28 PM
root / root
0644
Cascade.html
12.236 KB
20 Feb 2026 12.28 PM
root / root
0644
Chunked.html
10.397 KB
20 Feb 2026 12.28 PM
root / root
0644
CommonLogger.html
14.288 KB
20 Feb 2026 12.28 PM
root / root
0644
ConditionalGet.html
15.24 KB
20 Feb 2026 12.28 PM
root / root
0644
Config.html
5.855 KB
20 Feb 2026 12.28 PM
root / root
0644
ContentLength.html
7.805 KB
20 Feb 2026 12.28 PM
root / root
0644
ContentType.html
6.741 KB
20 Feb 2026 12.28 PM
root / root
0644
Deflater.html
16.407 KB
20 Feb 2026 12.28 PM
root / root
0644
Directory.html
27.379 KB
20 Feb 2026 12.28 PM
root / root
0644
ETag.html
14.999 KB
20 Feb 2026 12.28 PM
root / root
0644
Events.html
17.782 KB
20 Feb 2026 12.28 PM
root / root
0644
File.html
25.358 KB
20 Feb 2026 12.28 PM
root / root
0644
Files.html
25.362 KB
20 Feb 2026 12.28 PM
root / root
0644
ForwardRequest.html
6.744 KB
20 Feb 2026 12.28 PM
root / root
0644
Handler.html
14.406 KB
20 Feb 2026 12.28 PM
root / root
0644
Head.html
6.182 KB
20 Feb 2026 12.28 PM
root / root
0644
Lint.html
4.007 KB
20 Feb 2026 12.28 PM
root / root
0644
Lobster.html
7.828 KB
20 Feb 2026 12.28 PM
root / root
0644
Lock.html
7.633 KB
20 Feb 2026 12.28 PM
root / root
0644
Logger.html
5.773 KB
20 Feb 2026 12.28 PM
root / root
0644
MediaType.html
9.959 KB
20 Feb 2026 12.28 PM
root / root
0644
MethodOverride.html
11.556 KB
20 Feb 2026 12.28 PM
root / root
0644
Mime.html
13.642 KB
20 Feb 2026 12.28 PM
root / root
0644
MockRequest.html
29.98 KB
20 Feb 2026 12.28 PM
root / root
0644
MockResponse.html
21.321 KB
20 Feb 2026 12.28 PM
root / root
0644
Multipart.html
11.131 KB
20 Feb 2026 12.28 PM
root / root
0644
NullLogger.html
26.914 KB
20 Feb 2026 12.28 PM
root / root
0644
QueryParser.html
34.353 KB
20 Feb 2026 12.28 PM
root / root
0644
Recursive.html
10.012 KB
20 Feb 2026 12.28 PM
root / root
0644
RegexpExtensions.html
3.931 KB
20 Feb 2026 12.28 PM
root / root
0644
Reloader.html
10.95 KB
20 Feb 2026 12.28 PM
root / root
0644
Request.html
9.893 KB
20 Feb 2026 12.28 PM
root / root
0644
Response.html
26.613 KB
20 Feb 2026 12.28 PM
root / root
0644
RewindableInput.html
16.698 KB
20 Feb 2026 12.28 PM
root / root
0644
Runtime.html
6.829 KB
20 Feb 2026 12.28 PM
root / root
0644
Sendfile.html
22.708 KB
20 Feb 2026 12.28 PM
root / root
0644
Server.html
52.996 KB
20 Feb 2026 12.28 PM
root / root
0644
Session.html
2.606 KB
20 Feb 2026 12.28 PM
root / root
0644
ShowExceptions.html
18.029 KB
20 Feb 2026 12.28 PM
root / root
0644
ShowStatus.html
8.986 KB
20 Feb 2026 12.28 PM
root / root
0644
Static.html
25.858 KB
20 Feb 2026 12.28 PM
root / root
0644
TempfileReaper.html
6.389 KB
20 Feb 2026 12.28 PM
root / root
0644
URLMap.html
16.275 KB
20 Feb 2026 12.28 PM
root / root
0644
Utils.html
73.896 KB
20 Feb 2026 12.28 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF