File: classPassenger_1_1HttpStatusExtractor.html

package info (click to toggle)
passenger 2.2.11debian-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 11,576 kB
  • ctags: 28,138
  • sloc: cpp: 66,323; ruby: 9,646; ansic: 2,425; python: 141; sh: 56; makefile: 29
file content (128 lines) | stat: -rw-r--r-- 9,293 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Passenger: Passenger::HttpStatusExtractor Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.8 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="namespacePassenger.html">Passenger</a>::<a class="el" href="classPassenger_1_1HttpStatusExtractor.html">HttpStatusExtractor</a>
  </div>
</div>
<div class="contents">
<h1>Passenger::HttpStatusExtractor Class Reference</h1><!-- doxytag: class="Passenger::HttpStatusExtractor" -->Utility class for extracting the HTTP status value from an HTTP response.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="HttpStatusExtractor_8h-source.html">HttpStatusExtractor.h</a>&gt;</code>
<p>

<p>
<a href="classPassenger_1_1HttpStatusExtractor-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1HttpStatusExtractor.html#ca6fd77038e76b313830757730780d51">feed</a> (const char *data, unsigned int size)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Feed HTTP response data to this <a class="el" href="classPassenger_1_1HttpStatusExtractor.html" title="Utility class for extracting the HTTP status value from an HTTP response.">HttpStatusExtractor</a>.  <a href="#ca6fd77038e76b313830757730780d51"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">string&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1HttpStatusExtractor.html#f0db266fc713f532047880c5eaae44d5">getStatusLine</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the HTTP status line that has been determined.  <a href="#f0db266fc713f532047880c5eaae44d5"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="3749842ba4f8f59b6b69c594da963f22"></a><!-- doxytag: member="Passenger::HttpStatusExtractor::getBuffer" ref="3749842ba4f8f59b6b69c594da963f22" args="() const " -->
string&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1HttpStatusExtractor.html#3749842ba4f8f59b6b69c594da963f22">getBuffer</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the data that has been fed so far. <br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Utility class for extracting the HTTP status value from an HTTP response. 
<p>
This class is used for generating a proper HTTP response. The response data that <a class="el" href="namespacePassenger.html" title="A random.">Passenger</a> backend processes generate are like CGI responses, and do not include an initial "HTTP/1.1 [status here]" line, so this class used to extract the status from the response in order to generate a proper initial HTTP response line.<p>
This class is supposed to be used as follows:<ul>
<li>Keep feeding HTTP response data until <a class="el" href="classPassenger_1_1HttpStatusExtractor.html#ca6fd77038e76b313830757730780d51" title="Feed HTTP response data to this HttpStatusExtractor.">feed()</a> returns true. <a class="el" href="classPassenger_1_1HttpStatusExtractor.html#ca6fd77038e76b313830757730780d51" title="Feed HTTP response data to this HttpStatusExtractor.">feed()</a> buffers all fed data until it is able to extract the HTTP status.</li><li>Call <a class="el" href="classPassenger_1_1HttpStatusExtractor.html#f0db266fc713f532047880c5eaae44d5" title="Returns the HTTP status line that has been determined.">getStatusLine()</a> to retrieve the status line, and use this to generate an HTTP response line.</li><li>Call <a class="el" href="classPassenger_1_1HttpStatusExtractor.html#3749842ba4f8f59b6b69c594da963f22" title="Get the data that has been fed so far.">getBuffer()</a> to retrieve all fed data so far. This data can be sent to the HTTP client.</li></ul>
<p>
This class will also ensure that the status line contains a status text, e.g. if the HTTP data's status value is only "200" then "OK" will be automatically appended.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>When the API documentation for this class refers to "\r\n", we actually mean "\x0D\x0A" (the HTTP line termination string). "\r\n" is only written out of convenience. </dd></dl>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="ca6fd77038e76b313830757730780d51"></a><!-- doxytag: member="Passenger::HttpStatusExtractor::feed" ref="ca6fd77038e76b313830757730780d51" args="(const char *data, unsigned int size)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Passenger::HttpStatusExtractor::feed           </td>
          <td>(</td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&nbsp;</td>
          <td class="paramname"> <em>size</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Feed HTTP response data to this <a class="el" href="classPassenger_1_1HttpStatusExtractor.html" title="Utility class for extracting the HTTP status value from an HTTP response.">HttpStatusExtractor</a>. 
<p>
One is to keep feeding data until this method returns true. When a sufficient amount of data has been fed, this method will extract the status line from the data that has been fed so far, and return true.<p>
Do not call this method again once it has returned true.<p>
It is safe to feed excess data. That is, it is safe if the 'data' argument contains a part of the HTTP response body. <a class="el" href="classPassenger_1_1HttpStatusExtractor.html" title="Utility class for extracting the HTTP status value from an HTTP response.">HttpStatusExtractor</a> will only look for the status line in the HTTP response header, not in the HTTP response body. All fed data is buffered and will be available via <a class="el" href="classPassenger_1_1HttpStatusExtractor.html#3749842ba4f8f59b6b69c594da963f22" title="Get the data that has been fed so far.">getBuffer()</a>, so no data will be lost.<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Whether the HTTP status has been extracted yet. </dd></dl>
<dl class="pre" compact><dt><b>Precondition:</b></dt><dd><a class="el" href="classPassenger_1_1HttpStatusExtractor.html#ca6fd77038e76b313830757730780d51" title="Feed HTTP response data to this HttpStatusExtractor.">feed()</a> did not previously return true. <p>
data != NULL <p>
size &gt; 0 </dd></dl>

</div>
</div><p>
<a class="anchor" name="f0db266fc713f532047880c5eaae44d5"></a><!-- doxytag: member="Passenger::HttpStatusExtractor::getStatusLine" ref="f0db266fc713f532047880c5eaae44d5" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">string Passenger::HttpStatusExtractor::getStatusLine           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td> const<code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the HTTP status line that has been determined. 
<p>
The default value is "200 OK\r\n", which is returned if the HTTP response data that has been fed so far does not include a status line.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>The return value includes a trailing CRLF, e.g. "404 Not Found\r\n". </dd></dl>

</div>
</div><p>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="HttpStatusExtractor_8h-source.html">HttpStatusExtractor.h</a></ul>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Feb 21 12:22:48 2010 for Passenger by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
</body>
</html>