http_protocol.h revision 5a9667916c79d8c699b069068e5570aa1c331c80
6ae232055d4d8a97267517c5e50074c2c819941and/* ====================================================================
6ae232055d4d8a97267517c5e50074c2c819941and * The Apache Software License, Version 1.1
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd *
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd * reserved.
6ae232055d4d8a97267517c5e50074c2c819941and *
6ae232055d4d8a97267517c5e50074c2c819941and * Redistribution and use in source and binary forms, with or without
6ae232055d4d8a97267517c5e50074c2c819941and * modification, are permitted provided that the following conditions
6ae232055d4d8a97267517c5e50074c2c819941and * are met:
96ad5d81ee4a2cc66a4ae19893efc8aa6d06fae7jailletc *
6ae232055d4d8a97267517c5e50074c2c819941and * 1. Redistributions of source code must retain the above copyright
6ae232055d4d8a97267517c5e50074c2c819941and * notice, this list of conditions and the following disclaimer.
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen *
2e545ce2450a9953665f701bb05350f0d3f26275nd * 2. Redistributions in binary form must reproduce the above copyright
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * notice, this list of conditions and the following disclaimer in
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * the documentation and/or other materials provided with the
6ae232055d4d8a97267517c5e50074c2c819941and * distribution.
6ae232055d4d8a97267517c5e50074c2c819941and *
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen * 3. The end-user documentation included with the redistribution,
3f08db06526d6901aa08c110b5bc7dde6bc39905nd * if any, must include the following acknowledgment:
6ae232055d4d8a97267517c5e50074c2c819941and * "This product includes software developed by the
6ae232055d4d8a97267517c5e50074c2c819941and * Apache Software Foundation (http://www.apache.org/)."
6ae232055d4d8a97267517c5e50074c2c819941and * Alternately, this acknowledgment may appear in the software itself,
b43f840409794ed298e8634f6284741f193b6c4ftakashi * if and wherever such third-party acknowledgments normally appear.
6ae232055d4d8a97267517c5e50074c2c819941and *
b43f840409794ed298e8634f6284741f193b6c4ftakashi * 4. The names "Apache" and "Apache Software Foundation" must
af84459fbf938e508fd10b01cb8d699c79083813takashi * not be used to endorse or promote products derived from this
6ae232055d4d8a97267517c5e50074c2c819941and * software without prior written permission. For written
e1e8390280254f7f0580d701e583f670643d4f3fnilgun * permission, please contact apache@apache.org.
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung *
6ae232055d4d8a97267517c5e50074c2c819941and * 5. Products derived from this software may not be called "Apache",
b43f840409794ed298e8634f6284741f193b6c4ftakashi * nor may "Apache" appear in their name, without prior written
b43f840409794ed298e8634f6284741f193b6c4ftakashi * permission of the Apache Software Foundation.
b43f840409794ed298e8634f6284741f193b6c4ftakashi *
b43f840409794ed298e8634f6284741f193b6c4ftakashi * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
6ae232055d4d8a97267517c5e50074c2c819941and * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
6ae232055d4d8a97267517c5e50074c2c819941and * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
6ae232055d4d8a97267517c5e50074c2c819941and * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
6ae232055d4d8a97267517c5e50074c2c819941and * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
6ae232055d4d8a97267517c5e50074c2c819941and * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
6ae232055d4d8a97267517c5e50074c2c819941and * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
6ae232055d4d8a97267517c5e50074c2c819941and * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
6ae232055d4d8a97267517c5e50074c2c819941and * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
6ae232055d4d8a97267517c5e50074c2c819941and * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
6ae232055d4d8a97267517c5e50074c2c819941and * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
6ae232055d4d8a97267517c5e50074c2c819941and * SUCH DAMAGE.
6ae232055d4d8a97267517c5e50074c2c819941and * ====================================================================
6ae232055d4d8a97267517c5e50074c2c819941and *
6ae232055d4d8a97267517c5e50074c2c819941and * This software consists of voluntary contributions made by many
6ae232055d4d8a97267517c5e50074c2c819941and * individuals on behalf of the Apache Software Foundation. For more
6ae232055d4d8a97267517c5e50074c2c819941and * information on the Apache Software Foundation, please see
6ae232055d4d8a97267517c5e50074c2c819941and * <http://www.apache.org/>.
6ae232055d4d8a97267517c5e50074c2c819941and *
6ae232055d4d8a97267517c5e50074c2c819941and * Portions of this software are based upon public domain software
6ae232055d4d8a97267517c5e50074c2c819941and * originally written at the National Center for Supercomputing Applications,
6ae232055d4d8a97267517c5e50074c2c819941and * University of Illinois, Urbana-Champaign.
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and#ifndef APACHE_HTTP_PROTOCOL_H
6ae232055d4d8a97267517c5e50074c2c819941and#define APACHE_HTTP_PROTOCOL_H
6ae232055d4d8a97267517c5e50074c2c819941and
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh#include "httpd.h"
6ae232055d4d8a97267517c5e50074c2c819941and#include "apr_hooks.h"
6ae232055d4d8a97267517c5e50074c2c819941and#include "apr_portable.h"
6ae232055d4d8a97267517c5e50074c2c819941and#include "apr_mmap.h"
6ae232055d4d8a97267517c5e50074c2c819941and#include "apr_buckets.h"
6ae232055d4d8a97267517c5e50074c2c819941and#include "util_filter.h"
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and#ifdef __cplusplus
6ae232055d4d8a97267517c5e50074c2c819941andextern "C" {
6ae232055d4d8a97267517c5e50074c2c819941and#endif
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * @package HTTP protocol handling
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/* This is an optimization. We keep a record of the filter_rec that
6ae232055d4d8a97267517c5e50074c2c819941and * stores the old_write filter, so that we can avoid strcmp's later.
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE_DATA extern ap_filter_rec_t *ap_old_write_func;
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/*
6ae232055d4d8a97267517c5e50074c2c819941and * Prototypes for routines which either talk directly back to the user,
6ae232055d4d8a97267517c5e50074c2c819941and * or control the ones that eventually do.
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Read a request and fill in the fields.
6ae232055d4d8a97267517c5e50074c2c819941and * @param c The current connection
6ae232055d4d8a97267517c5e50074c2c819941and * @return The new request_rec
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andrequest_rec *ap_read_request(conn_rec *c);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/* Finish up stuff after a request */
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Called at completion of sending the response. It sends the terminating
6ae232055d4d8a97267517c5e50074c2c819941and * protocol information.
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc void ap_finalize_request_protocol(request_rec *r)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(void) ap_finalize_request_protocol(request_rec *r);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Send error back to client.
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @param recursive_error last arg indicates error status in case we get
6ae232055d4d8a97267517c5e50074c2c819941and * an error in the process of trying to deal with an ErrorDocument
6ae232055d4d8a97267517c5e50074c2c819941and * to handle some other error. In that case, we print the default
6ae232055d4d8a97267517c5e50074c2c819941and * report for the first thing that went wrong, and more briefly report
6ae232055d4d8a97267517c5e50074c2c819941and * on the problem with the ErrorDocument.
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc void ap_send_error_response(request_rec *r, int recursive_error)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(void) ap_send_error_response(request_rec *r, int recursive_error);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/* Set last modified header line from the lastmod date of the associated file.
6ae232055d4d8a97267517c5e50074c2c819941and * Also, set content length.
6ae232055d4d8a97267517c5e50074c2c819941and *
6ae232055d4d8a97267517c5e50074c2c819941and * May return an error status, typically HTTP_NOT_MODIFIED (that when the
6ae232055d4d8a97267517c5e50074c2c819941and * permit_cache argument is set to one).
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Set the content length for this request
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @param length The new content length
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc void ap_set_content_length(request_rec *r, apr_off_t length)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(void) ap_set_content_length(request_rec *r, apr_off_t length);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Set the keepalive status for this request
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @return 1 if keepalive can be set, 0 otherwise
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc int ap_set_keepalive(request_rec *r)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(int) ap_set_keepalive(request_rec *r);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Return the latest rational time from a request/mtime pair. Mtime is
6ae232055d4d8a97267517c5e50074c2c819941and * returned unless it's in the future, in which case we return the current time.
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @param mtime The last modified time
6ae232055d4d8a97267517c5e50074c2c819941and * @return the latest rational time.
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc apr_time_t ap_rationalize_mtime(request_rec *r, apr_time_t mtime)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(apr_time_t) ap_rationalize_mtime(request_rec *r, apr_time_t mtime);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Build the content-type that should be sent to the client from the
6ae232055d4d8a97267517c5e50074c2c819941and * content-type specified. The following rules are followed:
6ae232055d4d8a97267517c5e50074c2c819941and * - if type is NULL, type is set to ap_default_type(r)
6ae232055d4d8a97267517c5e50074c2c819941and * - if charset adding is disabled, stop processing and return type.
6ae232055d4d8a97267517c5e50074c2c819941and * - then, if there are no parameters on type, add the default charset
6ae232055d4d8a97267517c5e50074c2c819941and * - return type
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @return The content-type
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc const char *ap_make_content_type(request_rec *r, const char *type);
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(const char *) ap_make_content_type(request_rec *r, const char *type);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Construct an entity tag from the resource information. If it's a real
6ae232055d4d8a97267517c5e50074c2c819941and * file, build in some of the file characteristics.
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @param force_weak Force the entity tag to be weak - it could be modified
6ae232055d4d8a97267517c5e50074c2c819941and * again in as short an interval.
6ae232055d4d8a97267517c5e50074c2c819941and * @return The entity tag
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc char *ap_make_etag(request_rec *r, int force_weak)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(char *) ap_make_etag(request_rec *r, int force_weak);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Set the E-tag outgoing header
6ae232055d4d8a97267517c5e50074c2c819941and * @param The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc void ap_set_etag(request_rec *r)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(void) ap_set_etag(request_rec *r);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Set the last modified time for the file being sent
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc void ap_set_last_modified(request_rec *r)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(void) ap_set_last_modified(request_rec *r);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Implements condition GET rules for HTTP/1.1 specification. This function
6ae232055d4d8a97267517c5e50074c2c819941and * inspects the client headers and determines if the response fulfills
6ae232055d4d8a97267517c5e50074c2c819941and * the requirements specified.
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @return 1 if the response fulfills the condition GET rules, 0 otherwise
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc int ap_meets_conditions(request_rec *r)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(int) ap_meets_conditions(request_rec *r);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/* Other ways to send stuff at the client. All of these keep track
6ae232055d4d8a97267517c5e50074c2c819941and * of bytes_sent automatically. This indirection is intended to make
6ae232055d4d8a97267517c5e50074c2c819941and * it a little more painless to slide things like HTTP-NG packetization
6ae232055d4d8a97267517c5e50074c2c819941and * underneath the main body of the code later. In the meantime, it lets
6ae232055d4d8a97267517c5e50074c2c819941and * us centralize a bit of accounting (bytes_sent).
6ae232055d4d8a97267517c5e50074c2c819941and *
6ae232055d4d8a97267517c5e50074c2c819941and * These also return the number of bytes written by the call.
6ae232055d4d8a97267517c5e50074c2c819941and * They should only be called with a timeout registered, for obvious reaasons.
6ae232055d4d8a97267517c5e50074c2c819941and * (Ditto the send_header stuff).
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Send an entire file to the client, using sendfile if supported by the
6ae232055d4d8a97267517c5e50074c2c819941and * current platform
6ae232055d4d8a97267517c5e50074c2c819941and * @param fd The file to send.
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @param offset Offset into the file to start sending.
6ae232055d4d8a97267517c5e50074c2c819941and * @param length Amount of data to send
6ae232055d4d8a97267517c5e50074c2c819941and * @param nbytes Amount of data actually sent
6ae232055d4d8a97267517c5e50074c2c819941and * @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);
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(apr_status_t) ap_send_fd(apr_file_t *fd, request_rec *r, apr_off_t offset,
6ae232055d4d8a97267517c5e50074c2c819941and apr_size_t length, apr_size_t *nbytes);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and#if APR_HAS_MMAP
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Send an MMAP'ed file to the client
6ae232055d4d8a97267517c5e50074c2c819941and * @param mm The MMAP'ed file to send
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @param offset The offset into the MMAP to start sending
6ae232055d4d8a97267517c5e50074c2c819941and * @param length The amount of data to send
6ae232055d4d8a97267517c5e50074c2c819941and * @return The number of bytes sent
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc size_t ap_send_mmap(apr_mmap_t *mm, request_rec *r, size_t offset, size_t length)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(size_t) ap_send_mmap(apr_mmap_t *mm, request_rec *r, size_t offset,
6ae232055d4d8a97267517c5e50074c2c819941and size_t length);
6ae232055d4d8a97267517c5e50074c2c819941and#endif
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Register a new request method, and return the offset that will be
6ae232055d4d8a97267517c5e50074c2c819941and * associated with that method.
6ae232055d4d8a97267517c5e50074c2c819941and *
6ae232055d4d8a97267517c5e50074c2c819941and * @param p The pool to create registered method numbers from.
6ae232055d4d8a97267517c5e50074c2c819941and * @param methname The name of the new method to register.
6ae232055d4d8a97267517c5e50074c2c819941and * @return Ab int value representing an offset into a bitmask.
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(int) ap_method_register(apr_pool_t *p, const char *methname);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Initialize the method_registry and allocate memory for it.
6ae232055d4d8a97267517c5e50074c2c819941and *
6ae232055d4d8a97267517c5e50074c2c819941and * @param p Pool to allocate memory for the registry from.
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(void) ap_method_registry_init(apr_pool_t *p);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/*
6ae232055d4d8a97267517c5e50074c2c819941and * This is a convenience macro to ease with checking a mask
6ae232055d4d8a97267517c5e50074c2c819941and * against a method name.
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941and#define AP_METHOD_CHECK_ALLOWED(mask, methname) \
6ae232055d4d8a97267517c5e50074c2c819941and ((mask) & (AP_METHOD_BIT << ap_method_number_of((methname))))
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Create a new method list with the specified number of preallocated
6ae232055d4d8a97267517c5e50074c2c819941and * slots for extension methods.
6ae232055d4d8a97267517c5e50074c2c819941and *
6ae232055d4d8a97267517c5e50074c2c819941and * @param p Pointer to a pool in which the structure should be
6ae232055d4d8a97267517c5e50074c2c819941and * allocated.
6ae232055d4d8a97267517c5e50074c2c819941and * @param nelts Number of preallocated extension slots
6ae232055d4d8a97267517c5e50074c2c819941and * @return Pointer to the newly created structure.
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc ap_method_list_t ap_make_method_list(apr_pool_t *p, int nelts)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(ap_method_list_t *) ap_make_method_list(apr_pool_t *p, int nelts);
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(void) ap_copy_method_list(ap_method_list_t *dest,
6ae232055d4d8a97267517c5e50074c2c819941and ap_method_list_t *src);
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE_NONSTD(void) ap_method_list_do(int (*comp) (void *urec, const char *mname,
6ae232055d4d8a97267517c5e50074c2c819941and int mnum),
6ae232055d4d8a97267517c5e50074c2c819941and void *rec,
6ae232055d4d8a97267517c5e50074c2c819941and const ap_method_list_t *ml, ...);
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(void) ap_method_list_vdo(int (*comp) (void *urec, const char *mname,
6ae232055d4d8a97267517c5e50074c2c819941and int mnum),
6ae232055d4d8a97267517c5e50074c2c819941and void *rec, const ap_method_list_t *ml,
6ae232055d4d8a97267517c5e50074c2c819941and va_list vp);
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Search for an HTTP method name in an ap_method_list_t structure, and
6ae232055d4d8a97267517c5e50074c2c819941and * return true if found.
6ae232055d4d8a97267517c5e50074c2c819941and *
6ae232055d4d8a97267517c5e50074c2c819941and * @param method String containing the name of the method to check.
6ae232055d4d8a97267517c5e50074c2c819941and * @param l Pointer to a method list, such as cmd->methods_limited.
6ae232055d4d8a97267517c5e50074c2c819941and * @return 1 if method is in the list, otherwise 0
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc int ap_method_in_list(const char *method, ap_method_list_t *l)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(int) ap_method_in_list(ap_method_list_t *l, const char *method);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Add an HTTP method name to an ap_method_list_t structure if it isn't
6ae232055d4d8a97267517c5e50074c2c819941and * already listed.
6ae232055d4d8a97267517c5e50074c2c819941and *
6ae232055d4d8a97267517c5e50074c2c819941and * @param method String containing the name of the method to check.
6ae232055d4d8a97267517c5e50074c2c819941and * @param l Pointer to a method list, such as cmd->methods_limited.
6ae232055d4d8a97267517c5e50074c2c819941and * @return None.
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc void ap_method_in_list(ap_method_list_t *l, const char *method)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(void) ap_method_list_add(ap_method_list_t *l, const char *method);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Remove an HTTP method name from an ap_method_list_t structure.
6ae232055d4d8a97267517c5e50074c2c819941and *
6ae232055d4d8a97267517c5e50074c2c819941and * @param l Pointer to a method list, such as cmd->methods_limited.
6ae232055d4d8a97267517c5e50074c2c819941and * @param method String containing the name of the method to remove.
6ae232055d4d8a97267517c5e50074c2c819941and * @return None.
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc void ap_method_list_remove(ap_method_list_t *l, const char *method)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(void) ap_method_list_remove(ap_method_list_t *l,
6ae232055d4d8a97267517c5e50074c2c819941and const char *method);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Reset a method list to be completely empty.
6ae232055d4d8a97267517c5e50074c2c819941and *
6ae232055d4d8a97267517c5e50074c2c819941and * @param l Pointer to a method list, such as cmd->methods_limited.
6ae232055d4d8a97267517c5e50074c2c819941and * @return None.
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc void ap_clear_method_list(ap_method_list_t *l)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(void) ap_clear_method_list(ap_method_list_t *l);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/* Hmmm... could macrofy these for now, and maybe forever, though the
6ae232055d4d8a97267517c5e50074c2c819941and * definitions of the macros would get a whole lot hairier.
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Output one character for this request
6ae232055d4d8a97267517c5e50074c2c819941and * @param c the character to output
6ae232055d4d8a97267517c5e50074c2c819941and * @param r the current request
6ae232055d4d8a97267517c5e50074c2c819941and * @return The number of bytes sent
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc int ap_rputc(int c, request_rec *r)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(int) ap_rputc(int c, request_rec *r);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Output a string for the current request
6ae232055d4d8a97267517c5e50074c2c819941and * @param str The string to output
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @return The number of bytes sent
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc int ap_rputs(const char *str, request_rec *r)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(int) ap_rputs(const char *str, request_rec *r);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Write a buffer for the current request
6ae232055d4d8a97267517c5e50074c2c819941and * @param buf The buffer to write
6ae232055d4d8a97267517c5e50074c2c819941and * @param nbyte The number of bytes to send from the buffer
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @return The number of bytes sent
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc int ap_rwrite(const void *buf, int nbyte, request_rec *r)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(int) ap_rwrite(const void *buf, int nbyte, request_rec *r);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Write an unspecified number of strings to the request
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @param ... The strings to write
6ae232055d4d8a97267517c5e50074c2c819941and * @return The number of bytes sent
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc int ap_rvputs(request_rec *r, ...)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE_NONSTD(int) ap_rvputs(request_rec *r,...);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Output data to the client in a printf format
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @param fmt The format string
6ae232055d4d8a97267517c5e50074c2c819941and * @param vlist The arguments to use to fill out the format string
6ae232055d4d8a97267517c5e50074c2c819941and * @return The number of bytes sent
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc int ap_vrprintf(request_rec *r, const char *fmt, va_list vlist)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(int) ap_vrprintf(request_rec *r, const char *fmt, va_list vlist);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Output data to the client in a printf format
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @param fmt The format string
6ae232055d4d8a97267517c5e50074c2c819941and * @param ... The arguments to use to fill out the format string
6ae232055d4d8a97267517c5e50074c2c819941and * @return The number of bytes sent
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc int ap_rprintf(request_rec *r, const char *fmt, ...)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE_NONSTD(int) ap_rprintf(request_rec *r, const char *fmt,...)
6ae232055d4d8a97267517c5e50074c2c819941and __attribute__((format(printf,2,3)));
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Flush all of the data for the current request to the client
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @return The number of bytes sent
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc int ap_rflush(request_rec *r)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(int) ap_rflush(request_rec *r);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Index used in custom_responses array for a specific error code
6ae232055d4d8a97267517c5e50074c2c819941and * (only use outside protocol.c is in getting them configured).
6ae232055d4d8a97267517c5e50074c2c819941and * @param status HTTP status code
6ae232055d4d8a97267517c5e50074c2c819941and * @return The index of the response
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc int ap_index_of_response(int status)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(int) ap_index_of_response(int status);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Return the Status-Line for a given status code (excluding the
6ae232055d4d8a97267517c5e50074c2c819941and * HTTP-Version field). If an invalid or unknown status code is
6ae232055d4d8a97267517c5e50074c2c819941and * passed, "500 Internal Server Error" will be returned.
6ae232055d4d8a97267517c5e50074c2c819941and * @param status The HTTP status code
6ae232055d4d8a97267517c5e50074c2c819941and * @return The Status-Line
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc const char *ap_get_status_line(int status)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(const char *) ap_get_status_line(int status);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/* Reading a block of data from the client connection (e.g., POST arg) */
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Setup the client to allow Apache to read the request body.
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @param read_policy How the server should interpret a chunked
6ae232055d4d8a97267517c5e50074c2c819941and * transfer-encoding. One of: <pre>
6ae232055d4d8a97267517c5e50074c2c819941and * REQUEST_NO_BODY Send 413 error if message has any body
6ae232055d4d8a97267517c5e50074c2c819941and * REQUEST_CHUNKED_ERROR Send 411 error if body without Content-Length
6ae232055d4d8a97267517c5e50074c2c819941and * REQUEST_CHUNKED_DECHUNK If chunked, remove the chunks for me.
6ae232055d4d8a97267517c5e50074c2c819941and * </pre>
6ae232055d4d8a97267517c5e50074c2c819941and * @return either OK or an error code
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc int ap_setup_cleint_block(request_rec *r, int read_policy)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(int) ap_setup_client_block(request_rec *r, int read_policy);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Determine if the client has sent any data. This also sends a
6ae232055d4d8a97267517c5e50074c2c819941and * 100 Continue resposne to HTTP/1.1 clients, so modules should not be called
6ae232055d4d8a97267517c5e50074c2c819941and * until the module is ready to read content.
6ae232055d4d8a97267517c5e50074c2c819941and * @warning Never call this function more than once.
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @return 0 if there is no message to read, 1 otherwise
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc int ap_should_client_block(request_rec *r)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(int) ap_should_client_block(request_rec *r);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Call this in a loop. It will put data into a buffer and return the length
6ae232055d4d8a97267517c5e50074c2c819941and * of the input block
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @param buffer The buffer in which to store the data
6ae232055d4d8a97267517c5e50074c2c819941and * @param bufsiz The size of the buffer
6ae232055d4d8a97267517c5e50074c2c819941and * @return Number of bytes inserted into the buffer. When done reading, 0
6ae232055d4d8a97267517c5e50074c2c819941and * if EOF, or -1 if there was an error
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc long ap_get_client_block(request_rec *r, char *buffer, apr_size_t bufsiz)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(long) ap_get_client_block(request_rec *r, char *buffer, apr_size_t bufsiz);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * In HTTP/1.1, any method can have a body. However, most GET handlers
6ae232055d4d8a97267517c5e50074c2c819941and * wouldn't know what to do with a request body if they received one.
6ae232055d4d8a97267517c5e50074c2c819941and * This helper routine tests for and reads any message body in the request,
6ae232055d4d8a97267517c5e50074c2c819941and * simply discarding whatever it receives. We need to do this because
6ae232055d4d8a97267517c5e50074c2c819941and * failing to read the request body would cause it to be interpreted
6ae232055d4d8a97267517c5e50074c2c819941and * as the next request on a persistent connection.
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
1ac39787115a288f5e848344b1b1e8dccb1c58f1nd * @return error status if request is malformed, OK otherwise
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc int ap_discard_request_body(request_rec *r)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(int) ap_discard_request_body(request_rec *r);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Setup the output headers so that the client knows how to authenticate
6ae232055d4d8a97267517c5e50074c2c819941and * itself the next time, if an authentication request failed. This function
6ae232055d4d8a97267517c5e50074c2c819941and * works for both basic and digest authentication
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc void ap_note_auth_failure(request_rec *r)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(void) ap_note_auth_failure(request_rec *r);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Setup the output headers so that the client knows how to authenticate
6ae232055d4d8a97267517c5e50074c2c819941and * itself the next time, if an authentication request failed. This function
6ae232055d4d8a97267517c5e50074c2c819941and * works only for basic authentication
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc void ap_note_basic_auth_failure(request_rec *r)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(void) ap_note_basic_auth_failure(request_rec *r);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
1ac39787115a288f5e848344b1b1e8dccb1c58f1nd * Setup the output headers so that the client knows how to authenticate
6ae232055d4d8a97267517c5e50074c2c819941and * itself the next time, if an authentication request failed. This function
6ae232055d4d8a97267517c5e50074c2c819941and * works only for digest authentication
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc void ap_note_digest_auth_failure(request_rec *r)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(void) ap_note_digest_auth_failure(request_rec *r);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Get the password from the request headers
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @param pw The password as set in the headers
6ae232055d4d8a97267517c5e50074c2c819941and * @return 0 (OK) if it set the 'pw' argument (and assured
6ae232055d4d8a97267517c5e50074c2c819941and * a correct value in r->connection->user); otherwise it returns
6ae232055d4d8a97267517c5e50074c2c819941and * an error code, either HTTP_INTERNAL_SERVER_ERROR if things are
6ae232055d4d8a97267517c5e50074c2c819941and * really confused, HTTP_UNAUTHORIZED if no authentication at all
6ae232055d4d8a97267517c5e50074c2c819941and * seemed to be in use, or DECLINED if there was authentication but
6ae232055d4d8a97267517c5e50074c2c819941and * it wasn't Basic (in which case, the caller should presumably
6ae232055d4d8a97267517c5e50074c2c819941and * decline as well).
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc int ap_get_basic_auth_pw(request_rec *r, const char **pw)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(int) ap_get_basic_auth_pw(request_rec *r, const char **pw);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * parse_uri: break apart the uri
6ae232055d4d8a97267517c5e50074c2c819941and * @warning Side Effects: <pre>
6ae232055d4d8a97267517c5e50074c2c819941and * - sets r->args to rest after '?' (or NULL if no '?')
6ae232055d4d8a97267517c5e50074c2c819941and * - sets r->uri to request uri (without r->args part)
6ae232055d4d8a97267517c5e50074c2c819941and * - sets r->hostname (if not set already) from request (scheme://host:port)
6ae232055d4d8a97267517c5e50074c2c819941and * </pre>
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @param uri The uri to break apart
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc void ap_parse_uri(request_rec *r, const char *uri)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_CORE_DECLARE(void) ap_parse_uri(request_rec *r, const char *uri);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Get the next line of input for the request
6ae232055d4d8a97267517c5e50074c2c819941and * @param s The buffer into which to read the line
6ae232055d4d8a97267517c5e50074c2c819941and * @param n The size of the buffer
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The request
6ae232055d4d8a97267517c5e50074c2c819941and * @param fold Whether to merge continuation lines
6ae232055d4d8a97267517c5e50074c2c819941and * @return The length of the line, if successful
6ae232055d4d8a97267517c5e50074c2c819941and * n, if the line is too big to fit in the buffer
6ae232055d4d8a97267517c5e50074c2c819941and * -1 for miscellaneous errors
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc int ap_method_number_of(const char *method)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(int) ap_getline(char *s, int n, request_rec *r, int fold);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Get the next line of input for the request
6ae232055d4d8a97267517c5e50074c2c819941and *
6ae232055d4d8a97267517c5e50074c2c819941and * Note: on ASCII boxes, ap_rgetline is a macro which simply calls
6ae232055d4d8a97267517c5e50074c2c819941and * ap_rgetline_core to get the line of input.
6ae232055d4d8a97267517c5e50074c2c819941and *
6ae232055d4d8a97267517c5e50074c2c819941and * on EBCDIC boxes, ap_rgetline is a wrapper function which
6ae232055d4d8a97267517c5e50074c2c819941and * translates ASCII protocol lines to the local EBCDIC code page
6ae232055d4d8a97267517c5e50074c2c819941and * after getting the line of input.
6ae232055d4d8a97267517c5e50074c2c819941and *
6ae232055d4d8a97267517c5e50074c2c819941and * @param s Pointer to the pointer to the buffer into which the line
6ae232055d4d8a97267517c5e50074c2c819941and * should be read; if *s==NULL, a buffer of the necessary size
6ae232055d4d8a97267517c5e50074c2c819941and * to hold the data will be allocated from the request pool
6ae232055d4d8a97267517c5e50074c2c819941and * @param n The size of the buffer
6ae232055d4d8a97267517c5e50074c2c819941and * @param read The length of the line.
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The request
6ae232055d4d8a97267517c5e50074c2c819941and * @param fold Whether to merge continuation lines
6ae232055d4d8a97267517c5e50074c2c819941and * @return APR_SUCCESS, if successful
6ae232055d4d8a97267517c5e50074c2c819941and * APR_ENOSPC, if the line is too big to fit in the buffer
6ae232055d4d8a97267517c5e50074c2c819941and * Other errors where appropriate
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941and#if APR_CHARSET_EBCDIC
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(apr_status_t) ap_rgetline(char **s, apr_size_t n,
6ae232055d4d8a97267517c5e50074c2c819941and apr_size_t *read,
6ae232055d4d8a97267517c5e50074c2c819941and request_rec *r, int fold);
6ae232055d4d8a97267517c5e50074c2c819941and#else /* ASCII box */
6ae232055d4d8a97267517c5e50074c2c819941and#define ap_rgetline(s, n, read, r, fold) \
6ae232055d4d8a97267517c5e50074c2c819941and ap_rgetline_core((s), (n), (read), (r), (fold))
6ae232055d4d8a97267517c5e50074c2c819941and#endif
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(apr_status_t) ap_rgetline_core(char **s, apr_size_t n,
6ae232055d4d8a97267517c5e50074c2c819941and apr_size_t *read,
6ae232055d4d8a97267517c5e50074c2c819941and request_rec *r, int fold);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Get the method number associated with the given string, assumed to
6ae232055d4d8a97267517c5e50074c2c819941and * contain an HTTP method. Returns M_INVALID if not recognized.
6ae232055d4d8a97267517c5e50074c2c819941and * @param method A string containing a valid HTTP method
6ae232055d4d8a97267517c5e50074c2c819941and * @return The method number
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(int) ap_method_number_of(const char *method);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * Get the method name associated with the given internal method
6ae232055d4d8a97267517c5e50074c2c819941and * number. Returns NULL if not recognized.
6ae232055d4d8a97267517c5e50074c2c819941and * @param p A pool to use for temporary allocations.
6ae232055d4d8a97267517c5e50074c2c819941and * @param methnum An integer value corresponding to an internal method number
6ae232055d4d8a97267517c5e50074c2c819941and * @return The name corresponding to the method number
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE(const char *) ap_method_name_of(apr_pool_t *p, int methnum);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and /* Hooks */
6ae232055d4d8a97267517c5e50074c2c819941and /*
6ae232055d4d8a97267517c5e50074c2c819941and * post_read_request --- run right after read_request or internal_redirect,
6ae232055d4d8a97267517c5e50074c2c819941and * and not run during any subrequests.
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * This hook allows modules to affect the request immediately after the request
6ae232055d4d8a97267517c5e50074c2c819941and * has been read, and before any other phases have been processes. This allows
6ae232055d4d8a97267517c5e50074c2c819941and * modules to make decisions based upon the input header fields
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @return OK or DECLINED
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc ap_run_post_read_request(request_rec *r)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE_HOOK(int,post_read_request,(request_rec *r))
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * This hook allows modules to perform any module-specific logging activities
6ae232055d4d8a97267517c5e50074c2c819941and * over and above the normal server things.
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @return OK, DECLINED, or HTTP_...
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc int ap_run_log_transaction(request_rec *r)
6ae232055d4d8a97267517c5e50074c2c819941and */
6ae232055d4d8a97267517c5e50074c2c819941andAP_DECLARE_HOOK(int,log_transaction,(request_rec *r))
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and/**
6ae232055d4d8a97267517c5e50074c2c819941and * This hook allows modules to retrieve the http method from a request. This
6ae232055d4d8a97267517c5e50074c2c819941and * allows Apache modules to easily extend the methods that Apache understands
6ae232055d4d8a97267517c5e50074c2c819941and * @param r The current request
6ae232055d4d8a97267517c5e50074c2c819941and * @return The http method from the request
6ae232055d4d8a97267517c5e50074c2c819941and * @deffunc const char *ap_run_http_method(const request_rec *r)
6ae232055d4d8a97267517c5e50074c2c819941and */
b43f840409794ed298e8634f6284741f193b6c4ftakashiAP_DECLARE_HOOK(const char *,http_method,(const request_rec *r))
af84459fbf938e508fd10b01cb8d699c79083813takashi
6ae232055d4d8a97267517c5e50074c2c819941and/**
e1e8390280254f7f0580d701e583f670643d4f3fnilgun * Return the default port from the current request
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung * @param r The current request
727872d18412fc021f03969b8641810d8896820bhumbedooh * @return The current port
0d0ba3a410038e179b695446bb149cce6264e0abnd * @deffunc apr_port_t ap_run_default_port(const request_rec *r)
727872d18412fc021f03969b8641810d8896820bhumbedooh */
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedoohAP_DECLARE_HOOK(apr_port_t,default_port,(const request_rec *r))
0d0ba3a410038e179b695446bb149cce6264e0abnd
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedoohtypedef struct ap_bucket_error ap_bucket_error;
727872d18412fc021f03969b8641810d8896820bhumbedooh
0d0ba3a410038e179b695446bb149cce6264e0abnd/**
0d0ba3a410038e179b695446bb149cce6264e0abnd * A bucket referring to an HTTP error
0d0ba3a410038e179b695446bb149cce6264e0abnd * This bucket can be passed down the filter stack to indicate that an
ac082aefa89416cbdc9a1836eaf3bed9698201c8humbedooh * HTTP error occurred while running a filter. In order for this bucket
0d0ba3a410038e179b695446bb149cce6264e0abnd * to be used successfully, it MUST be sent as the first bucket in the
0d0ba3a410038e179b695446bb149cce6264e0abnd * first brigade to be sent from a given filter.
0d0ba3a410038e179b695446bb149cce6264e0abnd */
727872d18412fc021f03969b8641810d8896820bhumbedoohstruct ap_bucket_error {
0d0ba3a410038e179b695446bb149cce6264e0abnd /** The error code */
0d0ba3a410038e179b695446bb149cce6264e0abnd int status;
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh /** The error string */
205f749042ed530040a4f0080dbcb47ceae8a374rjung const char *data;
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen};
0d0ba3a410038e179b695446bb149cce6264e0abnd
7fec19672a491661b2fe4b29f685bc7f4efa64d4ndAP_DECLARE_DATA extern const apr_bucket_type_t ap_bucket_type_error;
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd/**
6ae232055d4d8a97267517c5e50074c2c819941and * Make the bucket passed in an error bucket
* @param b The bucket to make into an error bucket
* @param error The HTTP error code to put in the bucket.
* @param buf An optional error string to put in the bucket.
* @param p A pool to allocate out of.
* @return The new bucket, or NULL if allocation failed
* @deffunc apr_bucket *ap_bucket_error_make(apr_bucket *b, int error, const char *buf, apr_pool_t *p)
*/
AP_DECLARE(apr_bucket *) ap_bucket_error_make(apr_bucket *b, int error,
const char *buf, apr_pool_t *p);
/**
* Create a bucket referring to an HTTP error.
* @param error The HTTP error code to put in the bucket.
* @param buf An optional error string to put in the bucket.
* @param p A pool to allocate out of.
* @return The new bucket, or NULL if allocation failed
* @deffunc apr_bucket *ap_bucket_error_create(int error, const char *buf, apr_pool_t *p)
*/
AP_DECLARE(apr_bucket *) ap_bucket_error_create(int error,
const char *buf, apr_pool_t *p);
AP_DECLARE_NONSTD(apr_status_t) ap_byterange_filter(ap_filter_t *f, apr_bucket_brigade *b);
AP_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f, apr_bucket_brigade *b);
AP_DECLARE_NONSTD(apr_status_t) ap_content_length_filter(ap_filter_t *,
apr_bucket_brigade *);
AP_DECLARE_NONSTD(apr_status_t) ap_old_write_filter(ap_filter_t *f, apr_bucket_brigade *b);
/*
* Setting up the protocol fields for subsidiary requests...
* Also, a wrapup function to keep the internal accounting straight.
*/
void ap_set_sub_req_protocol(request_rec *rnew, const request_rec *r);
void ap_finalize_sub_req_protocol(request_rec *sub_r);
#ifdef __cplusplus
}
#endif
#endif /* !APACHE_HTTP_PROTOCOL_H */