http_protocol.h revision 346029f34d03eb20d84fc35664426d3874b00f9e
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek/* ====================================================================
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * The Apache Software License, Version 1.1
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * Copyright (c) 2000-2001 The Apache Software Foundation. All rights
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * Redistribution and use in source and binary forms, with or without
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * modification, are permitted provided that the following conditions
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * 1. Redistributions of source code must retain the above copyright
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * notice, this list of conditions and the following disclaimer.
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * 2. Redistributions in binary form must reproduce the above copyright
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * notice, this list of conditions and the following disclaimer in
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * the documentation and/or other materials provided with the
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * 3. The end-user documentation included with the redistribution,
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * if any, must include the following acknowledgment:
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * "This product includes software developed by the
b5efdb8af40ea759a1ea584c1bc44ecc81dd00ceLennart Poettering * Apache Software Foundation (http://www.apache.org/)."
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * Alternately, this acknowledgment may appear in the software itself,
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * if and wherever such third-party acknowledgments normally appear.
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering * 4. The names "Apache" and "Apache Software Foundation" must
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * not be used to endorse or promote products derived from this
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * software without prior written permission. For written
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * permission, please contact apache@apache.org.
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * 5. Products derived from this software may not be called "Apache",
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * nor may "Apache" appear in their name, without prior written
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * permission of the Apache Software Foundation.
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * ====================================================================
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * This software consists of voluntary contributions made by many
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * individuals on behalf of the Apache Software Foundation. For more
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * information on the Apache Software Foundation, please see
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * Portions of this software are based upon public domain software
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * originally written at the National Center for Supercomputing Applications,
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * University of Illinois, Urbana-Champaign.
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * @package HTTP protocol handling
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * Prototypes for routines which either talk directly back to the user,
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * or control the ones that eventually do.
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * Read a request and fill in the fields.
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * @param c The current connection
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * @return The new request_rec
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmekrequest_rec *ap_read_request(conn_rec *c);
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek/* Finish up stuff after a request */
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * Called at completion of sending the response. It sends the terminating
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * protocol information.
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * @param r The current request
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * @deffunc void ap_finalize_request_protocol(request_rec *r)
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-SzmekAP_DECLARE(void) ap_finalize_request_protocol(request_rec *r);
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * Send error back to client.
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * @param r The current request
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * @param recursive_error last arg indicates error status in case we get
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * an error in the process of trying to deal with an ErrorDocument
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * to handle some other error. In that case, we print the default
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * report for the first thing that went wrong, and more briefly report
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * on the problem with the ErrorDocument.
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * @deffunc void ap_send_error_response(request_rec *r, int recursive_error)
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-SzmekAP_DECLARE(void) ap_send_error_response(request_rec *r, int recursive_error);
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek/* Set last modified header line from the lastmod date of the associated file.
a75f4e2a02e287294b21ae9e5b1f28b2f8faea39Zbigniew Jędrzejewski-Szmek * Also, set content length.
a75f4e2a02e287294b21ae9e5b1f28b2f8faea39Zbigniew Jędrzejewski-Szmek * May return an error status, typically HTTP_NOT_MODIFIED (that when the
a75f4e2a02e287294b21ae9e5b1f28b2f8faea39Zbigniew Jędrzejewski-Szmek * permit_cache argument is set to one).
a75f4e2a02e287294b21ae9e5b1f28b2f8faea39Zbigniew Jędrzejewski-Szmek * Set the content length for this request
a75f4e2a02e287294b21ae9e5b1f28b2f8faea39Zbigniew Jędrzejewski-Szmek * @param r The current request
a75f4e2a02e287294b21ae9e5b1f28b2f8faea39Zbigniew Jędrzejewski-Szmek * @param length The new content length
a75f4e2a02e287294b21ae9e5b1f28b2f8faea39Zbigniew Jędrzejewski-Szmek * @deffunc void ap_set_content_length(request_rec *r, apr_off_t length)
a75f4e2a02e287294b21ae9e5b1f28b2f8faea39Zbigniew Jędrzejewski-SzmekAP_DECLARE(void) ap_set_content_length(request_rec *r, apr_off_t length);
a75f4e2a02e287294b21ae9e5b1f28b2f8faea39Zbigniew Jędrzejewski-Szmek * Set the keepalive status for this request
b9f111b93f9f442f00266f338b14f25ca8685352Zbigniew Jędrzejewski-Szmek * @param r The current request
b9f111b93f9f442f00266f338b14f25ca8685352Zbigniew Jędrzejewski-Szmek * @return 1 if keepalive can be set, 0 otherwise
b9f111b93f9f442f00266f338b14f25ca8685352Zbigniew Jędrzejewski-Szmek * @deffunc int ap_set_keepalive(request_rec *r)
b9f111b93f9f442f00266f338b14f25ca8685352Zbigniew Jędrzejewski-SzmekAP_DECLARE(int) ap_set_keepalive(request_rec *r);
b9f111b93f9f442f00266f338b14f25ca8685352Zbigniew Jędrzejewski-Szmek * Return the latest rational time from a request/mtime pair. Mtime is
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * returned unless it's in the future, in which case we return the current time.
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * @param r The current request
a75f4e2a02e287294b21ae9e5b1f28b2f8faea39Zbigniew Jędrzejewski-Szmek * @param mtime The last modified time
b9f111b93f9f442f00266f338b14f25ca8685352Zbigniew Jędrzejewski-Szmek * @return the latest rational time.
d15d0333be6a1ca7fdd99a1881d967b6be8f387aZbigniew Jędrzejewski-Szmek * @deffunc apr_time_t ap_rationalize_mtime(request_rec *r, apr_time_t mtime)
* @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