]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_proxy_ajp.html.en
a few new translations and up-to-date patches
[apache] / docs / manual / mod / mod_proxy_ajp.html.en
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5               This file is generated from xml source: DO NOT EDIT
6         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7       -->
8 <title>mod_proxy_ajp - Apache HTTP Server</title>
9 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
12 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
13 <body>
14 <div id="page-header">
15 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
16 <p class="apache">Apache HTTP Server Version 2.1</p>
17 <img alt="" src="../images/feather.gif" /></div>
18 <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
19 <div id="path">
20 <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs-project/">Documentation</a> &gt; <a href="../">Version 2.1</a> &gt; <a href="./">Modules</a></div>
21 <div id="page-content">
22 <div id="preamble"><h1>Apache Module mod_proxy_ajp</h1>
23 <div class="toplang">
24 <p><span>Available Languages: </span><a href="../en/mod/mod_proxy_ajp.html" title="English">&nbsp;en&nbsp;</a></p>
25 </div>
26 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>AJP support module for
27 <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code></td></tr>
28 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
29 <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>proxy_ajp_module</td></tr>
30 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>proxy_ajp.c</td></tr></table>
31 <h3>Summary</h3>
32
33     <p>This module <em>requires</em> the service of <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code>. It provides support for the 
34     <code>Apache JServ Protocol version 1.3</code> (hereafter
35     <em>AJP13</em>).</p>
36
37     <p>Thus, in order to get the ability of handling <code>AJP13</code>
38     protocol, <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> and
39     <code class="module"><a href="../mod/mod_proxy_ajp.html">mod_proxy_ajp</a></code> have to be present in the server.</p>
40
41     <div class="warning"><h3>Warning</h3>
42       <p>Do not enable proxying until you have <a href="mod_proxy.html#access">secured your server</a>. Open proxy
43       servers are dangerous both to your network and to the Internet at
44       large.</p>
45     </div>
46 </div>
47 <div id="quickview"><h3 class="directives">Directives</h3>
48 <p>This module provides no
49             directives.</p>
50 <h3>Topics</h3>
51 <ul id="topics">
52 <li><img alt="" src="../images/down.gif" /> <a href="#overviewprotocol">Overview of the protocol</a></li>
53 <li><img alt="" src="../images/down.gif" /> <a href="#basppacketstruct">Basic Packet Structure</a></li>
54 <li><img alt="" src="../images/down.gif" /> <a href="#rpacetstruct">Request Packet Structure</a></li>
55 <li><img alt="" src="../images/down.gif" /> <a href="#resppacketstruct">Response Packet Structure</a></li>
56 </ul><h3>See also</h3>
57 <ul class="seealso">
58 <li><code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code></li>
59 </ul></div>
60 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
61 <div class="section">
62 <h2><a name="overviewprotocol" id="overviewprotocol">Overview of the protocol</a></h2>
63     <p>The <code>AJP13</code> protocol is packet-oriented.  A binary format
64     was presumably chosen over the more readable plain text for reasons of
65     performance.  The web server communicates with the servlet container over
66     TCP connections.  To cut down on the expensive process of socket creation,
67     the web server will attempt to maintain persistent TCP connections to the
68     servlet container, and to reuse a connection for multiple request/response
69     cycles.</p>
70     <p>Once a connection is assigned to a particular request, it will not be
71     used for any others until the request-handling cycle has terminated.  In
72     other words, requests are not multiplexed over connections.  This makes
73     for much simpler code at either end of the connection, although it does
74     cause more connections to be open at once.</p>
75     <p>Once the web server has opened a connection to the servlet container,
76     the connection can be in one of the following states:</p>
77     <p><ul>
78     <li> Idle <br /> No request is being handled over this connection. </li>
79     <li> Assigned <br /> The connecton is handling a specific request.</li>
80     </ul></p>
81     <p>Once a connection is assigned to handle a particular request, the basic
82     request informaton (e.g. HTTP headers, etc) is sent over the connection in
83     a highly condensed form (e.g. common strings are encoded as integers).
84     Details of that format are below in Request Packet Structure. If there is a
85     body to the request <code>(content-length &gt; 0)</code>, that is sent in a
86     separate packet immediately after.</p>
87     <p>At this point, the servlet container is presumably ready to start
88     processing the request.  As it does so, it can send the
89     following messages back to the web server:
90     <ul>
91     <li>SEND_HEADERS <br />Send a set of headers back to the browser.</li>
92     <li>SEND_BODY_CHUNK <br />Send a chunk of body data back to the browser.
93     </li>
94     <li>GET_BODY_CHUNK <br />Get further data from the request if it hasn't all
95     been transferred yet.  This is necessary because the packets have a fixed
96     maximum size and arbitrary amounts of data can be included the body of a
97     request (for uploaded files, for example).  (Note: this is unrelated to
98     HTTP chunked tranfer).</li>
99     <li>END_RESPONSE <br /> Finish the request-handling cycle.</li>
100     </ul></p>
101     <p>Each message is accompanied by a differently formatted packet of data.
102     See Response Packet Structures below for details.</p>
103 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
104 <div class="section">
105 <h2><a name="basppacketstruct" id="basppacketstruct">Basic Packet Structure</a></h2>
106     <p>There is a bit of an XDR heritage to this protocol, but it differs
107     in lots of ways (no 4 byte alignment, for example).</p>
108     <p>Byte order: I am not clear about the endian-ness of the individual
109     bytes.  I'm guessing the bytes are little-endian, because that's what
110     XDR specifies, and I'm guessing that sys/socket library is magically
111     making that so (on the C side).  If anyone with a better knowledge of
112     socket calls can step in, that would be great.</p>
113     <p>There are four data types in the protocol: bytes, booleans,
114     integers and strings.
115     <dl>
116     <dt><strong>Byte</strong></dt><dd>A single byte.</dd>
117     <dt><strong>Boolean</strong></dt>
118       <dd>A single byte, <code>1 = true</code>, <code>0 = false</code>.
119       Using other non-zero values as true (i.e. C-style) may work in some places,
120       but it won't in others.</dd>
121     <dt><strong>Integer</strong></dt>
122       <dd>A number in the range of <code>0 to 2^16 (32768)</code>.  Stored in
123       2 bytes with the high-order byte first.</dd>
124     <dt><strong>String</strong></dt>
125       <dd>A variable-sized string (length bounded by 2^16). Encoded with
126       the length packed into two bytes first, followed by the string
127       (including the terminating '\0').  Note that the encoded length does
128       <strong>not</strong> include the trailing '\0' -- it is like
129       <code>strlen</code>.  This is a touch confusing on the Java side, which
130       is littered with odd autoincrement statements to skip over these
131       terminators.  I believe the reason this was done was to allow the C
132       code to be extra efficient when reading strings which the servlet
133       container is sending back -- with the terminating \0 character, the
134       C code can pass around references into a single buffer, without copying.
135       if the \0 was missing, the C code would have to copy things out in order
136       to get its notion of a string.</dd>
137     </dl></p>
138
139   <h3>Packet Size</h3>
140     <p>According to much of the code, the max packet size is <code>
141     8 * 1024 bytes (8K)</code>.  The actual length of the packet is encoded in
142     the header.</p>
143   
144   <h3>Packet Headers</h3>
145     <p>Packets sent from the server to the container begin with
146     <code>0x1234</code>.  Packets sent from the container to the server
147     begin with <code>AB</code> (that's the ASCII code for A followed by the
148     ASCII code for B).  After those first two bytes, there is an integer
149     (encoded as above) with the length of the payload.  Although this might
150     suggest that the maximum payload could be as large as 2^16, in fact, the
151     code sets the maximum to be 8K.
152     <table>
153       <tr>
154         <td colspan="6"><em>Packet Format (Server-&gt;Container)</em></td>
155       </tr>
156       <tr>
157         <td>Byte</td>
158         <td>0</td>
159         <td>1</td>
160         <td>2</td>
161         <td>3</td>
162         <td>4...(n+3)</td>
163       </tr>
164       <tr>
165         <td>Contents</td>
166         <td>0x12</td>
167         <td>0x34</td>
168         <td colspan="2">Data Length (n)</td>
169         <td>Data</td>
170       </tr>
171     </table>
172     <table>
173       <tr>
174         <td colspan="6"><em>Packet Format (Container-&gt;Server)</em></td>
175       </tr>
176       <tr>
177         <td>Byte</td>
178         <td>0</td>
179         <td>1</td>
180         <td>2</td>
181         <td>3</td>
182         <td>4...(n+3)</td>
183       </tr>
184       <tr>
185         <td>Contents</td>
186         <td>A</td>
187         <td>B</td>
188         <td colspan="2">Data Length (n)</td>
189         <td>Data</td>
190       </tr>
191     </table></p>
192     <p>For most packets, the first byte of the payload encodes the type of
193      message.  The exception is for request body packets sent from the server to
194      the container -- they are sent with a standard packet header (<code>
195      0x1234</code> and then length of the packet), but without any prefix code
196      after that.</p>
197      <p>The web server can send the following messages to the servlet container:
198     <table>
199       <tr>
200         <td>Code</td>
201         <td>Type of Packet</td>
202         <td>Meaning</td>
203       </tr>
204       <tr>
205         <td>2</td>
206         <td>Forward Request</td>
207         <td>Begin the request-processing cycle with the following data</td>
208       </tr>
209       <tr>
210         <td>7</td>
211         <td>Shutdown</td>
212         <td>The web server asks the container to shut itself down.</td>
213       </tr>
214       <tr>
215         <td>8</td>
216         <td>Ping</td>
217         <td>The web server asks the container to take control
218         (secure login phase).</td>
219       </tr>
220       <tr>
221         <td>10</td>
222         <td>CPing</td>
223         <td>The web server asks the container to respond quickly with a CPong.
224         </td>
225       </tr>
226       <tr>
227         <td>none</td>
228         <td>Data</td>
229         <td>Size (2 bytes) and corresponding body data.</td>
230       </tr>
231     </table></p>
232     <p>To ensure some basic security, the container will only actually do the
233     <code>Shutdown</code> if the request comes from the same machine on which
234     it's hosted.</p>
235     <p>The first <code>Data</code> packet is send immediatly after the
236     <code>Forward Request</code> by the web server.</p>
237     <p>The servlet container can send the following types of messages to the
238     webserver:
239     <table>
240       <tr>
241         <td>Code</td>
242         <td>Type of Packet</td>
243         <td>Meaning</td>
244       </tr>
245       <tr>
246         <td>3</td>
247         <td>Send Body Chunk</td>
248         <td>Send a chunk of the body from the servlet container to the web
249         server (and presumably, onto the browser). </td>
250       </tr>
251       <tr>
252         <td>4</td>
253         <td>Send Headers</td>
254         <td>Send the response headers from the servlet container to the web
255         server (and presumably, onto the browser).</td>
256       </tr>
257       <tr>
258         <td>5</td>
259         <td>End Response</td>
260         <td>Marks the end of the response (and thus the request-handling cycle).
261         </td>
262       </tr>
263       <tr>
264         <td>6</td>
265         <td>Get Body Chunk</td>
266         <td>Get further data from the request if it hasn't all been
267         transferred yet.</td>
268       </tr>
269       <tr>
270         <td>9</td>
271         <td>CPong Reply</td>
272         <td>The reply to a CPing request</td>
273       </tr>
274     </table></p>
275     <p>Each of the above messages has a different internal structure, detailed
276     below.</p>
277   
278 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
279 <div class="section">
280 <h2><a name="rpacetstruct" id="rpacetstruct">Request Packet Structure</a></h2>
281     <p>For messages from the server to the container of type
282     <em>Forward Request</em>:</p>
283     <div class="example"><pre>
284 AJP13_FORWARD_REQUEST :=
285     prefix_code      (byte) 0x02 = JK_AJP13_FORWARD_REQUEST
286     method           (byte)
287     protocol         (string)
288     req_uri          (string)
289     remote_addr      (string)
290     remote_host      (string)
291     server_name      (string)
292     server_port      (integer)
293     is_ssl           (boolean)
294     num_headers      (integer)
295     request_headers *(req_header_name req_header_value)
296     attributes      *(attribut_name attribute_value)
297     request_terminator (byte) OxFF
298     </pre></div>
299     <p>The <code>request_headers</code> have the following structure:
300     </p><div class="example"><pre>
301 req_header_name := 
302     sc_req_header_name | (string)  [see below for how this is parsed]
303
304 sc_req_header_name := 0xA0xx (integer)
305
306 req_header_value := (string)
307 </pre></div>
308     <p>The <code>attributes</code> are optional and have the following
309     structure:</p>
310     <div class="example"><pre>
311 attribute_name := sc_a_name | (sc_a_req_attribute string)
312
313 attribute_value := (string)
314
315     </pre></div>
316     <p>Not that the all-important header is <code>content-length</code>,
317     because it determines whether or not the container looks for another
318     packet immediately.</p>
319   <h3>Detailed description of the elements of Forward Request
320   </h3>
321   <h3>Request prefix</h3>
322     <p>For all requests, this will be 2. See above for details on other Prefix
323     codes.</p>
324   
325   <h3>Method</h3>
326     <p>The HTTP method, encoded as a single byte:</p>
327     <p><table>
328       <tr><td>Command Name</td><td>Code</td></tr>
329       <tr><td>OPTIONS</td><td>1</td></tr>
330       <tr><td>GET</td><td>2</td></tr>
331       <tr><td>HEAD</td><td>3</td></tr>
332       <tr><td>POST</td><td>4</td></tr>
333       <tr><td>PUT</td><td>5</td></tr>
334       <tr><td>DELETE</td><td>6</td></tr>
335       <tr><td>TRACE</td><td>7</td></tr>
336       <tr><td>PROPFIND</td><td>8</td></tr>
337       <tr><td>PROPPATCH</td><td>9</td></tr>
338       <tr><td>MKCOL</td><td>10</td></tr>
339       <tr><td>COPY</td><td>11</td></tr>
340       <tr><td>MOVE</td><td>12</td></tr>
341       <tr><td>LOCK</td><td>13</td></tr>
342       <tr><td>UNLOCK</td><td>14</td></tr>
343       <tr><td>ACL</td><td>15</td></tr>
344       <tr><td>REPORT</td><td>16</td></tr>
345       <tr><td>VERSION-CONTROL</td><td>17</td></tr>
346       <tr><td>CHECKIN</td><td>18</td></tr>
347       <tr><td>CHECKOUT</td><td>19</td></tr>
348       <tr><td>UNCHECKOUT</td><td>20</td></tr>
349       <tr><td>SEARCH</td><td>21</td></tr>
350       <tr><td>MKWORKSPACE</td><td>22</td></tr>
351       <tr><td>UPDATE</td><td>23</td></tr>
352       <tr><td>LABEL</td><td>24</td></tr>
353       <tr><td>MERGE</td><td>25</td></tr>
354       <tr><td>BASELINE_CONTROL</td><td>26</td></tr>
355       <tr><td>MKACTIVITY</td><td>27</td></tr>
356     </table></p>
357     <p>Later version of ajp13, will transport 
358     additional methods, even if they are not in this list.</p>
359   
360   <h3>protocol, req_uri, remote_addr, remote_host, server_name,
361   server_port, is_ssl</h3>
362     <p>These are all fairly self-explanatory.  Each of these is required, and
363     will be sent for every request.</p>
364   
365   <h3>Headers</h3>
366     <p>The structure of <code>request_headers</code> is the following:
367     First, the number of headers <code>num_headers</code> is encoded.
368     Then, a series of header name <code>req_header_name</code> / value
369     <code>req_header_value</code> pairs follows.
370     Common header names are encoded as integers,
371     to save space.  If the header name is not in the list of basic headers,
372     it is encoded normally (as a string, with prefixed length).  The list of
373     common headers <code>sc_req_header_name</code>and their codes
374     is as follows (all are case-sensitive):</p>
375     <p><table>
376       <tr><td>Name</td><td>Code value</td><td>Code name</td></tr>
377       <tr><td>accept</td><td>0xA001</td><td>SC_REQ_ACCEPT</td></tr>
378       <tr><td>accept-charset</td><td>0xA002</td><td>SC_REQ_ACCEPT_CHARSET
379       </td></tr>
380       <tr><td>accept-encoding</td><td>0xA003</td><td>SC_REQ_ACCEPT_ENCODING
381       </td></tr>
382       <tr><td>accept-language</td><td>0xA004</td><td>SC_REQ_ACCEPT_LANGUAGE
383       </td></tr>
384       <tr><td>authorization</td><td>0xA005</td><td>SC_REQ_AUTHORIZATION</td>
385       </tr>
386       <tr><td>connection</td><td>0xA006</td><td>SC_REQ_CONNECTION</td></tr>
387       <tr><td>content-type</td><td>0xA007</td><td>SC_REQ_CONTENT_TYPE</td>
388       </tr>
389       <tr><td>content-length</td><td>0xA008</td><td>SC_REQ_CONTENT_LENGTH</td>
390       </tr>
391       <tr><td>cookie</td><td>0xA009</td><td>SC_REQ_COOKIE</td></tr>
392       <tr><td>cookie2</td><td>0xA00A</td><td>SC_REQ_COOKIE2</td></tr>
393       <tr><td>host</td><td>0xA00B</td><td>SC_REQ_HOST</td></tr>
394       <tr><td>pragma</td><td>0xA00C</td><td>SC_REQ_PRAGMA</td></tr>
395       <tr><td>referer</td><td>0xA00D</td><td>SC_REQ_REFERER</td></tr>
396       <tr><td>user-agent</td><td>0xA00E</td><td>SC_REQ_USER_AGENT</td></tr>
397     </table></p>
398     <p>The Java code that reads this grabs the first two-byte integer and if
399     it sees an <code>'0xA0'</code> in the most significant
400     byte, it uses the integer in the second byte as an index into an array of
401     header names.  If the first byte is not <code>0xA0</code>, it assumes that
402     the two-byte integer is the length of a string, which is then read in.</p>
403     <p>This works on the assumption that no header names will have length
404     greater than <code>0x9999 (==0xA000 - 1)</code>, which is perfectly
405     reasonable, though somewhat arbitrary.</p>
406     <div class="note"><h3>Note:</h3>
407     The <code>content-length</code> header is extremely
408     important.  If it is present and non-zero, the container assumes that
409     the request has a body (a POST request, for example), and immediately
410     reads a separate packet off the input stream to get that body.
411     </div>
412   
413   <h3>Attributes</h3>
414     <p>The attributes prefixed with a <code>?</code>
415     (e.g. <code>?context</code>) are all optional.  For each, there is a
416     single byte code to indicate the type of attribute, and then a string to
417     give its value.  They can be sent in any order (thogh the C code always
418     sends them in the order listed below).  A special terminating code is
419     sent to signal the end of the list of optional attributes. The list of
420     byte codes is:</p>
421     <p><table>
422       <tr><td>Information</td><td>Code Value</td><td>Note</td></tr>
423       <tr><td>?context</td><td>0x01</td><td>Not currently implemented
424       </td></tr>
425       <tr><td>?servlet_path</td><td>0x02</td><td>Not currently implemented
426       </td></tr>
427       <tr><td>?remote_user</td><td>0x03</td><td /></tr>
428       <tr><td>?auth_type</td><td>0x04</td><td /></tr>
429       <tr><td>?query_string</td><td>0x05</td><td /></tr>
430       <tr><td>?jvm_route</td><td>0x06</td><td /></tr>
431       <tr><td>?ssl_cert</td><td>0x07</td><td /></tr>
432       <tr><td>?ssl_cipher</td><td>0x08</td><td /></tr>
433       <tr><td>?ssl_session</td><td>0x09</td><td /></tr>
434       <tr><td>?req_attribute</td><td>0x0A</td><td>Name (the name of the
435       attribute follows)</td></tr>
436       <tr><td>?ssl_key_size</td><td>0x0B</td><td /></tr>
437       <tr><td>are_done</td><td>0xFF</td><td>request_terminator</td></tr>
438     </table></p>
439     <p>The <code>context</code> and <code>servlet_path</code> are not
440     currently set by the C code, and most of the Java code completely ignores
441     whatever is sent over for those fields (and some of it will actually break
442     if a string is sent along after one of those codes).  I don't know if this
443     is a bug or an unimplemented feature or just vestigial code, but it's
444     missing from both sides of the connection.</p>
445     <p>The <code>remote_user</code> and <code>auth_type</code> presumably
446     refer to HTTP-level authentication, and communicate the remote user's
447     username and the type of authentication used to establish their identity
448     (e.g. Basic, Digest).</p>
449     <p>The <code>query_string</code>, <code>ssl_cert</code>,
450     <code>ssl_cipher</code>, and <code>ssl_session</code> refer to the
451     corresponding pieces of HTTP and HTTPS.</p>
452     <p>The <code>jvm_route</code>, is used to support sticky
453     sessions -- associating a user's sesson with a particular Tomcat instance
454     in the presence of multiple, load-balancing servers.</p>
455     <p>Beyond this list of basic attributes, any number of other attributes
456     can be sent via the <code>req_attribute</code> code <code>0x0A</code>.
457     A pair of strings to represent the attribute name and value are sent
458     immediately after each instance of that code.  Environment values are passed
459     in via this method.</p>
460     <p>Finally, after all the attributes have been sent, the attribute
461     terminator, <code>0xFF</code>, is sent.  This signals both the end of the
462     list of attributes and also then end of the Request Packet.</p>
463   
464 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
465 <div class="section">
466 <h2><a name="resppacketstruct" id="resppacketstruct">Response Packet Structure</a></h2>
467     <p>for messages which the container can send back to the server.</p>
468     <div class="example"><pre>
469 AJP13_SEND_BODY_CHUNK :=
470   prefix_code   3
471   chunk_length  (integer)
472   chunk        *(byte)
473
474
475 AJP13_SEND_HEADERS :=
476   prefix_code       4
477   http_status_code  (integer)
478   http_status_msg   (string)
479   num_headers       (integer)
480   response_headers *(res_header_name header_value)
481
482 res_header_name :=
483     sc_res_header_name | (string)   [see below for how this is parsed]
484
485 sc_res_header_name := 0xA0 (byte)
486
487 header_value := (string)
488
489 AJP13_END_RESPONSE :=
490   prefix_code       5
491   reuse             (boolean)
492
493
494 AJP13_GET_BODY_CHUNK :=
495   prefix_code       6
496   requested_length  (integer)
497     </pre></div>
498   <h3>Details:</h3>
499   <h3>Send Body Chunk</h3>
500     <p>The chunk is basically binary data, and is sent directly back to the
501     browser.</p>
502   
503   <h3>Send Headers</h3>
504     <p>The status code and message are the usual HTTP things
505     (e.g. <code>200</code> and <code>OK</code>). The response header names are
506     encoded the same way the request header names are. See header_encoding above
507     for details about how the the codes are distinguished from the strings.<br />
508     The codes for common headers are:</p>
509     <p><table>
510       <tr><td>Name</td><td>Code value</td></tr>
511       <tr><td>Content-Type</td><td>0xA001</td></tr>
512       <tr><td>Content-Language</td><td>0xA002</td></tr>
513       <tr><td>Content-Length</td><td>0xA003</td></tr>
514       <tr><td>Date</td><td>0xA004</td></tr>
515       <tr><td>Last-Modified</td><td>0xA005</td></tr>
516       <tr><td>Location</td><td>0xA006</td></tr>
517       <tr><td>Set-Cookie</td><td>0xA007</td></tr>
518       <tr><td>Set-Cookie2</td><td>0xA008</td></tr>
519       <tr><td>Servlet-Engine</td><td>0xA009</td></tr>
520       <tr><td>Status</td><td>0xA00A</td></tr>
521       <tr><td>WWW-Authenticate</td><td>0xA00B</td></tr>
522     </table></p>
523     <p> After the code or the string header name, the header value is
524     immediately encoded.</p>
525   
526   <h3>End Response</h3>
527     <p>Signals the end of this request-handling cycle.  If the
528     <code>reuse</code> flag is true <code>(==1)</code>, this TCP connection can
529     now be used to handle new incoming requests.  If <code>reuse</code> is false
530     (anything other than 1 in the actual C code), the connection should
531     be closed.</p>
532   
533   <h3>Get Body Chunk</h3>
534     <p>The container asks for more data from the request (If the body was
535     too large to fit in the first packet sent over or when the request is
536     chuncked). The server will send a body packet back with an amount of data
537     which is the minimum of the <code>request_length</code>, the maximum send
538     body size <code>(8186 (8 Kbytes - 6))</code>, and the number of bytes
539     actually left to send from the request body.<br />
540     If there is no more data in the body (i.e. the servlet container is
541     trying to read past the end of the body), the server will send back an
542     <em>empty</em> packet, which is a body packet with a payload length of 0.
543     <code>(0x12,0x34,0x00,0x00)</code></p>
544   
545 </div>
546 </div>
547 <div class="bottomlang">
548 <p><span>Available Languages: </span><a href="../en/mod/mod_proxy_ajp.html" title="English">&nbsp;en&nbsp;</a></p>
549 </div><div id="footer">
550 <p class="apache">Copyright 1999-2004 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
551 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>
552 </body></html>