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