http_protocol.h revision 2864362ca8266097928e84f101010bdf814ffa08
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder/* ====================================================================
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * The Apache Software License, Version 1.1
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * Redistribution and use in source and binary forms, with or without
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * modification, are permitted provided that the following conditions
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * 1. Redistributions of source code must retain the above copyright
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * notice, this list of conditions and the following disclaimer.
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * 2. Redistributions in binary form must reproduce the above copyright
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * notice, this list of conditions and the following disclaimer in
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * the documentation and/or other materials provided with the
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * distribution.
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * 3. The end-user documentation included with the redistribution,
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * if any, must include the following acknowledgment:
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * "This product includes software developed by the
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * Apache Software Foundation (http://www.apache.org/)."
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * Alternately, this acknowledgment may appear in the software itself,
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * if and wherever such third-party acknowledgments normally appear.
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * 4. The names "Apache" and "Apache Software Foundation" must
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * not be used to endorse or promote products derived from this
79e28be65fd0bc65adf266d5ae4f6deb92546bf7Christian Maeder * software without prior written permission. For written
79e28be65fd0bc65adf266d5ae4f6deb92546bf7Christian Maeder * permission, please contact apache@apache.org.
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * 5. Products derived from this software may not be called "Apache",
5b55761e0df088c5b41183fb83106bfd02a61fa2Christian Maeder * nor may "Apache" appear in their name, without prior written
5b55761e0df088c5b41183fb83106bfd02a61fa2Christian Maeder * permission of the Apache Software Foundation.
5b55761e0df088c5b41183fb83106bfd02a61fa2Christian Maeder * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
5b55761e0df088c5b41183fb83106bfd02a61fa2Christian Maeder * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
5b55761e0df088c5b41183fb83106bfd02a61fa2Christian Maeder * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
5b55761e0df088c5b41183fb83106bfd02a61fa2Christian Maeder * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
5b55761e0df088c5b41183fb83106bfd02a61fa2Christian Maeder * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
5b55761e0df088c5b41183fb83106bfd02a61fa2Christian Maeder * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
5b55761e0df088c5b41183fb83106bfd02a61fa2Christian Maeder * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
5b55761e0df088c5b41183fb83106bfd02a61fa2Christian Maeder * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
5b55761e0df088c5b41183fb83106bfd02a61fa2Christian Maeder * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * SUCH DAMAGE.
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * ====================================================================
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * This software consists of voluntary contributions made by many
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * individuals on behalf of the Apache Software Foundation. For more
5b55761e0df088c5b41183fb83106bfd02a61fa2Christian Maeder * information on the Apache Software Foundation, please see
5b55761e0df088c5b41183fb83106bfd02a61fa2Christian Maeder * Portions of this software are based upon public domain software
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * originally written at the National Center for Supercomputing Applications,
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * University of Illinois, Urbana-Champaign.
5b55761e0df088c5b41183fb83106bfd02a61fa2Christian Maeder * @package HTTP protocol handling
5b55761e0df088c5b41183fb83106bfd02a61fa2Christian Maeder/* This is an optimization. We keep a record of the filter_rec that
5b55761e0df088c5b41183fb83106bfd02a61fa2Christian Maeder * stores the old_write filter, so that we can avoid strcmp's later.
5b55761e0df088c5b41183fb83106bfd02a61fa2Christian MaederAP_DECLARE_DATA extern ap_filter_rec_t *ap_old_write_func;
5b55761e0df088c5b41183fb83106bfd02a61fa2Christian Maeder * Prototypes for routines which either talk directly back to the user,
5b55761e0df088c5b41183fb83106bfd02a61fa2Christian Maeder * or control the ones that eventually do.
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * Read a request and fill in the fields.
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * @param c The current connection
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * @return The new request_rec
79e28be65fd0bc65adf266d5ae4f6deb92546bf7Christian Maeder/* Finish up stuff after a request */
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * Called at completion of sending the response. It sends the terminating
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * protocol information.
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * @param r The current request
5b55761e0df088c5b41183fb83106bfd02a61fa2Christian Maeder * @deffunc void ap_finalize_request_protocol(request_rec *r)
57dc8a87418e235e3d0621fb90728054044a9ef9Christian MaederAP_DECLARE(void) ap_finalize_request_protocol(request_rec *r);
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * Send error back to client.
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * @param r The current request
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * @param recursive_error last arg indicates error status in case we get
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * an error in the process of trying to deal with an ErrorDocument
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * to handle some other error. In that case, we print the default
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * report for the first thing that went wrong, and more briefly report
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * on the problem with the ErrorDocument.
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * @deffunc void ap_send_error_response(request_rec *r, int recursive_error)
57dc8a87418e235e3d0621fb90728054044a9ef9Christian MaederAP_DECLARE(void) ap_send_error_response(request_rec *r, int recursive_error);
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder/* Set last modified header line from the lastmod date of the associated file.
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * Also, set content length.
5b55761e0df088c5b41183fb83106bfd02a61fa2Christian Maeder * May return an error status, typically HTTP_NOT_MODIFIED (that when the
5b55761e0df088c5b41183fb83106bfd02a61fa2Christian Maeder * permit_cache argument is set to one).
5b55761e0df088c5b41183fb83106bfd02a61fa2Christian Maeder * Set the content length for this request
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * @param r The current request
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * @param length The new content length
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * @deffunc void ap_set_content_length(request_rec *r, apr_off_t length)
89026e63176e6e40c7be1bbc542326f0d29d8108Christian MaederAP_DECLARE(void) ap_set_content_length(request_rec *r, apr_off_t length);
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * Set the keepalive status for this request
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * @param r The current request
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * @return 1 if keepalive can be set, 0 otherwise
89026e63176e6e40c7be1bbc542326f0d29d8108Christian Maeder * @deffunc int ap_set_keepalive(request_rec *r)
89026e63176e6e40c7be1bbc542326f0d29d8108Christian MaederAP_DECLARE(int) ap_set_keepalive(request_rec *r);
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * Return the latest rational time from a request/mtime pair. Mtime is
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * returned unless it's in the future, in which case we return the current time.
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * @param r The current request
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * @param mtime The last modified time
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * @return the latest rational time.
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * @deffunc apr_time_t ap_rationalize_mtime(request_rec *r, apr_time_t mtime)
8ab0f7627987d45eb3fe36845a91694977ca5cdbChristian MaederAP_DECLARE(apr_time_t) ap_rationalize_mtime(request_rec *r, apr_time_t mtime);
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * Build the content-type that should be sent to the client from the
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * content-type specified. The following rules are followed:
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * - if type is NULL, type is set to ap_default_type(r)
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * - if charset adding is disabled, stop processing and return type.
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * - then, if there are no parameters on type, add the default charset
4620e43bc9fa96506bd78ed6b3e5318b08de5996Christian Maeder * - return type
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * @param r The current request
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * @return The content-type
57dc8a87418e235e3d0621fb90728054044a9ef9Christian Maeder * @deffunc const char *ap_make_content_type(request_rec *r, const char *type);
57dc8a87418e235e3d0621fb90728054044a9ef9Christian MaederAP_DECLARE(const char *) ap_make_content_type(request_rec *r, const char *type);
* @deffunc apr_status_t ap_send_fd(apr_file_t *fd, request_rec *r, apr_off_t offset, apr_size_t length, apr_size_t *nbytes);
#if APR_HAS_MMAP
int mnum),
void *rec,
int mnum),
const char *method);
* (only use outside protocol.c is in getting them configured).
struct ap_bucket_error {
int status;
const char *data;
* @deffunc apr_bucket *ap_bucket_error_make(apr_bucket *b, int error, const char *buf, apr_pool_t *p)
#ifdef __cplusplus