264 lines
15 KiB
HTML
264 lines
15 KiB
HTML
|
<?xml version="1.0" encoding="utf-8"?>
|
||
|
<!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::Handler::FastCGI</title>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<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::Handler::FastCGI</td>
|
||
|
</tr>
|
||
|
<tr class="top-aligned-row">
|
||
|
<td><strong>In:</strong></td>
|
||
|
<td>
|
||
|
<a href="../../../files/lib/rack/handler/fastcgi_rb.html">
|
||
|
lib/rack/handler/fastcgi.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>
|
||
|
|
||
|
<div id="method-list">
|
||
|
<h3 class="section-bar">Methods</h3>
|
||
|
|
||
|
<div class="name-list">
|
||
|
<a href="#M000046">run</a>
|
||
|
<a href="#M000049">send_body</a>
|
||
|
<a href="#M000048">send_headers</a>
|
||
|
<a href="#M000047">serve</a>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<!-- if includes -->
|
||
|
|
||
|
<div id="section">
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<!-- if method_list -->
|
||
|
<div id="methods">
|
||
|
<h3 class="section-bar">Public Class methods</h3>
|
||
|
|
||
|
<div id="method-M000046" class="method-detail">
|
||
|
<a name="M000046"></a>
|
||
|
|
||
|
<div class="method-heading">
|
||
|
<a href="#M000046" class="method-signature">
|
||
|
<span class="method-name">run</span><span class="method-args">(app, options={})</span>
|
||
|
</a>
|
||
|
</div>
|
||
|
|
||
|
<div class="method-description">
|
||
|
<p><a class="source-toggle" href="#"
|
||
|
onclick="toggleCode('M000046-source');return false;">[Source]</a></p>
|
||
|
<div class="method-source-code" id="M000046-source">
|
||
|
<pre>
|
||
|
<span class="ruby-comment cmt"># File lib/rack/handler/fastcgi.rb, line 7</span>
|
||
|
7: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">run</span>(<span class="ruby-identifier">app</span>, <span class="ruby-identifier">options</span>={})
|
||
|
8: <span class="ruby-identifier">file</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:File</span>] <span class="ruby-keyword kw">and</span> <span class="ruby-constant">STDIN</span>.<span class="ruby-identifier">reopen</span>(<span class="ruby-constant">UNIXServer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">file</span>))
|
||
|
9: <span class="ruby-identifier">port</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:Port</span>] <span class="ruby-keyword kw">and</span> <span class="ruby-constant">STDIN</span>.<span class="ruby-identifier">reopen</span>(<span class="ruby-constant">TCPServer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">port</span>))
|
||
|
10: <span class="ruby-constant">FCGI</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">request</span><span class="ruby-operator">|</span>
|
||
|
11: <span class="ruby-identifier">serve</span> <span class="ruby-identifier">request</span>, <span class="ruby-identifier">app</span>
|
||
|
12: }
|
||
|
13: <span class="ruby-keyword kw">end</span>
|
||
|
</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div id="method-M000049" class="method-detail">
|
||
|
<a name="M000049"></a>
|
||
|
|
||
|
<div class="method-heading">
|
||
|
<a href="#M000049" class="method-signature">
|
||
|
<span class="method-name">send_body</span><span class="method-args">(out, body)</span>
|
||
|
</a>
|
||
|
</div>
|
||
|
|
||
|
<div class="method-description">
|
||
|
<p><a class="source-toggle" href="#"
|
||
|
onclick="toggleCode('M000049-source');return false;">[Source]</a></p>
|
||
|
<div class="method-source-code" id="M000049-source">
|
||
|
<pre>
|
||
|
<span class="ruby-comment cmt"># File lib/rack/handler/fastcgi.rb, line 78</span>
|
||
|
78: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send_body</span>(<span class="ruby-identifier">out</span>, <span class="ruby-identifier">body</span>)
|
||
|
79: <span class="ruby-identifier">body</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">part</span><span class="ruby-operator">|</span>
|
||
|
80: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">print</span> <span class="ruby-identifier">part</span>
|
||
|
81: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">flush</span>
|
||
|
82: }
|
||
|
83: <span class="ruby-keyword kw">end</span>
|
||
|
</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div id="method-M000048" class="method-detail">
|
||
|
<a name="M000048"></a>
|
||
|
|
||
|
<div class="method-heading">
|
||
|
<a href="#M000048" class="method-signature">
|
||
|
<span class="method-name">send_headers</span><span class="method-args">(out, status, headers)</span>
|
||
|
</a>
|
||
|
</div>
|
||
|
|
||
|
<div class="method-description">
|
||
|
<p><a class="source-toggle" href="#"
|
||
|
onclick="toggleCode('M000048-source');return false;">[Source]</a></p>
|
||
|
<div class="method-source-code" id="M000048-source">
|
||
|
<pre>
|
||
|
<span class="ruby-comment cmt"># File lib/rack/handler/fastcgi.rb, line 67</span>
|
||
|
67: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send_headers</span>(<span class="ruby-identifier">out</span>, <span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>)
|
||
|
68: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">"Status: #{status}\r\n"</span>
|
||
|
69: <span class="ruby-identifier">headers</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">vs</span><span class="ruby-operator">|</span>
|
||
|
70: <span class="ruby-identifier">vs</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
||
|
71: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">"#{k}: #{v}\r\n"</span>
|
||
|
72: }
|
||
|
73: }
|
||
|
74: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">print</span> <span class="ruby-value str">"\r\n"</span>
|
||
|
75: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">flush</span>
|
||
|
76: <span class="ruby-keyword kw">end</span>
|
||
|
</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div id="method-M000047" class="method-detail">
|
||
|
<a name="M000047"></a>
|
||
|
|
||
|
<div class="method-heading">
|
||
|
<a href="#M000047" class="method-signature">
|
||
|
<span class="method-name">serve</span><span class="method-args">(request, app)</span>
|
||
|
</a>
|
||
|
</div>
|
||
|
|
||
|
<div class="method-description">
|
||
|
<p><a class="source-toggle" href="#"
|
||
|
onclick="toggleCode('M000047-source');return false;">[Source]</a></p>
|
||
|
<div class="method-source-code" id="M000047-source">
|
||
|
<pre>
|
||
|
<span class="ruby-comment cmt"># File lib/rack/handler/fastcgi.rb, line 31</span>
|
||
|
31: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">serve</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">app</span>)
|
||
|
32: <span class="ruby-identifier">env</span> = <span class="ruby-identifier">request</span>.<span class="ruby-identifier">env</span>
|
||
|
33: <span class="ruby-identifier">env</span>.<span class="ruby-identifier">delete</span> <span class="ruby-value str">"HTTP_CONTENT_LENGTH"</span>
|
||
|
34:
|
||
|
35: <span class="ruby-identifier">request</span>.<span class="ruby-identifier">in</span>.<span class="ruby-identifier">extend</span> <span class="ruby-constant">ProperStream</span>
|
||
|
36:
|
||
|
37: <span class="ruby-identifier">env</span>[<span class="ruby-value str">"SCRIPT_NAME"</span>] = <span class="ruby-value str">""</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">env</span>[<span class="ruby-value str">"SCRIPT_NAME"</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">"/"</span>
|
||
|
38:
|
||
|
39: <span class="ruby-identifier">env</span>.<span class="ruby-identifier">update</span>({<span class="ruby-value str">"rack.version"</span> =<span class="ruby-operator">></span> [<span class="ruby-value">0</span>,<span class="ruby-value">1</span>],
|
||
|
40: <span class="ruby-value str">"rack.input"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">in</span>,
|
||
|
41: <span class="ruby-value str">"rack.errors"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">err</span>,
|
||
|
42:
|
||
|
43: <span class="ruby-value str">"rack.multithread"</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">false</span>,
|
||
|
44: <span class="ruby-value str">"rack.multiprocess"</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">true</span>,
|
||
|
45: <span class="ruby-value str">"rack.run_once"</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">false</span>,
|
||
|
46:
|
||
|
47: <span class="ruby-value str">"rack.url_scheme"</span> =<span class="ruby-operator">></span> [<span class="ruby-value str">"yes"</span>, <span class="ruby-value str">"on"</span>, <span class="ruby-value str">"1"</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">env</span>[<span class="ruby-value str">"HTTPS"</span>]) <span class="ruby-operator">?</span> <span class="ruby-value str">"https"</span> <span class="ruby-operator">:</span> <span class="ruby-value str">"http"</span>
|
||
|
48: })
|
||
|
49:
|
||
|
50: <span class="ruby-identifier">env</span>[<span class="ruby-value str">"QUERY_STRING"</span>] <span class="ruby-operator">||=</span> <span class="ruby-value str">""</span>
|
||
|
51: <span class="ruby-identifier">env</span>[<span class="ruby-value str">"HTTP_VERSION"</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">env</span>[<span class="ruby-value str">"SERVER_PROTOCOL"</span>]
|
||
|
52: <span class="ruby-identifier">env</span>[<span class="ruby-value str">"REQUEST_PATH"</span>] <span class="ruby-operator">||=</span> <span class="ruby-value str">"/"</span>
|
||
|
53: <span class="ruby-identifier">env</span>.<span class="ruby-identifier">delete</span> <span class="ruby-value str">"PATH_INFO"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">env</span>[<span class="ruby-value str">"PATH_INFO"</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">""</span>
|
||
|
54: <span class="ruby-identifier">env</span>.<span class="ruby-identifier">delete</span> <span class="ruby-value str">"CONTENT_TYPE"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">env</span>[<span class="ruby-value str">"CONTENT_TYPE"</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">""</span>
|
||
|
55: <span class="ruby-identifier">env</span>.<span class="ruby-identifier">delete</span> <span class="ruby-value str">"CONTENT_LENGTH"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">env</span>[<span class="ruby-value str">"CONTENT_LENGTH"</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">""</span>
|
||
|
56:
|
||
|
57: <span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span> = <span class="ruby-identifier">app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
|
||
|
58: <span class="ruby-keyword kw">begin</span>
|
||
|
59: <span class="ruby-identifier">send_headers</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">out</span>, <span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>
|
||
|
60: <span class="ruby-identifier">send_body</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">out</span>, <span class="ruby-identifier">body</span>
|
||
|
61: <span class="ruby-keyword kw">ensure</span>
|
||
|
62: <span class="ruby-identifier">body</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:close</span>
|
||
|
63: <span class="ruby-identifier">request</span>.<span class="ruby-identifier">finish</span>
|
||
|
64: <span class="ruby-keyword kw">end</span>
|
||
|
65: <span class="ruby-keyword kw">end</span>
|
||
|
</pre>
|
||
|
</div>
|
||
|
</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>
|