Annotation of win32/apache13/src/include/http_protocol.h, revision 1.1

1.1     ! parser      1: /* ====================================================================
        !             2:  * Copyright (c) 1995-1999 The Apache Group.  All rights reserved.
        !             3:  *
        !             4:  * Redistribution and use in source and binary forms, with or without
        !             5:  * modification, are permitted provided that the following conditions
        !             6:  * are met:
        !             7:  *
        !             8:  * 1. Redistributions of source code must retain the above copyright
        !             9:  *    notice, this list of conditions and the following disclaimer.
        !            10:  *
        !            11:  * 2. Redistributions in binary form must reproduce the above copyright
        !            12:  *    notice, this list of conditions and the following disclaimer in
        !            13:  *    the documentation and/or other materials provided with the
        !            14:  *    distribution.
        !            15:  *
        !            16:  * 3. All advertising materials mentioning features or use of this
        !            17:  *    software must display the following acknowledgment:
        !            18:  *    "This product includes software developed by the Apache Group
        !            19:  *    for use in the Apache HTTP server project (http://www.apache.org/)."
        !            20:  *
        !            21:  * 4. The names "Apache Server" and "Apache Group" must not be used to
        !            22:  *    endorse or promote products derived from this software without
        !            23:  *    prior written permission. For written permission, please contact
        !            24:  *    apache@apache.org.
        !            25:  *
        !            26:  * 5. Products derived from this software may not be called "Apache"
        !            27:  *    nor may "Apache" appear in their names without prior written
        !            28:  *    permission of the Apache Group.
        !            29:  *
        !            30:  * 6. Redistributions of any form whatsoever must retain the following
        !            31:  *    acknowledgment:
        !            32:  *    "This product includes software developed by the Apache Group
        !            33:  *    for use in the Apache HTTP server project (http://www.apache.org/)."
        !            34:  *
        !            35:  * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
        !            36:  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        !            37:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
        !            38:  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
        !            39:  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
        !            40:  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
        !            41:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
        !            42:  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
        !            43:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
        !            44:  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
        !            45:  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
        !            46:  * OF THE POSSIBILITY OF SUCH DAMAGE.
        !            47:  * ====================================================================
        !            48:  *
        !            49:  * This software consists of voluntary contributions made by many
        !            50:  * individuals on behalf of the Apache Group and was originally based
        !            51:  * on public domain software written at the National Center for
        !            52:  * Supercomputing Applications, University of Illinois, Urbana-Champaign.
        !            53:  * For more information on the Apache Group and the Apache HTTP server
        !            54:  * project, please see <http://www.apache.org/>.
        !            55:  *
        !            56:  */
        !            57: 
        !            58: #ifndef APACHE_HTTP_PROTOCOL_H
        !            59: #define APACHE_HTTP_PROTOCOL_H
        !            60: 
        !            61: #ifdef __cplusplus
        !            62: extern "C" {
        !            63: #endif
        !            64: 
        !            65: /*
        !            66:  * Prototypes for routines which either talk directly back to the user,
        !            67:  * or control the ones that eventually do.
        !            68:  */
        !            69: 
        !            70: /* Read a request and fill in the fields. */
        !            71: 
        !            72: request_rec *ap_read_request(conn_rec *c);
        !            73: 
        !            74: /* Send a single HTTP header field */
        !            75: 
        !            76: API_EXPORT_NONSTD(int) ap_send_header_field(request_rec *r, const char *fieldname,
        !            77:                       const char *fieldval);
        !            78: 
        !            79: /* Send the minimal part of an HTTP response header... but modules should be
        !            80:  * very careful about using this, and should prefer ap_send_http_header().
        !            81:  * Much of the HTTP/1.1 implementation correctness depends on code in
        !            82:  * ap_send_http_header().
        !            83:  */
        !            84: API_EXPORT(void) ap_basic_http_header(request_rec *r);
        !            85: 
        !            86: /* Send the Status-Line and header fields for HTTP response */
        !            87: 
        !            88: API_EXPORT(void) ap_send_http_header(request_rec *l);
        !            89: 
        !            90: /* Send the response to special method requests */
        !            91: 
        !            92: API_EXPORT(int) ap_send_http_trace(request_rec *r);
        !            93: int ap_send_http_options(request_rec *r);
        !            94: 
        !            95: /* Finish up stuff after a request */
        !            96: 
        !            97: API_EXPORT(void) ap_finalize_request_protocol(request_rec *r);
        !            98: 
        !            99: /* Send error back to client... last arg indicates error status in case
        !           100:  * we get an error in the process of trying to deal with an ErrorDocument
        !           101:  * to handle some other error.  In that case, we print the default report
        !           102:  * for the first thing that went wrong, and more briefly report on the
        !           103:  * problem with the ErrorDocument.
        !           104:  */
        !           105: 
        !           106: API_EXPORT(void) ap_send_error_response(request_rec *r, int recursive_error);
        !           107: 
        !           108: /* Set last modified header line from the lastmod date of the associated file.
        !           109:  * Also, set content length.
        !           110:  *
        !           111:  * May return an error status, typically USE_LOCAL_COPY (that when the
        !           112:  * permit_cache argument is set to one).
        !           113:  */
        !           114: 
        !           115: API_EXPORT(int) ap_set_content_length(request_rec *r, long length);
        !           116: API_EXPORT(int) ap_set_keepalive(request_rec *r);
        !           117: API_EXPORT(time_t) ap_rationalize_mtime(request_rec *r, time_t mtime);
        !           118: API_EXPORT(char *) ap_make_etag(request_rec *r, int force_weak);
        !           119: API_EXPORT(void) ap_set_etag(request_rec *r);
        !           120: API_EXPORT(void) ap_set_last_modified(request_rec *r);
        !           121: API_EXPORT(int) ap_meets_conditions(request_rec *r);
        !           122: 
        !           123: /* Other ways to send stuff at the client.  All of these keep track
        !           124:  * of bytes_sent automatically.  This indirection is intended to make
        !           125:  * it a little more painless to slide things like HTTP-NG packetization
        !           126:  * underneath the main body of the code later.  In the meantime, it lets
        !           127:  * us centralize a bit of accounting (bytes_sent).
        !           128:  *
        !           129:  * These also return the number of bytes written by the call.
        !           130:  * They should only be called with a timeout registered, for obvious reaasons.
        !           131:  * (Ditto the send_header stuff).
        !           132:  */
        !           133: 
        !           134: API_EXPORT(long) ap_send_fd(FILE *f, request_rec *r);
        !           135: API_EXPORT(long) ap_send_fd_length(FILE *f, request_rec *r, long length);
        !           136: 
        !           137: API_EXPORT(long) ap_send_fb(BUFF *f, request_rec *r);
        !           138: API_EXPORT(long) ap_send_fb_length(BUFF *f, request_rec *r, long length);
        !           139: 
        !           140: API_EXPORT(size_t) ap_send_mmap(void *mm, request_rec *r, size_t offset,
        !           141:                              size_t length);
        !           142: 
        !           143: /* Hmmm... could macrofy these for now, and maybe forever, though the
        !           144:  * definitions of the macros would get a whole lot hairier.
        !           145:  */
        !           146: 
        !           147: API_EXPORT(int) ap_rputc(int c, request_rec *r);
        !           148: API_EXPORT(int) ap_rputs(const char *str, request_rec *r);
        !           149: API_EXPORT(int) ap_rwrite(const void *buf, int nbyte, request_rec *r);
        !           150: API_EXPORT_NONSTD(int) ap_rvputs(request_rec *r,...);
        !           151: API_EXPORT(int) ap_vrprintf(request_rec *r, const char *fmt, va_list vlist);
        !           152: API_EXPORT_NONSTD(int) ap_rprintf(request_rec *r, const char *fmt,...)
        !           153:                                __attribute__((format(printf,2,3)));
        !           154: API_EXPORT(int) ap_rflush(request_rec *r);
        !           155: 
        !           156: /*
        !           157:  * Index used in custom_responses array for a specific error code
        !           158:  * (only use outside protocol.c is in getting them configured).
        !           159:  */
        !           160: 
        !           161: API_EXPORT(int) ap_index_of_response(int status);
        !           162: 
        !           163: /* Reading a block of data from the client connection (e.g., POST arg) */
        !           164: 
        !           165: API_EXPORT(int) ap_setup_client_block(request_rec *r, int read_policy);
        !           166: API_EXPORT(int) ap_should_client_block(request_rec *r);
        !           167: API_EXPORT(long) ap_get_client_block(request_rec *r, char *buffer, int bufsiz);
        !           168: API_EXPORT(int) ap_discard_request_body(request_rec *r);
        !           169: 
        !           170: /* Sending a byterange */
        !           171: 
        !           172: API_EXPORT(int) ap_set_byterange(request_rec *r);
        !           173: API_EXPORT(int) ap_each_byterange(request_rec *r, long *offset, long *length);
        !           174: 
        !           175: /* Support for the Basic authentication protocol.  Note that there's
        !           176:  * nothing that prevents these from being in mod_auth.c, except that other
        !           177:  * modules which wanted to provide their own variants on finding users and
        !           178:  * passwords for Basic auth (a fairly common request) would then require
        !           179:  * mod_auth to be loaded or they wouldn't work.
        !           180:  *
        !           181:  * get_basic_auth_pw returns 0 (OK) if it set the 'pw' argument (and assured
        !           182:  * a correct value in r->connection->user); otherwise it returns an error
        !           183:  * code, either SERVER_ERROR if things are really confused, AUTH_REQUIRED
        !           184:  * if no authentication at all seemed to be in use, or DECLINED if there
        !           185:  * was authentication but it wasn't Basic (in which case, the caller should
        !           186:  * presumably decline as well).
        !           187:  *
        !           188:  * note_basic_auth_failure arranges for the right stuff to be scribbled on
        !           189:  * the HTTP return so that the client knows how to authenticate itself the
        !           190:  * next time. As does note_digest_auth_failure for Digest auth.
        !           191:  *
        !           192:  * note_auth_failure does the same thing, but will call the correct one
        !           193:  * based on the authentication type in use.
        !           194:  *
        !           195:  */
        !           196: 
        !           197: API_EXPORT(void) ap_note_auth_failure(request_rec *r);
        !           198: API_EXPORT(void) ap_note_basic_auth_failure(request_rec *r);
        !           199: API_EXPORT(void) ap_note_digest_auth_failure(request_rec *r);
        !           200: API_EXPORT(int) ap_get_basic_auth_pw(request_rec *r, const char **pw);
        !           201: 
        !           202: /*
        !           203:  * Setting up the protocol fields for subsidiary requests...
        !           204:  * Also, a wrapup function to keep the internal accounting straight.
        !           205:  */
        !           206: 
        !           207: void ap_set_sub_req_protocol(request_rec *rnew, const request_rec *r);
        !           208: void ap_finalize_sub_req_protocol(request_rec *sub_r);
        !           209: 
        !           210: /* This is also useful for putting sub_reqs and internal_redirects together */
        !           211: 
        !           212: CORE_EXPORT(void) ap_parse_uri(request_rec *r, const char *uri);
        !           213: 
        !           214: /* Get the method number associated with the given string, assumed to
        !           215:  * contain an HTTP method.  Returns M_INVALID if not recognized.
        !           216:  */
        !           217: API_EXPORT(int) ap_method_number_of(const char *method);
        !           218: 
        !           219: #ifdef __cplusplus
        !           220: }
        !           221: #endif
        !           222: 
        !           223: #endif /* !APACHE_HTTP_PROTOCOL_H */

E-mail: