home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 8 / CDACTUAL8.iso / share / os2 / varios / apache / http_pro.h < prev    next >
Encoding:
Text File  |  1996-05-27  |  6.9 KB  |  174 lines

  1.  
  2. /* ====================================================================
  3.  * Copyright (c) 1995 The Apache Group.  All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  *
  9.  * 1. Redistributions of source code must retain the above copyright
  10.  *    notice, this list of conditions and the following disclaimer. 
  11.  *
  12.  * 2. Redistributions in binary form must reproduce the above copyright
  13.  *    notice, this list of conditions and the following disclaimer in
  14.  *    the documentation and/or other materials provided with the
  15.  *    distribution.
  16.  *
  17.  * 3. All advertising materials mentioning features or use of this
  18.  *    software must display the following acknowledgment:
  19.  *    "This product includes software developed by the Apache Group
  20.  *    for use in the Apache HTTP server project (http://www.apache.org/)."
  21.  *
  22.  * 4. The names "Apache Server" and "Apache Group" must not be used to
  23.  *    endorse or promote products derived from this software without
  24.  *    prior written permission.
  25.  *
  26.  * 5. Redistributions of any form whatsoever must retain the following
  27.  *    acknowledgment:
  28.  *    "This product includes software developed by the Apache Group
  29.  *    for use in the Apache HTTP server project (http://www.apache.org/)."
  30.  *
  31.  * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
  32.  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  33.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  34.  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
  35.  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  36.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  37.  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  38.  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  39.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  40.  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  41.  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  42.  * OF THE POSSIBILITY OF SUCH DAMAGE.
  43.  * ====================================================================
  44.  *
  45.  * This software consists of voluntary contributions made by many
  46.  * individuals on behalf of the Apache Group and was originally based
  47.  * on public domain software written at the National Center for
  48.  * Supercomputing Applications, University of Illinois, Urbana-Champaign.
  49.  * For more information on the Apache Group and the Apache HTTP server
  50.  * project, please see <http://www.apache.org/>.
  51.  *
  52.  */
  53.  
  54.  
  55. /*
  56.  * Prototypes for routines which either talk directly back to the user,
  57.  * or control the ones that eventually do.
  58.  */
  59.  
  60. /* Read a request and fill in the fields. */
  61.  
  62. request_rec *read_request (conn_rec *c);
  63.  
  64. /* Send header for http response */
  65.  
  66. void send_http_header (request_rec *l);     
  67.      
  68. /* Send error back to client... last arg indicates error status in case
  69.  * we get an error in the process of trying to deal with an ErrorDocument
  70.  * to handle some other error.  In that case, we print the default report
  71.  * for the first thing that went wrong, and more briefly report on the
  72.  * problem with the ErrorDocument.
  73.  */
  74.  
  75. void send_error_response (request_rec *r, int recursive_error);
  76.      
  77. /* Set last modified header line from the lastmod date of the associated file.
  78.  * Also, set content length.
  79.  *
  80.  * May return an error status, typically USE_LOCAL_COPY (that when the
  81.  * permit_cache argument is set to one).
  82.  */
  83.  
  84. int set_content_length (request_rec *r, long length);
  85. int set_keepalive (request_rec *r);
  86. int set_last_modified (request_rec *r, time_t mtime);
  87.  
  88. void add_env_var (array_header *env, char *header_name, char *val);
  89.  
  90. /* Other ways to send stuff at the client.  All of these keep track
  91.  * of bytes_sent automatically.  This indirection is intended to make
  92.  * it a little more painless to slide things like HTTP-NG packetization
  93.  * underneath the main body of the code later.  In the meantime, it lets
  94.  * us centralize a bit of accounting (bytes_sent).
  95.  *
  96.  * These also return the number of bytes written by the call.
  97.  * They should only be called with a timeout registered, for obvious reaasons.
  98.  * (Ditto the send_header stuff).
  99.  */
  100.  
  101. long send_fd(FILE *f, request_rec *r);
  102.      
  103. /* Hmmm... could macrofy these for now, and maybe forever, though the
  104.  * definitions of the macros would get a whole lot hairier.
  105.  */
  106.      
  107. #if 0
  108. long rprintf (request_rec *r, char *s, ...);     
  109. #endif
  110. int rputc (int c, request_rec *r);     
  111. int rputs(const char *str, request_rec *r);
  112. int rvputs(request_rec *r, ...);
  113. int rprintf(request_rec *r,const char *fmt,...);
  114.      
  115. /*
  116.  * Index used in custom_responses array for a specific error code
  117.  * (only use outside protocol.c is in getting them configured).
  118.  */
  119.  
  120. int index_of_response (int status);
  121.  
  122. /* Reading a block of data from the client connection (e.g., POST arg) */
  123.      
  124. long read_client_block (request_rec *r, char *buffer, int bufsiz);
  125.      
  126. /* Finally, this charming little number is here to encapsulate the
  127.  * degree to which nph- scripts completely escape from any discipline
  128.  * the protocol code might care to impose (this as opposed to other
  129.  * scripts, which *partially* escape to the extent that they may try
  130.  * to explicitly set the status line).
  131.  */
  132.  
  133. void client_to_stdout (conn_rec *c); 
  134.  
  135.  
  136. /* Support for the Basic authentication protocol.  Note that there's
  137.  * nothing that prevents these from being in mod_auth.c, except that other
  138.  * modules which wanted to provide their own variants on finding users and
  139.  * passwords for Basic auth (a fairly common request) would then require
  140.  * mod_auth to be loaded or they wouldn't work.
  141.  *
  142.  * get_basic_auth_pw returns 0 (OK) if it set the 'pw' argument (and assured
  143.  * a correct value in r->connection->user); otherwise it returns an error
  144.  * code, either SERVER_ERROR if things are really confused, AUTH_REQUIRED
  145.  * if no authentication at all seemed to be in use, or DECLINED if there
  146.  * was authentication but it wasn't Basic (in which case, the caller should
  147.  * presumably decline as well).
  148.  *
  149.  * note_basic_auth_failure arranges for the right stuff to be scribbled on
  150.  * the HTTP return so that the client knows how to authenticate itself the
  151.  * next time. As does note_digest_auth_failure for Digest auth.
  152.  *
  153.  * note_auth_failure does the same thing, but will call the correct one
  154.  * based on the authentication type in use.
  155.  *
  156.  */
  157.  
  158. void note_auth_failure(request_rec *r);
  159. void note_basic_auth_failure(request_rec *r);
  160. void note_digest_auth_failure(request_rec *r);
  161. int get_basic_auth_pw (request_rec *r, char **pw);
  162.  
  163. /*
  164.  * Setting up the protocol fields for subsidiary requests...
  165.  * Also, a wrapup function to keep the internal accounting straight.
  166.  */
  167.  
  168. void set_sub_req_protocol (request_rec *rnew, request_rec *r);
  169. void finalize_sub_req_protocol (request_rec *sub_r);
  170.  
  171. /* This is also useful for putting sub_reqs and internal_redirects together */
  172.  
  173. void parse_uri (request_rec *r, char *uri);     
  174.