$85 GRAYBYTE WORDPRESS FILE MANAGER $30

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

/opt/alt/ruby18/lib64/ruby/gems/1.8/doc/rack-1.6.1/rdoc/classes/Rack/

HOME
Current File : /opt/alt/ruby18/lib64/ruby/gems/1.8/doc/rack-1.6.1/rdoc/classes/Rack//Sendfile.html
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Rack::Sendfile</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Rack::Sendfile</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/lib/rack/sendfile_rb.html">
                lib/rack/sendfile.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                Object
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <h1><a href="Sendfile.html">Sendfile</a></h1>
<p>
The <a href="Sendfile.html">Sendfile</a> middleware intercepts responses
whose body is being served from a file and replaces it with a server
specific X-<a href="Sendfile.html">Sendfile</a> header. The web server is
then responsible for writing the file contents to the client. This can
dramatically reduce the amount of work required by the Ruby backend and
takes advantage of the web server&#8216;s optimized file delivery code.
</p>
<p>
In order to take advantage of this middleware, the response body must
respond to <tt>to_path</tt> and the request must include an X-<a
href="Sendfile.html">Sendfile</a>-Type header. <a
href="File.html">Rack::File</a> and other components implement
<tt>to_path</tt> so there&#8216;s rarely anything you need to do in your
application. The X-<a href="Sendfile.html">Sendfile</a>-Type header is
typically set in your web servers configuration. The following sections
attempt to document
</p>
<h3>Nginx</h3>
<p>
Nginx supports the X-Accel-Redirect header. This is similar to X-<a
href="Sendfile.html">Sendfile</a> but requires parts of the filesystem to
be mapped into a private URL hierarchy.
</p>
<p>
The following example shows the Nginx configuration required to create a
private &quot;/files/&quot; area, enable X-Accel-Redirect, and pass the
special X-<a href="Sendfile.html">Sendfile</a>-Type and X-Accel-Mapping
headers to the backend:
</p>
<pre>
  location ~ /files/(.*) {
    internal;
    alias /var/www/$1;
  }

  location / {
    proxy_redirect     off;

    proxy_set_header   Host                $host;
    proxy_set_header   X-Real-IP           $remote_addr;
    proxy_set_header   X-Forwarded-For     $proxy_add_x_forwarded_for;

    proxy_set_header   X-Sendfile-Type     X-Accel-Redirect;
    proxy_set_header   X-Accel-Mapping     /var/www/=/files/;

    proxy_pass         http://127.0.0.1:8080/;
  }
</pre>
<p>
Note that the X-<a href="Sendfile.html">Sendfile</a>-Type header must be
set exactly as shown above. The X-Accel-Mapping header should specify the
location on the file system, followed by an equals sign (=), followed name
of the private URL pattern that it maps to. The middleware performs a
simple substitution on the resulting path.
</p>
<p>
See Also: <a
href="http://wiki.codemongers.com/NginxXSendfile">wiki.codemongers.com/NginxXSendfile</a>
</p>
<h3>lighttpd</h3>
<p>
Lighttpd has supported some variation of the X-<a
href="Sendfile.html">Sendfile</a> header for some time, although only
recent version support X-<a href="Sendfile.html">Sendfile</a> in a reverse
proxy configuration.
</p>
<pre>
  $HTTP[&quot;host&quot;] == &quot;example.com&quot; {
     proxy-core.protocol = &quot;http&quot;
     proxy-core.balancer = &quot;round-robin&quot;
     proxy-core.backends = (
       &quot;127.0.0.1:8000&quot;,
       &quot;127.0.0.1:8001&quot;,
       ...
     )

     proxy-core.allow-x-sendfile = &quot;enable&quot;
     proxy-core.rewrite-request = (
       &quot;X-Sendfile-Type&quot; =&gt; (&quot;.*&quot; =&gt; &quot;X-Sendfile&quot;)
     )
   }
</pre>
<p>
See Also: <a
href="http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModProxyCore">redmine.lighttpd.net/wiki/lighttpd/Docs:ModProxyCore</a>
</p>
<h3>Apache</h3>
<p>
X-<a href="Sendfile.html">Sendfile</a> is supported under Apache 2.x using
a separate module:
</p>
<p>
<a href="https://tn123.org/mod_xsendfile">tn123.org/mod_xsendfile</a>/
</p>
<p>
Once the module is compiled and installed, you can enable it using
XSendFile config directive:
</p>
<pre>
  RequestHeader Set X-Sendfile-Type X-Sendfile
  ProxyPassReverse / http://localhost:8001/
  XSendFile on
</pre>
<h3>Mapping parameter</h3>
<p>
The third parameter allows for an overriding extension of the
X-Accel-Mapping header. Mappings should be provided in tuples of internal
to external. The internal values may contain regular expression syntax,
they will be matched with case indifference.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000248">call</a>&nbsp;&nbsp;
      <a href="#M000247">new</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">


    <div id="constants-list">
      <h3 class="section-bar">Constants</h3>

      <div class="name-list">
        <table summary="Constants">
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">F</td>
          <td>=</td>
          <td class="context-item-value">::File</td>
        </tr>
        </table>
      </div>
    </div>



      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000247" class="method-detail">
        <a name="M000247"></a>

        <div class="method-heading">
          <a href="Sendfile.src/M000247.html" target="Code" class="method-signature"
            onclick="popupCode('Sendfile.src/M000247.html');return false;">
          <span class="method-name">new</span><span class="method-args">(app, variation=nil, mappings=[])</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000248" class="method-detail">
        <a name="M000248"></a>

        <div class="method-heading">
          <a href="Sendfile.src/M000248.html" target="Code" class="method-signature"
            onclick="popupCode('Sendfile.src/M000248.html');return false;">
          <span class="method-name">call</span><span class="method-args">(env)</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>


Current_dir [ NOT WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
3 Mar 2024 10.50 PM
root / root
0755
Auth
--
3 Mar 2024 10.50 PM
root / root
0755
BodyProxy.src
--
3 Mar 2024 10.50 PM
root / root
0755
Builder.src
--
3 Mar 2024 10.50 PM
root / root
0755
Cascade.src
--
3 Mar 2024 10.50 PM
root / root
0755
Chunked
--
3 Mar 2024 10.50 PM
root / root
0755
Chunked.src
--
3 Mar 2024 10.50 PM
root / root
0755
CommonLogger.src
--
3 Mar 2024 10.50 PM
root / root
0755
ConditionalGet.src
--
3 Mar 2024 10.50 PM
root / root
0755
Config.src
--
3 Mar 2024 10.50 PM
root / root
0755
ContentLength.src
--
3 Mar 2024 10.50 PM
root / root
0755
ContentType.src
--
3 Mar 2024 10.50 PM
root / root
0755
Deflater
--
3 Mar 2024 10.50 PM
root / root
0755
Deflater.src
--
3 Mar 2024 10.50 PM
root / root
0755
Directory.src
--
3 Mar 2024 10.50 PM
root / root
0755
ETag.src
--
3 Mar 2024 10.50 PM
root / root
0755
File.src
--
3 Mar 2024 10.50 PM
root / root
0755
ForwardRequest.src
--
3 Mar 2024 10.50 PM
root / root
0755
Handler
--
3 Mar 2024 10.50 PM
root / root
0755
Handler.src
--
3 Mar 2024 10.50 PM
root / root
0755
Head.src
--
3 Mar 2024 10.50 PM
root / root
0755
Lint.src
--
3 Mar 2024 10.50 PM
root / root
0755
Lock.src
--
3 Mar 2024 10.50 PM
root / root
0755
Logger.src
--
3 Mar 2024 10.50 PM
root / root
0755
MethodOverride.src
--
3 Mar 2024 10.50 PM
root / root
0755
Mime.src
--
3 Mar 2024 10.50 PM
root / root
0755
MockRequest
--
3 Mar 2024 10.50 PM
root / root
0755
MockRequest.src
--
3 Mar 2024 10.50 PM
root / root
0755
MockResponse.src
--
3 Mar 2024 10.50 PM
root / root
0755
Multipart
--
3 Mar 2024 10.50 PM
root / root
0755
Multipart.src
--
3 Mar 2024 10.50 PM
root / root
0755
NullLogger.src
--
3 Mar 2024 10.50 PM
root / root
0755
Recursive.src
--
3 Mar 2024 10.50 PM
root / root
0755
Reloader
--
3 Mar 2024 10.50 PM
root / root
0755
Reloader.src
--
3 Mar 2024 10.50 PM
root / root
0755
Request.src
--
3 Mar 2024 10.50 PM
root / root
0755
Response
--
3 Mar 2024 10.50 PM
root / root
0755
Response.src
--
3 Mar 2024 10.50 PM
root / root
0755
RewindableInput
--
3 Mar 2024 10.50 PM
root / root
0755
RewindableInput.src
--
3 Mar 2024 10.50 PM
root / root
0755
Runtime.src
--
3 Mar 2024 10.50 PM
root / root
0755
Sendfile.src
--
3 Mar 2024 10.50 PM
root / root
0755
Server
--
3 Mar 2024 10.50 PM
root / root
0755
Server.src
--
3 Mar 2024 10.50 PM
root / root
0755
Session
--
3 Mar 2024 10.50 PM
root / root
0755
ShowExceptions.src
--
3 Mar 2024 10.50 PM
root / root
0755
ShowStatus.src
--
3 Mar 2024 10.50 PM
root / root
0755
Static.src
--
3 Mar 2024 10.50 PM
root / root
0755
TempfileReaper.src
--
3 Mar 2024 10.50 PM
root / root
0755
URLMap.src
--
3 Mar 2024 10.50 PM
root / root
0755
Utils
--
3 Mar 2024 10.50 PM
root / root
0755
Utils.src
--
3 Mar 2024 10.50 PM
root / root
0755
Auth.html
3.579 KB
5 Dec 2019 10.14 PM
root / root
0644
BodyProxy.html
6.001 KB
5 Dec 2019 10.14 PM
root / root
0644
Builder.html
10.705 KB
5 Dec 2019 10.14 PM
root / root
0644
Cascade.html
6.006 KB
5 Dec 2019 10.14 PM
root / root
0644
Chunked.html
4.758 KB
5 Dec 2019 10.14 PM
root / root
0644
CommonLogger.html
5.255 KB
5 Dec 2019 10.14 PM
root / root
0644
ConditionalGet.html
4.419 KB
5 Dec 2019 10.14 PM
root / root
0644
Config.html
3.806 KB
5 Dec 2019 10.14 PM
root / root
0644
ContentLength.html
3.917 KB
5 Dec 2019 10.14 PM
root / root
0644
ContentType.html
4.132 KB
5 Dec 2019 10.14 PM
root / root
0644
Deflater.html
4.804 KB
5 Dec 2019 10.14 PM
root / root
0644
Directory.html
11.22 KB
5 Dec 2019 10.14 PM
root / root
0644
ETag.html
4.808 KB
5 Dec 2019 10.14 PM
root / root
0644
File.html
7.61 KB
5 Dec 2019 10.14 PM
root / root
0644
ForwardRequest.html
3.894 KB
5 Dec 2019 10.14 PM
root / root
0644
Handler.html
8.265 KB
5 Dec 2019 10.14 PM
root / root
0644
Head.html
3.653 KB
5 Dec 2019 10.14 PM
root / root
0644
Lint.html
3.153 KB
5 Dec 2019 10.14 PM
root / root
0644
Lobster.html
3.322 KB
5 Dec 2019 10.14 PM
root / root
0644
Lock.html
4.103 KB
5 Dec 2019 10.14 PM
root / root
0644
Logger.html
3.659 KB
5 Dec 2019 10.14 PM
root / root
0644
MethodOverride.html
5.228 KB
5 Dec 2019 10.14 PM
root / root
0644
Mime.html
47.923 KB
5 Dec 2019 10.14 PM
root / root
0644
MockRequest.html
10.566 KB
5 Dec 2019 10.14 PM
root / root
0644
MockResponse.html
6.155 KB
5 Dec 2019 10.14 PM
root / root
0644
Multipart.html
7.441 KB
5 Dec 2019 10.14 PM
root / root
0644
NullLogger.html
16.262 KB
5 Dec 2019 10.14 PM
root / root
0644
Recursive.html
4.968 KB
5 Dec 2019 10.14 PM
root / root
0644
Reloader.html
5.522 KB
5 Dec 2019 10.14 PM
root / root
0644
Request.html
40.371 KB
5 Dec 2019 10.14 PM
root / root
0644
Response.html
12.565 KB
5 Dec 2019 10.14 PM
root / root
0644
RewindableInput.html
6.932 KB
5 Dec 2019 10.14 PM
root / root
0644
Runtime.html
4.258 KB
5 Dec 2019 10.14 PM
root / root
0644
Sendfile.html
7.827 KB
5 Dec 2019 10.14 PM
root / root
0644
Server.html
10.995 KB
5 Dec 2019 10.14 PM
root / root
0644
Session.html
3.104 KB
5 Dec 2019 10.14 PM
root / root
0644
ShowExceptions.html
6.003 KB
5 Dec 2019 10.14 PM
root / root
0644
ShowStatus.html
3.931 KB
5 Dec 2019 10.14 PM
root / root
0644
Static.html
8.864 KB
5 Dec 2019 10.14 PM
root / root
0644
TempfileReaper.html
4.026 KB
5 Dec 2019 10.14 PM
root / root
0644
URLMap.html
5.27 KB
5 Dec 2019 10.14 PM
root / root
0644
Utils.html
7.088 KB
5 Dec 2019 10.14 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF