Minor cleanup (more needed).
[catagits/fcgi2.git] / doc / fastcgi-prog-guide / apaman.htm
index 464dd3f..7ae2209 100755 (executable)
@@ -1,4 +1,4 @@
-<html><head><title></title></head>
+<html><head><title>FCGI_Accept(2) Man Page</title></head>
 <body bgcolor=#ffffff>
  
 <a href="cover.htm">[Top]</a> <a href="ch4tcl.htm">[Prev]</a> <a href="ap_guida.htm">[Next]</a> <a href="ap_guida.htm">[Bottom]</a>
@@ -6,21 +6,21 @@
  
 <a name="3601">
 <center><h1>A FastCGI <br>Reference Pages</h1></center>
-</a><a name="95882">
+</a><a name="95882"></a>
 This appendix contains reference pages for the following FastCGI routines from the <code>fcgi_stdio</code> library:<p>
-</a><ul><a name="95884">
+<ul><a name="95884"></a>
 <li><code>FCGI_Accept</code>
-</a><a name="95885">
+<a name="95885"></a>
 <li><code>FCGI_Start_Filter_Data</code>
-</a><a name="95859">
+<a name="95859"></a>
 <li><code>FCGI_SetExitStatus</code>
-</a></ul><a name="95860">
+</ul><a name="95860">
 <h1> FCGI_Accept (3)</h1>
 </a><a name="95861">
 <h2> Name</h2>
-</a><a name="95637">
+</a><a name="95637"></a>
 <code>FCGI_Accept, FCGI_ToFILE, FCGI_ToFcgiStream</code> - fcgi_stdio compatibility library<p>
-</a><a name="95652">
+<a name="95652">
 <h2> Synopsis</h2>
 </a><pre><a name="95669">
 #include &lt;fcgi_stdio.h&gt;
@@ -36,33 +36,33 @@ FCGI_Stream * <br>FCGI_ToFcgiStream(FCGI_FILE *);
 </a>
 </pre><a name="95656">
 <h2> Description </h2>
-</a><a name="95683">
+</a><a name="95683"></a>
 The FCGI_Accept function accepts a new request from the HTTP server and creates a CGI-compatible execution environment for the request.<p>
-</a><a name="95657">
+<a name="95657"></a>
 If the application was invoked as a CGI program, the first call to FCGI_Accept is essentially a no-op and the second call returns -1. This causes a correctly coded FastCGI application to run a single request and exit, giving CGI behavior.<p>
-</a><a name="95658">
+<a name="95658"></a>
 If the application was invoked as a FastCGI server, the first call to FCGI_Accept indicates that the application has completed its initialization and is ready to accept its first request. Subsequent calls to FCGI_Accept indicate that the application has completed processing its current request and is ready to accept a new request.<p>
-</a><a name="95659">
+<a name="95659"></a>
 In completing the current request, FCGI_Accept may detect errors, such as a broken pipe to a client who has disconnected early. FCGI_Accept ignores such errors. An application that wishes to handle such errors should explicitly call fclose(stderr), then fclose(stdout); an EOF return from either one indicates an error.<p>
-</a><a name="95660">
+<a name="95660"></a>
 After accepting a new request, FCGI_Accept assigns new values to the global variables stdin, stdout, stderr, and environ. After FCGI_Accept returns, these variables have the same interpretation as on entry to a CGI program.<p>
-</a><a name="95661">
+<a name="95661"></a>
 In addition to the standard CGI environment variables, the environment variable <code>FCGI_ROLE</code> is always set to the role of the current request. The roles currently defined are <code>RESPONDER, AUTHORIZER</code>, and <code>FILTER</code>.<p>
-</a><a name="95662">
+<a name="95662"></a>
 In the <code>FILTER</code> role, the additional variables <code>FCGI_DATA_LENGTH</code> and <code>FCGI_DATA_LAST_MOD</code> are also defined. See <code>FCGI_StartFilterData</code><code>(3</code>) for complete information.<p>
-</a><a name="95663">
+<a name="95663"></a>
 The macros <code>FCGI_ToFILE</code> and <code>FCGI_ToFcgiStream</code> are provided to allow escape to native functions that use the types <code>FILE</code> or <code>FCGI_Stream</code>. In the case of <code>FILE</code>, functions would have to be separately compiled, since <code>fcgi_stdio.h</code> replaces the standard <code>FILE</code> with <code>FCGI_FILE</code>.<p>
-</a><a name="95664">
+<a name="95664">
 <h2> Return Values</h2>
-</a><a name="95686">
+</a><a name="95686"></a>
 0 for successful call, -1 for error (application should exit).<p>
-</a><a name="95309">
+<a name="95309">
 <h1> FCGI_StartFilterData (3)</h1>
 </a><a name="95310">
 <h2> Name</h2>
-</a><a name="95311">
+</a><a name="95311"></a>
 <code>FCGI_StartFilterData</code> -<code>fcgi_stdio</code> compatibility library<p>
-</a><a name="95312">
+<a name="95312">
 <h2> Synopsis</h2>
 </a><pre><a name="95313">
 #include &lt;fcgi_stdio.h&gt;
@@ -72,25 +72,25 @@ int FCGI_StartFilterData(void)
 </a>
 </pre><a name="95315">
 <h2> Description</h2>
-</a><a name="95728">
+</a><a name="95728"></a>
 Enables a FastCGI Filter application to begin reading its filter input data from <code>stdin</code>.<p>
-</a><a name="95729">
+<a name="95729"></a>
 In order to call <code>FCGI_StartFilterData</code>, the FastCGI application should have been invoked in the filter role (<code>getenv("FCGI_ROLE") == "FILTER"</code>), and should have read <code>stdin</code> to EOF, consuming the entire <code>FCGI_STDIN</code> data stream. The call to <code>FCGI_StartFilterData</code> positions stdin at the start of <code>FCGI_DATA</code>.<p>
-</a><a name="95730">
+<a name="95730"></a>
 If the preconditions are not met (e.g., the application has not read <code>stdin</code> to EOF), <code>FCGI_StartFilterData</code> returns a negative result, and the application will get EOF on attempts to read from <code>stdin</code>.<p>
-</a><a name="95731">
+<a name="95731"></a>
 The application can determine the number of bytes available on <code>FCGI_DATA</code> by performing <code>atoi(getenv("FCGI_DATA_LENGTH")</code>. If fewer than this many bytes are delivered on <code>stdin</code> after calling <code>FCGI_StartFilterData</code>, the application should perform an application-specific error response. If the application normally makes an update, most likely it should abort the update.<p>
-</a><a name="95732">
+<a name="95732"></a>
 The application can determine last modification time of the filter input data by performing <code>getenv("FCGI_DATA_LAST_MOD").</code> This allows applications to perform caching based on last modification time.<p>
-</a><a name="95733">
+<a name="95733">
 <h2> Return Values</h2>
-</a><a name="95322">
+</a><a name="95322"></a>
 Returns 0 on success and a negative integer on failure. <p>
-</a><a name="95323">
+<a name="95323">
 <h2> Example</h2>
-</a><a name="95363">
+</a><a name="95363"></a>
 The following example reads in all the client data, but ignores it. Then, the code calls <code>FCGI_StartFilterData</code>. Finally, the code reads in the file to be filtered and simply echos it back to the client. <p>
-</a><pre><a name="95324">
+<pre><a name="95324">
 while (FCGI_Accept() &gt;= 0) {
 </a>
 <a name="95325">
@@ -139,9 +139,9 @@ while (FCGI_Accept() &gt;= 0) {
 <h1> FCGI_SetExitStatus(3)</h1>
 </a><a name="95793">
 <h2> Name </h2>
-</a><a name="95794">
+</a><a name="95794"></a>
 <code>FCGI_SetExitStatus</code> - <code>fcgi_stdio</code> compatibility library<p>
-</a><a name="95786">
+<a name="95786">
 <h2> Synopsis </h2>
 </a><pre><a name="95795">
 #include &lt;fcgi_stdio.h&gt;
@@ -151,13 +151,13 @@ void FCGI_SetExitStatus(int status);
 </a>
 </pre><a name="95788">
 <h2> Description </h2>
-</a><a name="95796">
+</a><a name="95796"></a>
 Sets the exit status for the current FastCGI request. The exit status is the status code the request would have exited with, had the request been run as a CGI program.<p>
-</a><a name="95789">
+<a name="95789"></a>
 You can call <code>FCGI_SetExitStatus</code> several times during a request; the last call before the request ends determines the value.<p>
-</a><a name="95797">
+<a name="95797"></a>
 <p>
-</a>
+
 <hr><br>
  
 <a href="cover.htm">[Top]</a> <a href="ch4tcl.htm">[Prev]</a> <a href="ap_guida.htm">[Next]</a> <a href="ap_guida.htm">[Bottom]</a>