842ae4bd224140319ae7feec1872b93dfd491143fielding/* Licensed to the Apache Software Foundation (ASF) under one or more
842ae4bd224140319ae7feec1872b93dfd491143fielding * contributor license agreements. See the NOTICE file distributed with
842ae4bd224140319ae7feec1872b93dfd491143fielding * this work for additional information regarding copyright ownership.
842ae4bd224140319ae7feec1872b93dfd491143fielding * The ASF licenses this file to You under the Apache License, Version 2.0
842ae4bd224140319ae7feec1872b93dfd491143fielding * (the "License"); you may not use this file except in compliance with
842ae4bd224140319ae7feec1872b93dfd491143fielding * the License. You may obtain a copy of the License at
2d2eda71267231c2526be701fe655db125852c1ffielding *
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd * http://www.apache.org/licenses/LICENSE-2.0
2d2eda71267231c2526be701fe655db125852c1ffielding *
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd * Unless required by applicable law or agreed to in writing, software
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd * distributed under the License is distributed on an "AS IS" BASIS,
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd * See the License for the specific language governing permissions and
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd * limitations under the License.
2d2eda71267231c2526be701fe655db125852c1ffielding */
2d2eda71267231c2526be701fe655db125852c1ffielding
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben/**
0432a26b69eedfb9ca5f34fba590236378a24851ben * @file httpd.h
0432a26b69eedfb9ca5f34fba590236378a24851ben * @brief HTTP Daemon routines
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh *
bf6b5eb3bf3c4a71e6146d4bcd07cf1749dc6d70jorton * @defgroup APACHE Apache HTTP Server
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh *
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * Top level group of which all other groups are a member
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @{
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh *
bf6b5eb3bf3c4a71e6146d4bcd07cf1749dc6d70jorton * @defgroup APACHE_MODS Loadable modules
bf6b5eb3bf3c4a71e6146d4bcd07cf1749dc6d70jorton * Top level group for modules
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @defgroup APACHE_OS Operating System Specific
1e252d105bda0f46b625809d3c219656ec2408e7jorton * @defgroup APACHE_INTERNAL Internal interfaces
bf6b5eb3bf3c4a71e6146d4bcd07cf1749dc6d70jorton * @defgroup APACHE_CORE Core routines
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @{
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @defgroup APACHE_CORE_DAEMON HTTP Daemon Routine
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @{
2d2eda71267231c2526be701fe655db125852c1ffielding */
2d2eda71267231c2526be701fe655db125852c1ffielding
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh#ifndef APACHE_HTTPD_H
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh#define APACHE_HTTPD_H
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb/* XXX - We need to push more stuff to other .h files, or even .c files, to
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb * make this file smaller
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb */
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb
2d2eda71267231c2526be701fe655db125852c1ffielding/* Headers in which EVERYONE has an interest... */
30c289e6bc6d28d210b21edd800ab2cfc78a8381wrowe#include "ap_config.h"
cccd31fa4a72fe23cc3249c06db181b274a55a69gstein#include "ap_mmn.h"
cccd31fa4a72fe23cc3249c06db181b274a55a69gstein
cd39d2139743ca0ef899953c6496dcf99e9c791atrawick#include "ap_release.h"
cccd31fa4a72fe23cc3249c06db181b274a55a69gstein
a261b81a1044c0e2ea3f21cf9b7019297bad16aajorton#include "apr.h"
b627048681b27fe30f979ba471b523be3a6a22adrbb#include "apr_general.h"
cccd31fa4a72fe23cc3249c06db181b274a55a69gstein#include "apr_tables.h"
cccd31fa4a72fe23cc3249c06db181b274a55a69gstein#include "apr_pools.h"
44c46ef733836b32585d135d2d90856e7cfd9929rbb#include "apr_time.h"
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb#include "apr_network_io.h"
e6cc28a5eb3371ba0c38e941855e71ff0054f50erbb#include "apr_buckets.h"
d9039a9aaeaa1359c1147af66c09aeac56ae3ee0pquerna#include "apr_poll.h"
cdccf2ac94172d1a4a54bc2e17324e1ef682ccf3pquerna#include "apr_thread_proc.h"
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb
9cfc48b742c224c1fbc2c26a4119a3266192c7d2wrowe#include "os.h"
9cfc48b742c224c1fbc2c26a4119a3266192c7d2wrowe
ef5650b61a8e35f3cc93ec07e73efc17ea329894jorton#include "ap_regex.h"
7c7372abe2484e7fcf81937b93496d1246e5b816gstein
a261b81a1044c0e2ea3f21cf9b7019297bad16aajorton#if APR_HAVE_STDLIB_H
a261b81a1044c0e2ea3f21cf9b7019297bad16aajorton#include <stdlib.h>
a261b81a1044c0e2ea3f21cf9b7019297bad16aajorton#endif
a261b81a1044c0e2ea3f21cf9b7019297bad16aajorton
d71fd7cd9c4815d0647425f21ba3a803919a9148jorton/* Note: apr_uri.h is also included, see below */
7c7372abe2484e7fcf81937b93496d1246e5b816gstein
7c7372abe2484e7fcf81937b93496d1246e5b816gstein#ifdef __cplusplus
7c7372abe2484e7fcf81937b93496d1246e5b816gsteinextern "C" {
7c7372abe2484e7fcf81937b93496d1246e5b816gstein#endif
7c7372abe2484e7fcf81937b93496d1246e5b816gstein
2d2eda71267231c2526be701fe655db125852c1ffielding/* ----------------------------- config dir ------------------------------ */
2d2eda71267231c2526be701fe655db125852c1ffielding
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/** Define this to be the default server home dir. Most things later in this
2d2eda71267231c2526be701fe655db125852c1ffielding * file with a relative pathname will have this added.
2d2eda71267231c2526be701fe655db125852c1ffielding */
2d2eda71267231c2526be701fe655db125852c1ffielding#ifndef HTTPD_ROOT
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh#ifdef OS2
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh/** Set default for OS/2 file system */
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh#define HTTPD_ROOT "/os2httpd"
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh#elif defined(WIN32)
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/** Set default for Windows file system */
2d2eda71267231c2526be701fe655db125852c1ffielding#define HTTPD_ROOT "/apache"
dd5cbadf2df719db2f3c769d03ec847da25854e6bnicholes#elif defined (NETWARE)
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/** Set the default for NetWare */
dd5cbadf2df719db2f3c769d03ec847da25854e6bnicholes#define HTTPD_ROOT "/apache"
2d2eda71267231c2526be701fe655db125852c1ffielding#else
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/** Set for all other OSs */
2d2eda71267231c2526be701fe655db125852c1ffielding#define HTTPD_ROOT "/usr/local/apache"
2d2eda71267231c2526be701fe655db125852c1ffielding#endif
2d2eda71267231c2526be701fe655db125852c1ffielding#endif /* HTTPD_ROOT */
2d2eda71267231c2526be701fe655db125852c1ffielding
742318b93e89c311f66b55f426c4d9cf2c14628bjim/*
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb * --------- You shouldn't have to edit anything below this line ----------
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb *
742318b93e89c311f66b55f426c4d9cf2c14628bjim * Any modifications to any defaults not defined above should be done in the
742318b93e89c311f66b55f426c4d9cf2c14628bjim * respective configuration file.
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb *
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb */
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb
742318b93e89c311f66b55f426c4d9cf2c14628bjim/**
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * Default location of documents. Can be overridden by the DocumentRoot
2d2eda71267231c2526be701fe655db125852c1ffielding * directive.
2d2eda71267231c2526be701fe655db125852c1ffielding */
2d2eda71267231c2526be701fe655db125852c1ffielding#ifndef DOCUMENT_LOCATION
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh#ifdef OS2
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh/* Set default for OS/2 file system */
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh#define DOCUMENT_LOCATION HTTPD_ROOT "/docs"
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh#else
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh/* Set default for non OS/2 file system */
2d2eda71267231c2526be701fe655db125852c1ffielding#define DOCUMENT_LOCATION HTTPD_ROOT "/htdocs"
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh#endif
2d2eda71267231c2526be701fe655db125852c1ffielding#endif /* DOCUMENT_LOCATION */
2d2eda71267231c2526be701fe655db125852c1ffielding
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/** Maximum number of dynamically loaded modules */
2d2eda71267231c2526be701fe655db125852c1ffielding#ifndef DYNAMIC_MODULE_LIMIT
a0bd5cdd79004f4b7b1b441e38133519d3e20a1fsf#define DYNAMIC_MODULE_LIMIT 256
2d2eda71267231c2526be701fe655db125852c1ffielding#endif
2d2eda71267231c2526be701fe655db125852c1ffielding
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/** Default administrator's address */
2d2eda71267231c2526be701fe655db125852c1ffielding#define DEFAULT_ADMIN "[no address given]"
2d2eda71267231c2526be701fe655db125852c1ffielding
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/** The name of the log files */
2d2eda71267231c2526be701fe655db125852c1ffielding#ifndef DEFAULT_ERRORLOG
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh#if defined(OS2) || defined(WIN32)
2d2eda71267231c2526be701fe655db125852c1ffielding#define DEFAULT_ERRORLOG "logs/error.log"
2d2eda71267231c2526be701fe655db125852c1ffielding#else
2d2eda71267231c2526be701fe655db125852c1ffielding#define DEFAULT_ERRORLOG "logs/error_log"
2d2eda71267231c2526be701fe655db125852c1ffielding#endif
2d2eda71267231c2526be701fe655db125852c1ffielding#endif /* DEFAULT_ERRORLOG */
2d2eda71267231c2526be701fe655db125852c1ffielding
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/** Define this to be what your per-directory security files are called */
2d2eda71267231c2526be701fe655db125852c1ffielding#ifndef DEFAULT_ACCESS_FNAME
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh#ifdef OS2
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh/* Set default for OS/2 file system */
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh#define DEFAULT_ACCESS_FNAME "htaccess"
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh#else
2d2eda71267231c2526be701fe655db125852c1ffielding#define DEFAULT_ACCESS_FNAME ".htaccess"
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh#endif
2d2eda71267231c2526be701fe655db125852c1ffielding#endif /* DEFAULT_ACCESS_FNAME */
2d2eda71267231c2526be701fe655db125852c1ffielding
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/** The name of the server config file */
2d2eda71267231c2526be701fe655db125852c1ffielding#ifndef SERVER_CONFIG_FILE
2d2eda71267231c2526be701fe655db125852c1ffielding#define SERVER_CONFIG_FILE "conf/httpd.conf"
2d2eda71267231c2526be701fe655db125852c1ffielding#endif
2d2eda71267231c2526be701fe655db125852c1ffielding
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/** The default path for CGI scripts if none is currently set */
2d2eda71267231c2526be701fe655db125852c1ffielding#ifndef DEFAULT_PATH
2d2eda71267231c2526be701fe655db125852c1ffielding#define DEFAULT_PATH "/bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin"
2d2eda71267231c2526be701fe655db125852c1ffielding#endif
2d2eda71267231c2526be701fe655db125852c1ffielding
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/** The path to the suExec wrapper, can be overridden in Configuration */
2d2eda71267231c2526be701fe655db125852c1ffielding#ifndef SUEXEC_BIN
dbbf1b4183ae16353011a5269b37899f02b97d81gregames#define SUEXEC_BIN HTTPD_ROOT "/bin/suexec"
2d2eda71267231c2526be701fe655db125852c1ffielding#endif
2d2eda71267231c2526be701fe655db125852c1ffielding
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/** The timeout for waiting for messages */
2d2eda71267231c2526be701fe655db125852c1ffielding#ifndef DEFAULT_TIMEOUT
e9a0000eb55887c0278a9184d501812f5e056dbfjim#define DEFAULT_TIMEOUT 60
2d2eda71267231c2526be701fe655db125852c1ffielding#endif
2d2eda71267231c2526be701fe655db125852c1ffielding
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/** The timeout for waiting for keepalive timeout until next request */
2d2eda71267231c2526be701fe655db125852c1ffielding#ifndef DEFAULT_KEEPALIVE_TIMEOUT
ee1af2aeb57527f33baa4737aa431e4aef997855rbowen#define DEFAULT_KEEPALIVE_TIMEOUT 5
2d2eda71267231c2526be701fe655db125852c1ffielding#endif
2d2eda71267231c2526be701fe655db125852c1ffielding
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/** The number of requests to entertain per connection */
2d2eda71267231c2526be701fe655db125852c1ffielding#ifndef DEFAULT_KEEPALIVE
2d2eda71267231c2526be701fe655db125852c1ffielding#define DEFAULT_KEEPALIVE 100
2d2eda71267231c2526be701fe655db125852c1ffielding#endif
2d2eda71267231c2526be701fe655db125852c1ffielding
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/*
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * Limits on the size of various request items. These limits primarily
2d2eda71267231c2526be701fe655db125852c1ffielding * exist to prevent simple denial-of-service attacks on a server based
2d2eda71267231c2526be701fe655db125852c1ffielding * on misuse of the protocol. The recommended values will depend on the
2d2eda71267231c2526be701fe655db125852c1ffielding * nature of the server resources -- CGI scripts and database backends
2d2eda71267231c2526be701fe655db125852c1ffielding * might require large values, but most servers could get by with much
2d2eda71267231c2526be701fe655db125852c1ffielding * smaller limits than we use below. The request message body size can
2d2eda71267231c2526be701fe655db125852c1ffielding * be limited by the per-dir config directive LimitRequestBody.
2d2eda71267231c2526be701fe655db125852c1ffielding *
2d2eda71267231c2526be701fe655db125852c1ffielding * Internal buffer sizes are two bytes more than the DEFAULT_LIMIT_REQUEST_LINE
2d2eda71267231c2526be701fe655db125852c1ffielding * and DEFAULT_LIMIT_REQUEST_FIELDSIZE below, which explains the 8190.
ee7882748b83255e50ea6bc3b3fdc8ee0949e2e3jorton * These two limits can be lowered or raised by the server config
2d2eda71267231c2526be701fe655db125852c1ffielding * directives LimitRequestLine and LimitRequestFieldsize, respectively.
2d2eda71267231c2526be701fe655db125852c1ffielding *
2d2eda71267231c2526be701fe655db125852c1ffielding * DEFAULT_LIMIT_REQUEST_FIELDS can be modified or disabled (set = 0) by
2d2eda71267231c2526be701fe655db125852c1ffielding * the server config directive LimitRequestFields.
2d2eda71267231c2526be701fe655db125852c1ffielding */
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/** default limit on bytes in Request-Line (Method+URI+HTTP-version) */
2d2eda71267231c2526be701fe655db125852c1ffielding#ifndef DEFAULT_LIMIT_REQUEST_LINE
2d2eda71267231c2526be701fe655db125852c1ffielding#define DEFAULT_LIMIT_REQUEST_LINE 8190
742318b93e89c311f66b55f426c4d9cf2c14628bjim#endif
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/** default limit on bytes in any one header field */
2d2eda71267231c2526be701fe655db125852c1ffielding#ifndef DEFAULT_LIMIT_REQUEST_FIELDSIZE
2d2eda71267231c2526be701fe655db125852c1ffielding#define DEFAULT_LIMIT_REQUEST_FIELDSIZE 8190
742318b93e89c311f66b55f426c4d9cf2c14628bjim#endif
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/** default limit on number of request header fields */
2d2eda71267231c2526be701fe655db125852c1ffielding#ifndef DEFAULT_LIMIT_REQUEST_FIELDS
2d2eda71267231c2526be701fe655db125852c1ffielding#define DEFAULT_LIMIT_REQUEST_FIELDS 100
742318b93e89c311f66b55f426c4d9cf2c14628bjim#endif
2efb935ae8fe12d5192a3bf2c52c28461b6c68afdgaudet
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/**
2efb935ae8fe12d5192a3bf2c52c28461b6c68afdgaudet * The default default character set name to add if AddDefaultCharset is
2efb935ae8fe12d5192a3bf2c52c28461b6c68afdgaudet * enabled. Overridden with AddDefaultCharsetName.
2efb935ae8fe12d5192a3bf2c52c28461b6c68afdgaudet */
2efb935ae8fe12d5192a3bf2c52c28461b6c68afdgaudet#define DEFAULT_ADD_DEFAULT_CHARSET_NAME "iso-8859-1"
2efb935ae8fe12d5192a3bf2c52c28461b6c68afdgaudet
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** default HTTP Server protocol */
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb#define AP_SERVER_PROTOCOL "HTTP/1.1"
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb/* ------------------ stuff that modules are allowed to look at ----------- */
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** Define this to be what your HTML directory content files are called */
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb#ifndef AP_DEFAULT_INDEX
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb#define AP_DEFAULT_INDEX "index.html"
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb#endif
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** The name of the MIME types file */
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb#ifndef AP_TYPES_CONFIG_FILE
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb#define AP_TYPES_CONFIG_FILE "conf/mime.types"
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb#endif
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb/*
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb * Define the HTML doctype strings centrally.
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb */
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** HTML 2.0 Doctype */
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb#define DOCTYPE_HTML_2_0 "<!DOCTYPE HTML PUBLIC \"-//IETF//" \
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb "DTD HTML 2.0//EN\">\n"
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** HTML 3.2 Doctype */
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb#define DOCTYPE_HTML_3_2 "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb "DTD HTML 3.2 Final//EN\">\n"
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** HTML 4.0 Strict Doctype */
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb#define DOCTYPE_HTML_4_0S "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb "DTD HTML 4.0//EN\"\n" \
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb "\"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** HTML 4.0 Transitional Doctype */
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb#define DOCTYPE_HTML_4_0T "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb "DTD HTML 4.0 Transitional//EN\"\n" \
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb "\"http://www.w3.org/TR/REC-html40/loose.dtd\">\n"
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** HTML 4.0 Frameset Doctype */
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb#define DOCTYPE_HTML_4_0F "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb "DTD HTML 4.0 Frameset//EN\"\n" \
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb "\"http://www.w3.org/TR/REC-html40/frameset.dtd\">\n"
99d6d3207e24ba1f8eba77ef903948d738886cf5nd/** XHTML 1.0 Strict Doctype */
99d6d3207e24ba1f8eba77ef903948d738886cf5nd#define DOCTYPE_XHTML_1_0S "<!DOCTYPE html PUBLIC \"-//W3C//" \
99d6d3207e24ba1f8eba77ef903948d738886cf5nd "DTD XHTML 1.0 Strict//EN\"\n" \
99d6d3207e24ba1f8eba77ef903948d738886cf5nd "\"http://www.w3.org/TR/xhtml1/DTD/" \
99d6d3207e24ba1f8eba77ef903948d738886cf5nd "xhtml1-strict.dtd\">\n"
99d6d3207e24ba1f8eba77ef903948d738886cf5nd/** XHTML 1.0 Transitional Doctype */
99d6d3207e24ba1f8eba77ef903948d738886cf5nd#define DOCTYPE_XHTML_1_0T "<!DOCTYPE html PUBLIC \"-//W3C//" \
99d6d3207e24ba1f8eba77ef903948d738886cf5nd "DTD XHTML 1.0 Transitional//EN\"\n" \
99d6d3207e24ba1f8eba77ef903948d738886cf5nd "\"http://www.w3.org/TR/xhtml1/DTD/" \
99d6d3207e24ba1f8eba77ef903948d738886cf5nd "xhtml1-transitional.dtd\">\n"
99d6d3207e24ba1f8eba77ef903948d738886cf5nd/** XHTML 1.0 Frameset Doctype */
99d6d3207e24ba1f8eba77ef903948d738886cf5nd#define DOCTYPE_XHTML_1_0F "<!DOCTYPE html PUBLIC \"-//W3C//" \
99d6d3207e24ba1f8eba77ef903948d738886cf5nd "DTD XHTML 1.0 Frameset//EN\"\n" \
99d6d3207e24ba1f8eba77ef903948d738886cf5nd "\"http://www.w3.org/TR/xhtml1/DTD/" \
99d6d3207e24ba1f8eba77ef903948d738886cf5nd "xhtml1-frameset.dtd\">"
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** Internal representation for a HTTP protocol number, e.g., HTTP/1.1 */
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb#define HTTP_VERSION(major,minor) (1000*(major)+(minor))
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** Major part of HTTP protocol */
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb#define HTTP_VERSION_MAJOR(number) ((number)/1000)
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** Minor part of HTTP protocol */
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb#define HTTP_VERSION_MINOR(number) ((number)%1000)
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb/* -------------- Port number for server running standalone --------------- */
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** default HTTP Port */
11e076839c8d5a82d55e710194d0daac51390dbdsf#define DEFAULT_HTTP_PORT 80
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** default HTTPS Port */
11e076839c8d5a82d55e710194d0daac51390dbdsf#define DEFAULT_HTTPS_PORT 443
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben/**
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * Check whether @a port is the default port for the request @a r.
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param port The port number
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param r The request
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @see #ap_default_port
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben */
11e076839c8d5a82d55e710194d0daac51390dbdsf#define ap_is_default_port(port,r) ((port) == ap_default_port(r))
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben/**
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * Get the default port for a request (which depends on the scheme).
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param r The request
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben */
11e076839c8d5a82d55e710194d0daac51390dbdsf#define ap_default_port(r) ap_run_default_port(r)
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben/**
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * Get the scheme for a request.
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param r The request
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben */
11e076839c8d5a82d55e710194d0daac51390dbdsf#define ap_http_scheme(r) ap_run_http_scheme(r)
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/** The default string length */
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb#define MAX_STRING_LEN HUGE_STRING_LEN
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/** The length of a Huge string */
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb#define HUGE_STRING_LEN 8192
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** The size of the server's internal read-write buffers */
1374444b4fab1475091e12a81663f379b73005efrbb#define AP_IOBUFSIZE 8192
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb
bbe046d7cbb950ab3e372e4119ae001a5fe52ed4striker/** The max number of regex captures that can be expanded by ap_pregsub */
bbe046d7cbb950ab3e372e4119ae001a5fe52ed4striker#define AP_MAX_REG_MATCH 10
bbe046d7cbb950ab3e372e4119ae001a5fe52ed4striker
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/**
742318b93e89c311f66b55f426c4d9cf2c14628bjim * APR_HAS_LARGE_FILES introduces the problem of spliting sendfile into
742318b93e89c311f66b55f426c4d9cf2c14628bjim * mutiple buckets, no greater than MAX(apr_size_t), and more granular
c8aa00ee0cfc17b5fa08fb8a2b08d30dc9e4f1b1wrowe * than that in case the brigade code/filters attempt to read it directly.
4542d057c4bde23857f31d449fa3108561206139wrowe * ### 16mb is an invention, no idea if it is reasonable.
c8aa00ee0cfc17b5fa08fb8a2b08d30dc9e4f1b1wrowe */
4542d057c4bde23857f31d449fa3108561206139wrowe#define AP_MAX_SENDFILE 16777216 /* 2^24 */
c8aa00ee0cfc17b5fa08fb8a2b08d30dc9e4f1b1wrowe
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/**
781d84f4881d360ea321238ef09c29798caedd4ctrawick * MPM child process exit status values
781d84f4881d360ea321238ef09c29798caedd4ctrawick * The MPM parent process may check the status to see if special
781d84f4881d360ea321238ef09c29798caedd4ctrawick * error handling is required.
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb */
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** a normal exit */
11e076839c8d5a82d55e710194d0daac51390dbdsf#define APEXIT_OK 0x0
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** A fatal error arising during the server's init sequence */
11e076839c8d5a82d55e710194d0daac51390dbdsf#define APEXIT_INIT 0x2
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** The child died during its init sequence */
11e076839c8d5a82d55e710194d0daac51390dbdsf#define APEXIT_CHILDINIT 0x3
742318b93e89c311f66b55f426c4d9cf2c14628bjim/**
6d74c65f131583f6832b04424c1a9e1e7cc72c8egregames * The child exited due to a resource shortage.
6d74c65f131583f6832b04424c1a9e1e7cc72c8egregames * The parent should limit the rate of forking until
6d74c65f131583f6832b04424c1a9e1e7cc72c8egregames * the situation is resolved.
6d74c65f131583f6832b04424c1a9e1e7cc72c8egregames */
6d74c65f131583f6832b04424c1a9e1e7cc72c8egregames#define APEXIT_CHILDSICK 0x7
742318b93e89c311f66b55f426c4d9cf2c14628bjim/**
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh * A fatal error, resulting in the whole server aborting.
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh * If a child exits with this error, the parent process
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh * considers this a server-wide fatal error and aborts.
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh */
11e076839c8d5a82d55e710194d0daac51390dbdsf#define APEXIT_CHILDFATAL 0xf
2e123e8beedc9f921448c113e2d6823a92fd5261fielding
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben#ifndef AP_DECLARE
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben/**
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * Stuff marked #AP_DECLARE is part of the API, and intended for use
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * by modules. Its purpose is to allow us to add attributes that
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * particular platforms or compilers require to every exported function.
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben */
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben# define AP_DECLARE(type) type
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben#endif
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben#ifndef AP_DECLARE_NONSTD
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben/**
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * Stuff marked #AP_DECLARE_NONSTD is part of the API, and intended for
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * use by modules. The difference between #AP_DECLARE and
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * #AP_DECLARE_NONSTD is that the latter is required for any functions
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * which use varargs or are used via indirect function call. This
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * is to accomodate the two calling conventions in windows dlls.
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben */
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben# define AP_DECLARE_NONSTD(type) type
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben#endif
64b9fa4bc3e79b0eefb2d93fb56eae40d88e0f06wrowe#ifndef AP_DECLARE_DATA
64b9fa4bc3e79b0eefb2d93fb56eae40d88e0f06wrowe# define AP_DECLARE_DATA
64b9fa4bc3e79b0eefb2d93fb56eae40d88e0f06wrowe#endif
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben
64b9fa4bc3e79b0eefb2d93fb56eae40d88e0f06wrowe#ifndef AP_MODULE_DECLARE
64b9fa4bc3e79b0eefb2d93fb56eae40d88e0f06wrowe# define AP_MODULE_DECLARE(type) type
64b9fa4bc3e79b0eefb2d93fb56eae40d88e0f06wrowe#endif
64b9fa4bc3e79b0eefb2d93fb56eae40d88e0f06wrowe#ifndef AP_MODULE_DECLARE_NONSTD
64b9fa4bc3e79b0eefb2d93fb56eae40d88e0f06wrowe# define AP_MODULE_DECLARE_NONSTD(type) type
64b9fa4bc3e79b0eefb2d93fb56eae40d88e0f06wrowe#endif
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben#ifndef AP_MODULE_DECLARE_DATA
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben# define AP_MODULE_DECLARE_DATA
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben#endif
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/**
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh * @internal
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * modules should not use functions marked AP_CORE_DECLARE
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh */
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben#ifndef AP_CORE_DECLARE
11e076839c8d5a82d55e710194d0daac51390dbdsf# define AP_CORE_DECLARE AP_DECLARE
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben#endif
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/**
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh * @internal
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * modules should not use functions marked AP_CORE_DECLARE_NONSTD
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh */
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben#ifndef AP_CORE_DECLARE_NONSTD
11e076839c8d5a82d55e710194d0daac51390dbdsf# define AP_CORE_DECLARE_NONSTD AP_DECLARE_NONSTD
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben#endif
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben
bd6f55fcc632c166165842eb23dcc1105ddde364sf/**
bd6f55fcc632c166165842eb23dcc1105ddde364sf * @defgroup APACHE_APR_STATUS_T HTTPD specific values of apr_status_t
bd6f55fcc632c166165842eb23dcc1105ddde364sf * @{
bd6f55fcc632c166165842eb23dcc1105ddde364sf */
bd6f55fcc632c166165842eb23dcc1105ddde364sf#define AP_START_USERERR (APR_OS_START_USERERR + 2000)
bd6f55fcc632c166165842eb23dcc1105ddde364sf#define AP_USERERR_LEN 1000
bd6f55fcc632c166165842eb23dcc1105ddde364sf
bd6f55fcc632c166165842eb23dcc1105ddde364sf/** The function declines to handle the request */
bd6f55fcc632c166165842eb23dcc1105ddde364sf#define AP_DECLINED (AP_START_USERERR + 0)
bd6f55fcc632c166165842eb23dcc1105ddde364sf
bd6f55fcc632c166165842eb23dcc1105ddde364sf/** @} */
bd6f55fcc632c166165842eb23dcc1105ddde364sf
742318b93e89c311f66b55f426c4d9cf2c14628bjim/**
742318b93e89c311f66b55f426c4d9cf2c14628bjim * @brief The numeric version information is broken out into fields within this
742318b93e89c311f66b55f426c4d9cf2c14628bjim * structure.
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd */
d11bf78168abbb07d8ed9f54d7ea0953d46aad83ndtypedef struct {
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd int major; /**< major number */
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd int minor; /**< minor number */
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd int patch; /**< patch number */
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd const char *add_string; /**< additional string like "-dev" */
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd} ap_version_t;
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd/**
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd * Return httpd's version information in a numeric form.
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd *
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd * @param version Pointer to a version structure for returning the version
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd * information.
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd */
d11bf78168abbb07d8ed9f54d7ea0953d46aad83ndAP_DECLARE(void) ap_get_server_revision(ap_version_t *version);
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd
a520b923984f45daeaf0741d5c7e3de1f2d24509rbb/**
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick * Get the server banner in a form suitable for sending over the
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick * network, with the level of information controlled by the
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick * ServerTokens directive.
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick * @return The server banner
a520b923984f45daeaf0741d5c7e3de1f2d24509rbb */
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawickAP_DECLARE(const char *) ap_get_server_banner(void);
a520b923984f45daeaf0741d5c7e3de1f2d24509rbb
a520b923984f45daeaf0741d5c7e3de1f2d24509rbb/**
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick * Get the server description in a form suitable for local displays,
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick * status reports, or logging. This includes the detailed server
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick * version and information about some modules. It is not affected
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick * by the ServerTokens directive.
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick * @return The server description
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick */
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawickAP_DECLARE(const char *) ap_get_server_description(void);
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick/**
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick * Add a component to the server description and banner strings
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param pconf The pool to allocate the component from
a520b923984f45daeaf0741d5c7e3de1f2d24509rbb * @param component The string to add
a520b923984f45daeaf0741d5c7e3de1f2d24509rbb */
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(void) ap_add_version_component(apr_pool_t *pconf, const char *component);
a520b923984f45daeaf0741d5c7e3de1f2d24509rbb
a520b923984f45daeaf0741d5c7e3de1f2d24509rbb/**
a520b923984f45daeaf0741d5c7e3de1f2d24509rbb * Get the date a time that the server was built
a520b923984f45daeaf0741d5c7e3de1f2d24509rbb * @return The server build time string
a520b923984f45daeaf0741d5c7e3de1f2d24509rbb */
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(const char *) ap_get_server_built(void);
2d2eda71267231c2526be701fe655db125852c1ffielding
4e2c23ca8bd7b207f6e9c396759c1e2171370990trawick/* non-HTTP status codes returned by hooks */
ceb14f8ba57a8086c9a68ad264efbe2433134382covener
11e076839c8d5a82d55e710194d0daac51390dbdsf#define OK 0 /**< Module has handled this stage. */
11e076839c8d5a82d55e710194d0daac51390dbdsf#define DECLINED -1 /**< Module declines to handle */
11e076839c8d5a82d55e710194d0daac51390dbdsf#define DONE -2 /**< Module has served the response completely
11e076839c8d5a82d55e710194d0daac51390dbdsf * - it's safe to die() with no more output
11e076839c8d5a82d55e710194d0daac51390dbdsf */
742318b93e89c311f66b55f426c4d9cf2c14628bjim#define SUSPENDED -3 /**< Module will handle the remainder of the request.
b0d8a6d437db6f4c222173f27ef81c98622fbd02pquerna * The core will never invoke the request again, */
2d2eda71267231c2526be701fe655db125852c1ffielding
ceb14f8ba57a8086c9a68ad264efbe2433134382covener/** Returned by the bottom-most filter if no data was written.
ceb14f8ba57a8086c9a68ad264efbe2433134382covener * @see ap_pass_brigade(). */
ceb14f8ba57a8086c9a68ad264efbe2433134382covener#define AP_NOBODY_WROTE -100
ceb14f8ba57a8086c9a68ad264efbe2433134382covener/** Returned by the bottom-most filter if no data was read.
ceb14f8ba57a8086c9a68ad264efbe2433134382covener * @see ap_get_brigade(). */
ceb14f8ba57a8086c9a68ad264efbe2433134382covener#define AP_NOBODY_READ -101
ceb14f8ba57a8086c9a68ad264efbe2433134382covener/** Returned by any filter if the filter chain encounters an error
ceb14f8ba57a8086c9a68ad264efbe2433134382covener * and has already dealt with the error response.
ceb14f8ba57a8086c9a68ad264efbe2433134382covener */
ceb14f8ba57a8086c9a68ad264efbe2433134382covener#define AP_FILTER_ERROR -102
2d2eda71267231c2526be701fe655db125852c1ffielding
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/**
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh * @defgroup HTTP_Status HTTP Status Codes
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh * @{
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh */
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/**
84d037d25827739cce57d489ab4a97accbe2fd18rjung * The size of the static status_lines array in http_protocol.c for
84d037d25827739cce57d489ab4a97accbe2fd18rjung * storing all of the potential response status-lines (a sparse table).
84d037d25827739cce57d489ab4a97accbe2fd18rjung * When adding a new code here add it to status_lines as well.
1ccd992d37d62c8cb2056126f2234f64ec189bfddougm * A future version should dynamically generate the apr_table_t at startup.
2d2eda71267231c2526be701fe655db125852c1ffielding */
84d037d25827739cce57d489ab4a97accbe2fd18rjung#define RESPONSE_CODES 83
2d2eda71267231c2526be701fe655db125852c1ffielding
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_CONTINUE 100
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_SWITCHING_PROTOCOLS 101
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_PROCESSING 102
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_OK 200
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_CREATED 201
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_ACCEPTED 202
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_NON_AUTHORITATIVE 203
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_NO_CONTENT 204
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_RESET_CONTENT 205
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_PARTIAL_CONTENT 206
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_MULTI_STATUS 207
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_ALREADY_REPORTED 208
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_IM_USED 226
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_MULTIPLE_CHOICES 300
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_MOVED_PERMANENTLY 301
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_MOVED_TEMPORARILY 302
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_SEE_OTHER 303
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_NOT_MODIFIED 304
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_USE_PROXY 305
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_TEMPORARY_REDIRECT 307
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_PERMANENT_REDIRECT 308
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_BAD_REQUEST 400
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_UNAUTHORIZED 401
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_PAYMENT_REQUIRED 402
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_FORBIDDEN 403
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_NOT_FOUND 404
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_METHOD_NOT_ALLOWED 405
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_NOT_ACCEPTABLE 406
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_PROXY_AUTHENTICATION_REQUIRED 407
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_REQUEST_TIME_OUT 408
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_CONFLICT 409
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_GONE 410
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_LENGTH_REQUIRED 411
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_PRECONDITION_FAILED 412
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_REQUEST_ENTITY_TOO_LARGE 413
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_REQUEST_URI_TOO_LARGE 414
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_UNSUPPORTED_MEDIA_TYPE 415
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_RANGE_NOT_SATISFIABLE 416
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_EXPECTATION_FAILED 417
5b88c8507d5ef6d0c4cfbc78230294968175b638minfrin#define HTTP_IM_A_TEAPOT 418
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_UNPROCESSABLE_ENTITY 422
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_LOCKED 423
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_FAILED_DEPENDENCY 424
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_UPGRADE_REQUIRED 426
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_PRECONDITION_REQUIRED 428
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_TOO_MANY_REQUESTS 429
84d037d25827739cce57d489ab4a97accbe2fd18rjung#define HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE 431
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_INTERNAL_SERVER_ERROR 500
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_NOT_IMPLEMENTED 501
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_BAD_GATEWAY 502
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_SERVICE_UNAVAILABLE 503
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_GATEWAY_TIME_OUT 504
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_VERSION_NOT_SUPPORTED 505
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_VARIANT_ALSO_VARIES 506
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_INSUFFICIENT_STORAGE 507
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_LOOP_DETECTED 508
1f73c585a0cd240fbe11af0cf422681061d67ad9rjung#define HTTP_NOT_EXTENDED 510
84d037d25827739cce57d489ab4a97accbe2fd18rjung#define HTTP_NETWORK_AUTHENTICATION_REQUIRED 511
2d2eda71267231c2526be701fe655db125852c1ffielding
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** is the status code informational */
2d2eda71267231c2526be701fe655db125852c1ffielding#define ap_is_HTTP_INFO(x) (((x) >= 100)&&((x) < 200))
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** is the status code OK ?*/
2d2eda71267231c2526be701fe655db125852c1ffielding#define ap_is_HTTP_SUCCESS(x) (((x) >= 200)&&((x) < 300))
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** is the status code a redirect */
2d2eda71267231c2526be701fe655db125852c1ffielding#define ap_is_HTTP_REDIRECT(x) (((x) >= 300)&&((x) < 400))
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** is the status code a error (client or server) */
2d2eda71267231c2526be701fe655db125852c1ffielding#define ap_is_HTTP_ERROR(x) (((x) >= 400)&&((x) < 600))
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** is the status code a client error */
2d2eda71267231c2526be701fe655db125852c1ffielding#define ap_is_HTTP_CLIENT_ERROR(x) (((x) >= 400)&&((x) < 500))
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** is the status code a server error */
2d2eda71267231c2526be701fe655db125852c1ffielding#define ap_is_HTTP_SERVER_ERROR(x) (((x) >= 500)&&((x) < 600))
a59f92f67a2c7735469d0ade559f96218627eef0niq/** is the status code a (potentially) valid response code? */
a59f92f67a2c7735469d0ade559f96218627eef0niq#define ap_is_HTTP_VALID_RESPONSE(x) (((x) >= 100)&&((x) < 600))
2d2eda71267231c2526be701fe655db125852c1ffielding
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** should the status code drop the connection */
2d2eda71267231c2526be701fe655db125852c1ffielding#define ap_status_drops_connection(x) \
2d2eda71267231c2526be701fe655db125852c1ffielding (((x) == HTTP_BAD_REQUEST) || \
2d2eda71267231c2526be701fe655db125852c1ffielding ((x) == HTTP_REQUEST_TIME_OUT) || \
2d2eda71267231c2526be701fe655db125852c1ffielding ((x) == HTTP_LENGTH_REQUIRED) || \
2d2eda71267231c2526be701fe655db125852c1ffielding ((x) == HTTP_REQUEST_ENTITY_TOO_LARGE) || \
2d2eda71267231c2526be701fe655db125852c1ffielding ((x) == HTTP_REQUEST_URI_TOO_LARGE) || \
2d2eda71267231c2526be701fe655db125852c1ffielding ((x) == HTTP_INTERNAL_SERVER_ERROR) || \
2d2eda71267231c2526be701fe655db125852c1ffielding ((x) == HTTP_SERVICE_UNAVAILABLE) || \
11e076839c8d5a82d55e710194d0daac51390dbdsf ((x) == HTTP_NOT_IMPLEMENTED))
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** @} */
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/**
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh * @defgroup Methods List of Methods recognized by the server
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @ingroup APACHE_CORE_DAEMON
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh * @{
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh *
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @brief Methods recognized (but not necessarily handled) by the server.
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh *
2d2eda71267231c2526be701fe655db125852c1ffielding * These constants are used in bit shifting masks of size int, so it is
2d2eda71267231c2526be701fe655db125852c1ffielding * unsafe to have more methods than bits in an int. HEAD == M_GET.
763f7b125b6d3dd1e4992a3822005efa2616f983coar * This list must be tracked by the list in http_protocol.c in routine
763f7b125b6d3dd1e4992a3822005efa2616f983coar * ap_method_name_of().
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh *
2d2eda71267231c2526be701fe655db125852c1ffielding */
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh#define M_GET 0 /** RFC 2616: HTTP */
5a9667916c79d8c699b069068e5570aa1c331c80gstein#define M_PUT 1 /* : */
5a9667916c79d8c699b069068e5570aa1c331c80gstein#define M_POST 2
5a9667916c79d8c699b069068e5570aa1c331c80gstein#define M_DELETE 3
5a9667916c79d8c699b069068e5570aa1c331c80gstein#define M_CONNECT 4
5a9667916c79d8c699b069068e5570aa1c331c80gstein#define M_OPTIONS 5
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh#define M_TRACE 6 /** RFC 2616: HTTP */
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh#define M_PATCH 7 /** no rfc(!) ### remove this one? */
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh#define M_PROPFIND 8 /** RFC 2518: WebDAV */
5a9667916c79d8c699b069068e5570aa1c331c80gstein#define M_PROPPATCH 9 /* : */
5a9667916c79d8c699b069068e5570aa1c331c80gstein#define M_MKCOL 10
5a9667916c79d8c699b069068e5570aa1c331c80gstein#define M_COPY 11
5a9667916c79d8c699b069068e5570aa1c331c80gstein#define M_MOVE 12
5a9667916c79d8c699b069068e5570aa1c331c80gstein#define M_LOCK 13
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh#define M_UNLOCK 14 /** RFC 2518: WebDAV */
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh#define M_VERSION_CONTROL 15 /** RFC 3253: WebDAV Versioning */
5a9667916c79d8c699b069068e5570aa1c331c80gstein#define M_CHECKOUT 16 /* : */
5a9667916c79d8c699b069068e5570aa1c331c80gstein#define M_UNCHECKOUT 17
5a9667916c79d8c699b069068e5570aa1c331c80gstein#define M_CHECKIN 18
5a9667916c79d8c699b069068e5570aa1c331c80gstein#define M_UPDATE 19
5a9667916c79d8c699b069068e5570aa1c331c80gstein#define M_LABEL 20
5a9667916c79d8c699b069068e5570aa1c331c80gstein#define M_REPORT 21
5a9667916c79d8c699b069068e5570aa1c331c80gstein#define M_MKWORKSPACE 22
5a9667916c79d8c699b069068e5570aa1c331c80gstein#define M_MKACTIVITY 23
5a9667916c79d8c699b069068e5570aa1c331c80gstein#define M_BASELINE_CONTROL 24
5a9667916c79d8c699b069068e5570aa1c331c80gstein#define M_MERGE 25
f6d39fd36344c7d6622be6ab6b98185a69e7d7ebsf#define M_INVALID 26 /** no valid method */
5b88c8507d5ef6d0c4cfbc78230294968175b638minfrin#define M_BREW 27 /** RFC 2324: HTCPCP/1.0 */
5b88c8507d5ef6d0c4cfbc78230294968175b638minfrin#define M_WHEN 28 /** RFC 2324: HTCPCP/1.0 */
2d2eda71267231c2526be701fe655db125852c1ffielding
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/**
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh * METHODS needs to be equal to the number of bits
62db15de4c1f335a64d45821796ae197cff94ef8rbb * we are using for limit masks.
62db15de4c1f335a64d45821796ae197cff94ef8rbb */
62db15de4c1f335a64d45821796ae197cff94ef8rbb#define METHODS 64
2d2eda71267231c2526be701fe655db125852c1ffielding
48d2edbfb84e5559b5da0f8d614ccab805cc67a8rbb/**
48d2edbfb84e5559b5da0f8d614ccab805cc67a8rbb * The method mask bit to shift for anding with a bitmask.
48d2edbfb84e5559b5da0f8d614ccab805cc67a8rbb */
5a9667916c79d8c699b069068e5570aa1c331c80gstein#define AP_METHOD_BIT ((apr_int64_t)1)
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** @} */
48d2edbfb84e5559b5da0f8d614ccab805cc67a8rbb
48d2edbfb84e5559b5da0f8d614ccab805cc67a8rbb
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/** @see ap_method_list_t */
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianhtypedef struct ap_method_list_t ap_method_list_t;
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh
a520b923984f45daeaf0741d5c7e3de1f2d24509rbb/**
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @struct ap_method_list_t
742318b93e89c311f66b55f426c4d9cf2c14628bjim * @brief Structure for handling HTTP methods.
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh *
742318b93e89c311f66b55f426c4d9cf2c14628bjim * Methods known to the server are accessed via a bitmask shortcut;
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * extension methods are handled by an array.
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar */
a520b923984f45daeaf0741d5c7e3de1f2d24509rbbstruct ap_method_list_t {
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh /** The bitmask used for known methods */
62db15de4c1f335a64d45821796ae197cff94ef8rbb apr_int64_t method_mask;
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh /** the array used for extension methods */
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar apr_array_header_t *method_list;
a520b923984f45daeaf0741d5c7e3de1f2d24509rbb};
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/**
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh * @defgroup module_magic Module Magic mime types
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh * @{
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh */
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** Magic for mod_cgi[d] */
2d2eda71267231c2526be701fe655db125852c1ffielding#define CGI_MAGIC_TYPE "application/x-httpd-cgi"
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** Magic for mod_include */
2d2eda71267231c2526be701fe655db125852c1ffielding#define INCLUDES_MAGIC_TYPE "text/x-server-parsed-html"
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** Magic for mod_include */
2d2eda71267231c2526be701fe655db125852c1ffielding#define INCLUDES_MAGIC_TYPE3 "text/x-server-parsed-html3"
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** Magic for mod_dir */
2d2eda71267231c2526be701fe655db125852c1ffielding#define DIR_MAGIC_TYPE "httpd/unix-directory"
6bfc8506f7984214517133b69712c5cd1d2ed922covener/** Default for r->handler if no content-type set by type_checker */
6bfc8506f7984214517133b69712c5cd1d2ed922covener#define AP_DEFAULT_HANDLER_NAME ""
6bfc8506f7984214517133b69712c5cd1d2ed922covener#define AP_IS_DEFAULT_HANDLER_NAME(x) (*x == '\0')
2d2eda71267231c2526be701fe655db125852c1ffielding
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** @} */
54e94821097724bf413d2d4cc70711760f7494e1trawick/* Just in case your linefeed isn't the one the other end is expecting. */
db3fa7db7c7910f2f23c3e3ffe0cf9f41a1899b9trawick#if !APR_CHARSET_EBCDIC
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** linefeed */
2d2eda71267231c2526be701fe655db125852c1ffielding#define LF 10
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** carrige return */
2d2eda71267231c2526be701fe655db125852c1ffielding#define CR 13
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** carrige return /Line Feed Combo */
54e94821097724bf413d2d4cc70711760f7494e1trawick#define CRLF "\015\012"
db3fa7db7c7910f2f23c3e3ffe0cf9f41a1899b9trawick#else /* APR_CHARSET_EBCDIC */
54e94821097724bf413d2d4cc70711760f7494e1trawick/* For platforms using the EBCDIC charset, the transition ASCII->EBCDIC is done
54e94821097724bf413d2d4cc70711760f7494e1trawick * in the buff package (bread/bputs/bwrite). Everywhere else, we use
54e94821097724bf413d2d4cc70711760f7494e1trawick * "native EBCDIC" CR and NL characters. These are therefore
54e94821097724bf413d2d4cc70711760f7494e1trawick * defined as
54e94821097724bf413d2d4cc70711760f7494e1trawick * '\r' and '\n'.
54e94821097724bf413d2d4cc70711760f7494e1trawick */
54e94821097724bf413d2d4cc70711760f7494e1trawick#define CR '\r'
54e94821097724bf413d2d4cc70711760f7494e1trawick#define LF '\n'
54e94821097724bf413d2d4cc70711760f7494e1trawick#define CRLF "\r\n"
742318b93e89c311f66b55f426c4d9cf2c14628bjim#endif /* APR_CHARSET_EBCDIC */
c8477d12d1b127ab46dffe4ee526b9d11f71699egregames/** Useful for common code with either platform charset. */
c8477d12d1b127ab46dffe4ee526b9d11f71699egregames#define CRLF_ASCII "\015\012"
2d2eda71267231c2526be701fe655db125852c1ffielding
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/**
742318b93e89c311f66b55f426c4d9cf2c14628bjim * @defgroup values_request_rec_body Possible values for request_rec.read_body
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh * @{
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh * Possible values for request_rec.read_body (set by handling module):
2d2eda71267231c2526be701fe655db125852c1ffielding */
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** Send 413 error if message has any body */
2d2eda71267231c2526be701fe655db125852c1ffielding#define REQUEST_NO_BODY 0
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** Send 411 error if body without Content-Length */
2d2eda71267231c2526be701fe655db125852c1ffielding#define REQUEST_CHUNKED_ERROR 1
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** If chunked, remove the chunks for me. */
2d2eda71267231c2526be701fe655db125852c1ffielding#define REQUEST_CHUNKED_DECHUNK 2
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/** @} // values_request_rec_body */
2d2eda71267231c2526be701fe655db125852c1ffielding
cd9eb79cfbf9bc730ccacc3a3774b1fe1b99ed53wrowe/**
742318b93e89c311f66b55f426c4d9cf2c14628bjim * @defgroup values_request_rec_used_path_info Possible values for request_rec.used_path_info
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @ingroup APACHE_CORE_DAEMON
cd9eb79cfbf9bc730ccacc3a3774b1fe1b99ed53wrowe * @{
cd9eb79cfbf9bc730ccacc3a3774b1fe1b99ed53wrowe * Possible values for request_rec.used_path_info:
cd9eb79cfbf9bc730ccacc3a3774b1fe1b99ed53wrowe */
cd9eb79cfbf9bc730ccacc3a3774b1fe1b99ed53wrowe
e57fd661645dcfdf166e77484b509b248e62a19eaaron/** Accept the path_info from the request */
e57fd661645dcfdf166e77484b509b248e62a19eaaron#define AP_REQ_ACCEPT_PATH_INFO 0
e57fd661645dcfdf166e77484b509b248e62a19eaaron/** Return a 404 error if path_info was given */
cd9eb79cfbf9bc730ccacc3a3774b1fe1b99ed53wrowe#define AP_REQ_REJECT_PATH_INFO 1
e57fd661645dcfdf166e77484b509b248e62a19eaaron/** Module may chose to use the given path_info */
cd9eb79cfbf9bc730ccacc3a3774b1fe1b99ed53wrowe#define AP_REQ_DEFAULT_PATH_INFO 2
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/** @} // values_request_rec_used_path_info */
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh
cd9eb79cfbf9bc730ccacc3a3774b1fe1b99ed53wrowe
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/*
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh * Things which may vary per file-lookup WITHIN a request ---
2d2eda71267231c2526be701fe655db125852c1ffielding * e.g., state of MIME config. Basically, the name of an object, info
2d2eda71267231c2526be701fe655db125852c1ffielding * about the object, and any other info we may ahve which may need to
2d2eda71267231c2526be701fe655db125852c1ffielding * change as we go poking around looking for it (e.g., overridden by
2d2eda71267231c2526be701fe655db125852c1ffielding * .htaccess files).
2d2eda71267231c2526be701fe655db125852c1ffielding *
2d2eda71267231c2526be701fe655db125852c1ffielding * Note how the default state of almost all these things is properly
2d2eda71267231c2526be701fe655db125852c1ffielding * zero, so that allocating it with pcalloc does the right thing without
2d2eda71267231c2526be701fe655db125852c1ffielding * a whole lot of hairy initialization... so long as we are willing to
2d2eda71267231c2526be701fe655db125852c1ffielding * make the (fairly) portable assumption that the bit pattern of a NULL
2d2eda71267231c2526be701fe655db125852c1ffielding * pointer is, in fact, zero.
2d2eda71267231c2526be701fe655db125852c1ffielding */
2d2eda71267231c2526be701fe655db125852c1ffielding
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @brief This represents the result of calling htaccess; these are cached for
2d2eda71267231c2526be701fe655db125852c1ffielding * each request.
2d2eda71267231c2526be701fe655db125852c1ffielding */
2d2eda71267231c2526be701fe655db125852c1ffieldingstruct htaccess_result {
952908500d5f99f35afc5ed510391b9bdc3833farbb /** the directory to which this applies */
952908500d5f99f35afc5ed510391b9bdc3833farbb const char *dir;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** the overrides allowed for the .htaccess file */
952908500d5f99f35afc5ed510391b9bdc3833farbb int override;
103a93c625bcde1a6a7a5155b64dcda36f612180pquerna /** the override options allowed for the .htaccess file */
103a93c625bcde1a6a7a5155b64dcda36f612180pquerna int override_opts;
113961f0559eb026ea0d379cb7350f82bc09d710druggeri /** Table of allowed directives for override */
113961f0559eb026ea0d379cb7350f82bc09d710druggeri apr_table_t *override_list;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** the configuration directives */
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgstein struct ap_conf_vector_t *htaccess;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** the next one, or NULL if no more; N.B. never change this */
2d2eda71267231c2526be701fe655db125852c1ffielding const struct htaccess_result *next;
2d2eda71267231c2526be701fe655db125852c1ffielding};
2d2eda71267231c2526be701fe655db125852c1ffielding
3887202241db08986e94b252fbd06a55e55d4b2dbhyde/* The following four types define a hierarchy of activities, so that
3887202241db08986e94b252fbd06a55e55d4b2dbhyde * given a request_rec r you can write r->connection->server->process
3887202241db08986e94b252fbd06a55e55d4b2dbhyde * to get to the process_rec. While this reduces substantially the
3887202241db08986e94b252fbd06a55e55d4b2dbhyde * number of arguments that various hooks require beware that in
3887202241db08986e94b252fbd06a55e55d4b2dbhyde * threaded versions of the server you must consider multiplexing
3887202241db08986e94b252fbd06a55e55d4b2dbhyde * issues. */
3887202241db08986e94b252fbd06a55e55d4b2dbhyde
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** A structure that represents one process */
3887202241db08986e94b252fbd06a55e55d4b2dbhydetypedef struct process_rec process_rec;
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** A structure that represents a virtual server */
2d2eda71267231c2526be701fe655db125852c1ffieldingtypedef struct server_rec server_rec;
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** A structure that represents one connection */
3887202241db08986e94b252fbd06a55e55d4b2dbhydetypedef struct conn_rec conn_rec;
943016cae7a40f689cc0b65fd8cf8d4250a21352jim/** A structure that represents one slave connection */
943016cae7a40f689cc0b65fd8cf8d4250a21352jimtypedef struct conn_slave_rec conn_slave_rec;
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** A structure that represents the current request */
2d2eda71267231c2526be701fe655db125852c1ffieldingtypedef struct request_rec request_rec;
d9039a9aaeaa1359c1147af66c09aeac56ae3ee0pquerna/** A structure that represents the status of the current connection */
d9039a9aaeaa1359c1147af66c09aeac56ae3ee0pquernatypedef struct conn_state_t conn_state_t;
2d2eda71267231c2526be701fe655db125852c1ffielding
7c7372abe2484e7fcf81937b93496d1246e5b816gstein/* ### would be nice to not include this from httpd.h ... */
7c7372abe2484e7fcf81937b93496d1246e5b816gstein/* This comes after we have defined the request_rec type */
864c5615d55b8ebbde24e72043f6325741335a74fielding#include "apr_uri.h"
2d2eda71267231c2526be701fe655db125852c1ffielding
742318b93e89c311f66b55f426c4d9cf2c14628bjim/**
742318b93e89c311f66b55f426c4d9cf2c14628bjim * @brief A structure that represents one process
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh */
3887202241db08986e94b252fbd06a55e55d4b2dbhydestruct process_rec {
e57fd661645dcfdf166e77484b509b248e62a19eaaron /** Global pool. Cleared upon normal exit */
952908500d5f99f35afc5ed510391b9bdc3833farbb apr_pool_t *pool;
e57fd661645dcfdf166e77484b509b248e62a19eaaron /** Configuration pool. Cleared upon restart */
952908500d5f99f35afc5ed510391b9bdc3833farbb apr_pool_t *pconf;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** The program name used to execute the program */
3887202241db08986e94b252fbd06a55e55d4b2dbhyde const char *short_name;
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** The command line arguments */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf const char * const *argv;
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** Number of command line arguments passed to the program */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf int argc;
3887202241db08986e94b252fbd06a55e55d4b2dbhyde};
3887202241db08986e94b252fbd06a55e55d4b2dbhyde
742318b93e89c311f66b55f426c4d9cf2c14628bjim/**
742318b93e89c311f66b55f426c4d9cf2c14628bjim * @brief A structure that represents the current request
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh */
2d2eda71267231c2526be701fe655db125852c1ffieldingstruct request_rec {
952908500d5f99f35afc5ed510391b9bdc3833farbb /** The pool associated with the request */
1ccd992d37d62c8cb2056126f2234f64ec189bfddougm apr_pool_t *pool;
e57fd661645dcfdf166e77484b509b248e62a19eaaron /** The connection to the client */
2d2eda71267231c2526be701fe655db125852c1ffielding conn_rec *connection;
e57fd661645dcfdf166e77484b509b248e62a19eaaron /** The virtual host for this request */
2d2eda71267231c2526be701fe655db125852c1ffielding server_rec *server;
2d2eda71267231c2526be701fe655db125852c1ffielding
e57fd661645dcfdf166e77484b509b248e62a19eaaron /** Pointer to the redirected request if this is an external redirect */
952908500d5f99f35afc5ed510391b9bdc3833farbb request_rec *next;
e57fd661645dcfdf166e77484b509b248e62a19eaaron /** Pointer to the previous request if this is an internal redirect */
952908500d5f99f35afc5ed510391b9bdc3833farbb request_rec *prev;
2d2eda71267231c2526be701fe655db125852c1ffielding
6658f209f08181bd218341770db9f428032dd23ajwoolley /** Pointer to the main request if this is a sub-request
6658f209f08181bd218341770db9f428032dd23ajwoolley * (see http_request.h) */
952908500d5f99f35afc5ed510391b9bdc3833farbb request_rec *main;
2d2eda71267231c2526be701fe655db125852c1ffielding
2d2eda71267231c2526be701fe655db125852c1ffielding /* Info about the request itself... we begin with stuff that only
2d2eda71267231c2526be701fe655db125852c1ffielding * protocol.c should ever touch...
2d2eda71267231c2526be701fe655db125852c1ffielding */
e57fd661645dcfdf166e77484b509b248e62a19eaaron /** First line of request */
952908500d5f99f35afc5ed510391b9bdc3833farbb char *the_request;
97ff7bf3f33a3527953d975df5cbf82a5a7dc9a6wrowe /** HTTP/0.9, "simple" request (e.g. GET /foo\n w/no headers) */
952908500d5f99f35afc5ed510391b9bdc3833farbb int assbackwards;
853a0c44563b056e40e9cffe911190f554e63ec3chuck /** A proxy request (calculated during post_read_request/translate_name)
79c0ed7d839527abd86794a6b1d2df4fd189a2a8jerenkrantz * possible values PROXYREQ_NONE, PROXYREQ_PROXY, PROXYREQ_REVERSE,
79c0ed7d839527abd86794a6b1d2df4fd189a2a8jerenkrantz * PROXYREQ_RESPONSE
853a0c44563b056e40e9cffe911190f554e63ec3chuck */
952908500d5f99f35afc5ed510391b9bdc3833farbb int proxyreq;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** HEAD request, as opposed to GET */
952908500d5f99f35afc5ed510391b9bdc3833farbb int header_only;
e57fd661645dcfdf166e77484b509b248e62a19eaaron /** Protocol version number of protocol; 1.1 = 1001 */
952908500d5f99f35afc5ed510391b9bdc3833farbb int proto_num;
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** Protocol string, as given to us, or HTTP/0.9 */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf char *protocol;
d34215c0179ae2507afa57d912b91cc8abcef583sf /** Host, as set by full URI or Host: header.
d34215c0179ae2507afa57d912b91cc8abcef583sf * For literal IPv6 addresses, this does NOT include the surrounding [ ]
d34215c0179ae2507afa57d912b91cc8abcef583sf */
952908500d5f99f35afc5ed510391b9bdc3833farbb const char *hostname;
952908500d5f99f35afc5ed510391b9bdc3833farbb
e57fd661645dcfdf166e77484b509b248e62a19eaaron /** Time when the request started */
952908500d5f99f35afc5ed510391b9bdc3833farbb apr_time_t request_time;
952908500d5f99f35afc5ed510391b9bdc3833farbb
952908500d5f99f35afc5ed510391b9bdc3833farbb /** Status line, if set by script */
952908500d5f99f35afc5ed510391b9bdc3833farbb const char *status_line;
e57fd661645dcfdf166e77484b509b248e62a19eaaron /** Status line */
952908500d5f99f35afc5ed510391b9bdc3833farbb int status;
2d2eda71267231c2526be701fe655db125852c1ffielding
2d2eda71267231c2526be701fe655db125852c1ffielding /* Request method, two ways; also, protocol, etc.. Outside of protocol.c,
2d2eda71267231c2526be701fe655db125852c1ffielding * look, but don't touch.
2d2eda71267231c2526be701fe655db125852c1ffielding */
2d2eda71267231c2526be701fe655db125852c1ffielding
952908500d5f99f35afc5ed510391b9bdc3833farbb /** M_GET, M_POST, etc. */
952908500d5f99f35afc5ed510391b9bdc3833farbb int method_number;
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** Request method (eg. GET, HEAD, POST, etc.) */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf const char *method;
952908500d5f99f35afc5ed510391b9bdc3833farbb
9f9307bbe539dbcf96919715315eb64ce3465f5bben /**
e57fd661645dcfdf166e77484b509b248e62a19eaaron * 'allowed' is a bitvector of the allowed methods.
952908500d5f99f35afc5ed510391b9bdc3833farbb *
952908500d5f99f35afc5ed510391b9bdc3833farbb * A handler must ensure that the request method is one that
952908500d5f99f35afc5ed510391b9bdc3833farbb * it is capable of handling. Generally modules should DECLINE
952908500d5f99f35afc5ed510391b9bdc3833farbb * any request methods they do not handle. Prior to aborting the
952908500d5f99f35afc5ed510391b9bdc3833farbb * handler like this the handler should set r->allowed to the list
952908500d5f99f35afc5ed510391b9bdc3833farbb * of methods that it is willing to handle. This bitvector is used
952908500d5f99f35afc5ed510391b9bdc3833farbb * to construct the "Allow:" header required for OPTIONS requests,
952908500d5f99f35afc5ed510391b9bdc3833farbb * and HTTP_METHOD_NOT_ALLOWED and HTTP_NOT_IMPLEMENTED status codes.
952908500d5f99f35afc5ed510391b9bdc3833farbb *
952908500d5f99f35afc5ed510391b9bdc3833farbb * Since the default_handler deals with OPTIONS, all modules can
952908500d5f99f35afc5ed510391b9bdc3833farbb * usually decline to deal with OPTIONS. TRACE is always allowed,
952908500d5f99f35afc5ed510391b9bdc3833farbb * modules don't need to set it explicitly.
952908500d5f99f35afc5ed510391b9bdc3833farbb *
952908500d5f99f35afc5ed510391b9bdc3833farbb * Since the default_handler will always handle a GET, a
952908500d5f99f35afc5ed510391b9bdc3833farbb * module which does *not* implement GET should probably return
952908500d5f99f35afc5ed510391b9bdc3833farbb * HTTP_METHOD_NOT_ALLOWED. Unfortunately this means that a Script GET
9f9307bbe539dbcf96919715315eb64ce3465f5bben * handler can't be installed by mod_actions.
952908500d5f99f35afc5ed510391b9bdc3833farbb */
62db15de4c1f335a64d45821796ae197cff94ef8rbb apr_int64_t allowed;
a520b923984f45daeaf0741d5c7e3de1f2d24509rbb /** Array of extension methods */
742318b93e89c311f66b55f426c4d9cf2c14628bjim apr_array_header_t *allowed_xmethods;
a520b923984f45daeaf0741d5c7e3de1f2d24509rbb /** List of allowed methods */
742318b93e89c311f66b55f426c4d9cf2c14628bjim ap_method_list_t *allowed_methods;
2d2eda71267231c2526be701fe655db125852c1ffielding
952908500d5f99f35afc5ed510391b9bdc3833farbb /** byte count in stream is for body */
11a7b0dff22d26770b532c174d1cf2e7b56ec244wrowe apr_off_t sent_bodyct;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** body byte count, for easy access */
11a7b0dff22d26770b532c174d1cf2e7b56ec244wrowe apr_off_t bytes_sent;
e57fd661645dcfdf166e77484b509b248e62a19eaaron /** Last modified time of the requested resource */
952908500d5f99f35afc5ed510391b9bdc3833farbb apr_time_t mtime;
2d2eda71267231c2526be701fe655db125852c1ffielding
2d2eda71267231c2526be701fe655db125852c1ffielding /* HTTP/1.1 connection-level features */
2d2eda71267231c2526be701fe655db125852c1ffielding
952908500d5f99f35afc5ed510391b9bdc3833farbb /** The Range: header */
952908500d5f99f35afc5ed510391b9bdc3833farbb const char *range;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** The "real" content length */
7bdef86e15d47d16dcbe7a5611683191774bd5fbgstein apr_off_t clength;
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** sending chunked transfer-coding */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf int chunked;
952908500d5f99f35afc5ed510391b9bdc3833farbb
e57fd661645dcfdf166e77484b509b248e62a19eaaron /** Method for reading the request body
e57fd661645dcfdf166e77484b509b248e62a19eaaron * (eg. REQUEST_CHUNKED_ERROR, REQUEST_NO_BODY,
e57fd661645dcfdf166e77484b509b248e62a19eaaron * REQUEST_CHUNKED_DECHUNK, etc...) */
952908500d5f99f35afc5ed510391b9bdc3833farbb int read_body;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** reading chunked transfer-coding */
952908500d5f99f35afc5ed510391b9bdc3833farbb int read_chunked;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** is client waiting for a 100 response? */
952908500d5f99f35afc5ed510391b9bdc3833farbb unsigned expecting_100;
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** The optional kept body of the request. */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf apr_bucket_brigade *kept_body;
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** For ap_body_to_table(): parsed body */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /* XXX: ap_body_to_table has been removed. Remove body_table too or
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf * XXX: keep it to reintroduce ap_body_to_table without major bump? */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf apr_table_t *body_table;
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** Remaining bytes left to read from the request body */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf apr_off_t remaining;
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** Number of bytes that have been read from the request body */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf apr_off_t read_length;
2d2eda71267231c2526be701fe655db125852c1ffielding
2d2eda71267231c2526be701fe655db125852c1ffielding /* MIME header environments, in and out. Also, an array containing
2d2eda71267231c2526be701fe655db125852c1ffielding * environment variables to be passed to subprocesses, so people can
2d2eda71267231c2526be701fe655db125852c1ffielding * write modules to add to that environment.
2d2eda71267231c2526be701fe655db125852c1ffielding *
2d2eda71267231c2526be701fe655db125852c1ffielding * The difference between headers_out and err_headers_out is that the
2d2eda71267231c2526be701fe655db125852c1ffielding * latter are printed even on error, and persist across internal redirects
2d2eda71267231c2526be701fe655db125852c1ffielding * (so the headers printed for ErrorDocument handlers will have them).
2d2eda71267231c2526be701fe655db125852c1ffielding *
1ccd992d37d62c8cb2056126f2234f64ec189bfddougm * The 'notes' apr_table_t is for notes from one module to another, with no
2d2eda71267231c2526be701fe655db125852c1ffielding * other set purpose in mind...
2d2eda71267231c2526be701fe655db125852c1ffielding */
2d2eda71267231c2526be701fe655db125852c1ffielding
952908500d5f99f35afc5ed510391b9bdc3833farbb /** MIME header environment from the request */
1ccd992d37d62c8cb2056126f2234f64ec189bfddougm apr_table_t *headers_in;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** MIME header environment for the response */
1ccd992d37d62c8cb2056126f2234f64ec189bfddougm apr_table_t *headers_out;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** MIME header environment for the response, printed even on errors and
952908500d5f99f35afc5ed510391b9bdc3833farbb * persist across internal redirects */
1ccd992d37d62c8cb2056126f2234f64ec189bfddougm apr_table_t *err_headers_out;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** Array of environment variables to be used for sub processes */
1ccd992d37d62c8cb2056126f2234f64ec189bfddougm apr_table_t *subprocess_env;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** Notes from one module to another */
1ccd992d37d62c8cb2056126f2234f64ec189bfddougm apr_table_t *notes;
2d2eda71267231c2526be701fe655db125852c1ffielding
742318b93e89c311f66b55f426c4d9cf2c14628bjim /* content_type, handler, content_encoding, and all content_languages
44a4ee1140769173da7bc2b42d1a686e3260ad84wrowe * MUST be lowercased strings. They may be pointers to static strings;
44a4ee1140769173da7bc2b42d1a686e3260ad84wrowe * they should not be modified in place.
2d2eda71267231c2526be701fe655db125852c1ffielding */
952908500d5f99f35afc5ed510391b9bdc3833farbb /** The content-type for the current request */
11e076839c8d5a82d55e710194d0daac51390dbdsf const char *content_type; /* Break these out --- we dispatch on 'em */
952908500d5f99f35afc5ed510391b9bdc3833farbb /** The handler string that we use to call a handler function */
11e076839c8d5a82d55e710194d0daac51390dbdsf const char *handler; /* What we *really* dispatch on */
2d2eda71267231c2526be701fe655db125852c1ffielding
952908500d5f99f35afc5ed510391b9bdc3833farbb /** How to encode the data */
2d2eda71267231c2526be701fe655db125852c1ffielding const char *content_encoding;
e57fd661645dcfdf166e77484b509b248e62a19eaaron /** Array of strings representing the content languages */
952908500d5f99f35afc5ed510391b9bdc3833farbb apr_array_header_t *content_languages;
2d2eda71267231c2526be701fe655db125852c1ffielding
952908500d5f99f35afc5ed510391b9bdc3833farbb /** variant list validator (if negotiated) */
952908500d5f99f35afc5ed510391b9bdc3833farbb char *vlist_validator;
742318b93e89c311f66b55f426c4d9cf2c14628bjim
952908500d5f99f35afc5ed510391b9bdc3833farbb /** If an authentication check was made, this gets set to the user name. */
742318b93e89c311f66b55f426c4d9cf2c14628bjim char *user;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** If an authentication check was made, this gets set to the auth type. */
952908500d5f99f35afc5ed510391b9bdc3833farbb char *ap_auth_type;
2d2eda71267231c2526be701fe655db125852c1ffielding
2d2eda71267231c2526be701fe655db125852c1ffielding /* What object is being requested (either directly, or via include
2d2eda71267231c2526be701fe655db125852c1ffielding * or content-negotiation mapping).
2d2eda71267231c2526be701fe655db125852c1ffielding */
2d2eda71267231c2526be701fe655db125852c1ffielding
e57fd661645dcfdf166e77484b509b248e62a19eaaron /** The URI without any parsing performed */
742318b93e89c311f66b55f426c4d9cf2c14628bjim char *unparsed_uri;
f8033d657a57eab45af44368774d8beb3e4f7f35pquerna /** The path portion of the URI, or "/" if no path provided */
952908500d5f99f35afc5ed510391b9bdc3833farbb char *uri;
e57fd661645dcfdf166e77484b509b248e62a19eaaron /** The filename on disk corresponding to this response */
2d2eda71267231c2526be701fe655db125852c1ffielding char *filename;
c5194fa21b13b4bb6d2a8fa07d499bafd48d580cwrowe /** The true filename stored in the filesystem, as in the true alpha case
c5194fa21b13b4bb6d2a8fa07d499bafd48d580cwrowe * and alias correction, e.g. "Image.jpeg" not "IMAGE$1.JPE" on Windows.
c5194fa21b13b4bb6d2a8fa07d499bafd48d580cwrowe * The core map_to_storage canonicalizes r->filename when they mismatch */
a18775c154178d6c07aed84bd54ac16f59f89bc9wrowe char *canonical_filename;
e57fd661645dcfdf166e77484b509b248e62a19eaaron /** The PATH_INFO extracted from this request */
2d2eda71267231c2526be701fe655db125852c1ffielding char *path_info;
e57fd661645dcfdf166e77484b509b248e62a19eaaron /** The QUERY_ARGS extracted from this request */
742318b93e89c311f66b55f426c4d9cf2c14628bjim char *args;
2d2eda71267231c2526be701fe655db125852c1ffielding
e57fd661645dcfdf166e77484b509b248e62a19eaaron /**
742318b93e89c311f66b55f426c4d9cf2c14628bjim * Flag for the handler to accept or reject path_info on
e57fd661645dcfdf166e77484b509b248e62a19eaaron * the current request. All modules should respect the
742318b93e89c311f66b55f426c4d9cf2c14628bjim * AP_REQ_ACCEPT_PATH_INFO and AP_REQ_REJECT_PATH_INFO
e57fd661645dcfdf166e77484b509b248e62a19eaaron * values, while AP_REQ_DEFAULT_PATH_INFO indicates they
e57fd661645dcfdf166e77484b509b248e62a19eaaron * may follow existing conventions. This is set to the
e57fd661645dcfdf166e77484b509b248e62a19eaaron * user's preference upon HOOK_VERY_FIRST of the fixups.
cd9eb79cfbf9bc730ccacc3a3774b1fe1b99ed53wrowe */
97ff7bf3f33a3527953d975df5cbf82a5a7dc9a6wrowe int used_path_info;
97ff7bf3f33a3527953d975df5cbf82a5a7dc9a6wrowe
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** A flag to determine if the eos bucket has been sent yet */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf int eos_sent;
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf
2d2eda71267231c2526be701fe655db125852c1ffielding /* Various other config info which may change with .htaccess files
2d2eda71267231c2526be701fe655db125852c1ffielding * These are config vectors, with one void* pointer for each module
2d2eda71267231c2526be701fe655db125852c1ffielding * (the thing pointed to being the module's business).
2d2eda71267231c2526be701fe655db125852c1ffielding */
2d2eda71267231c2526be701fe655db125852c1ffielding
952908500d5f99f35afc5ed510391b9bdc3833farbb /** Options set in config files, etc. */
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgstein struct ap_conf_vector_t *per_dir_config;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** Notes on *this* request */
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgstein struct ap_conf_vector_t *request_config;
2d2eda71267231c2526be701fe655db125852c1ffielding
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** Optional request log level configuration. Will usually point
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf * to a server or per_dir config, i.e. must be copied before
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf * modifying */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf const struct ap_logconf *log;
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf
e302f38fd646764ce1a1e1c578d794aef514a9e5sf /** Id to identify request in access and error log. Set when the first
e302f38fd646764ce1a1e1c578d794aef514a9e5sf * error log entry for this request is generated.
e302f38fd646764ce1a1e1c578d794aef514a9e5sf */
e302f38fd646764ce1a1e1c578d794aef514a9e5sf const char *log_id;
e302f38fd646764ce1a1e1c578d794aef514a9e5sf
e57fd661645dcfdf166e77484b509b248e62a19eaaron /**
e57fd661645dcfdf166e77484b509b248e62a19eaaron * A linked list of the .htaccess configuration directives
e57fd661645dcfdf166e77484b509b248e62a19eaaron * accessed by this request.
e57fd661645dcfdf166e77484b509b248e62a19eaaron * N.B. always add to the head of the list, _never_ to the end.
e57fd661645dcfdf166e77484b509b248e62a19eaaron * that way, a sub request's list can (temporarily) point to a parent's list
e57fd661645dcfdf166e77484b509b248e62a19eaaron */
2d2eda71267231c2526be701fe655db125852c1ffielding const struct htaccess_result *htaccess;
2d2eda71267231c2526be701fe655db125852c1ffielding
9f9307bbe539dbcf96919715315eb64ce3465f5bben /** A list of output filters to be used for this request */
a93bda3b944fb92e3850db5621b5a27fc0e44509wrowe struct ap_filter_t *output_filters;
9f9307bbe539dbcf96919715315eb64ce3465f5bben /** A list of input filters to be used for this request */
a93bda3b944fb92e3850db5621b5a27fc0e44509wrowe struct ap_filter_t *input_filters;
e57e920838f31508f1418aa4c25ce55b345b2cebrbb
e57e920838f31508f1418aa4c25ce55b345b2cebrbb /** A list of protocol level output filters to be used for this
e57e920838f31508f1418aa4c25ce55b345b2cebrbb * request */
a93bda3b944fb92e3850db5621b5a27fc0e44509wrowe struct ap_filter_t *proto_output_filters;
e57e920838f31508f1418aa4c25ce55b345b2cebrbb /** A list of protocol level input filters to be used for this
e57e920838f31508f1418aa4c25ce55b345b2cebrbb * request */
a93bda3b944fb92e3850db5621b5a27fc0e44509wrowe struct ap_filter_t *proto_input_filters;
e57e920838f31508f1418aa4c25ce55b345b2cebrbb
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** This response can not be cached */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf int no_cache;
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** There is no local copy of this response */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf int no_local_copy;
439ccf2a084e1da566548931c585cbcc3a9e7f4cminfrin
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** Mutex protect callbacks registered with ap_mpm_register_timed_callback
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf * from being run before the original handler finishes running
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf */
d74193443739fe54239912eb7b15fe252ee19ab1covener#if APR_HAS_THREADS
b0d8a6d437db6f4c222173f27ef81c98622fbd02pquerna apr_thread_mutex_t *invoke_mtx;
d74193443739fe54239912eb7b15fe252ee19ab1covener#endif
b0d8a6d437db6f4c222173f27ef81c98622fbd02pquerna
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** A struct containing the components of URI */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf apr_uri_t parsed_uri;
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** finfo.protection (st_mode) set to zero if no such file */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf apr_finfo_t finfo;
49fd87ed00b95bdd7a4cfc874e5c5fe4a04faf5aminfrin
49fd87ed00b95bdd7a4cfc874e5c5fe4a04faf5aminfrin /** remote address information from conn_rec, can be overridden if
49fd87ed00b95bdd7a4cfc874e5c5fe4a04faf5aminfrin * necessary by a module.
6a26fafa58a4654d7ec647a14acb18fa1fecf8f6sf * This is the address that originated the request.
49fd87ed00b95bdd7a4cfc874e5c5fe4a04faf5aminfrin */
a221184be5b40f8349982d94cda02b98068ce0d8minfrin apr_sockaddr_t *useragent_addr;
a221184be5b40f8349982d94cda02b98068ce0d8minfrin char *useragent_ip;
8491e0600f69b0405e156ea8a419653c065c645bcovener
8491e0600f69b0405e156ea8a419653c065c645bcovener /** MIME trailer environment from the request */
8491e0600f69b0405e156ea8a419653c065c645bcovener apr_table_t *trailers_in;
8491e0600f69b0405e156ea8a419653c065c645bcovener /** MIME trailer environment from the response */
8491e0600f69b0405e156ea8a419653c065c645bcovener apr_table_t *trailers_out;
2d2eda71267231c2526be701fe655db125852c1ffielding};
2d2eda71267231c2526be701fe655db125852c1ffielding
9f9307bbe539dbcf96919715315eb64ce3465f5bben/**
9f9307bbe539dbcf96919715315eb64ce3465f5bben * @defgroup ProxyReq Proxy request types
9f9307bbe539dbcf96919715315eb64ce3465f5bben *
9f9307bbe539dbcf96919715315eb64ce3465f5bben * Possible values of request_rec->proxyreq. A request could be normal,
853a0c44563b056e40e9cffe911190f554e63ec3chuck * proxied or reverse proxied. Normally proxied and reverse proxied are
853a0c44563b056e40e9cffe911190f554e63ec3chuck * grouped together as just "proxied", but sometimes it's necessary to
853a0c44563b056e40e9cffe911190f554e63ec3chuck * tell the difference between the two, such as for authentication.
9f9307bbe539dbcf96919715315eb64ce3465f5bben * @{
853a0c44563b056e40e9cffe911190f554e63ec3chuck */
853a0c44563b056e40e9cffe911190f554e63ec3chuck
11e076839c8d5a82d55e710194d0daac51390dbdsf#define PROXYREQ_NONE 0 /**< No proxy */
11e076839c8d5a82d55e710194d0daac51390dbdsf#define PROXYREQ_PROXY 1 /**< Standard proxy */
11e076839c8d5a82d55e710194d0daac51390dbdsf#define PROXYREQ_REVERSE 2 /**< Reverse proxy */
11e076839c8d5a82d55e710194d0daac51390dbdsf#define PROXYREQ_RESPONSE 3 /**< Origin response */
9f9307bbe539dbcf96919715315eb64ce3465f5bben
9f9307bbe539dbcf96919715315eb64ce3465f5bben/* @} */
853a0c44563b056e40e9cffe911190f554e63ec3chuck
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/**
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @brief Enumeration of connection keepalive options
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh */
f9a773d26994c3b267589e404cdb5b760f83e888jerenkrantztypedef enum {
f9a773d26994c3b267589e404cdb5b760f83e888jerenkrantz AP_CONN_UNKNOWN,
f9a773d26994c3b267589e404cdb5b760f83e888jerenkrantz AP_CONN_CLOSE,
f9a773d26994c3b267589e404cdb5b760f83e888jerenkrantz AP_CONN_KEEPALIVE
f9a773d26994c3b267589e404cdb5b760f83e888jerenkrantz} ap_conn_keepalive_e;
2d2eda71267231c2526be701fe655db125852c1ffielding
742318b93e89c311f66b55f426c4d9cf2c14628bjim/**
742318b93e89c311f66b55f426c4d9cf2c14628bjim * @brief Structure to store things which are per connection
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh */
2d2eda71267231c2526be701fe655db125852c1ffieldingstruct conn_rec {
952908500d5f99f35afc5ed510391b9bdc3833farbb /** Pool associated with this connection */
1ccd992d37d62c8cb2056126f2234f64ec189bfddougm apr_pool_t *pool;
be8a31a0afdb2363dbcc98bbbaa94b6184061b5fdreid /** Physical vhost this conn came in on */
952908500d5f99f35afc5ed510391b9bdc3833farbb server_rec *base_server;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** used by http_vhost.c */
952908500d5f99f35afc5ed510391b9bdc3833farbb void *vhost_lookup_data;
2d2eda71267231c2526be701fe655db125852c1ffielding
2d2eda71267231c2526be701fe655db125852c1ffielding /* Information about the connection itself */
952908500d5f99f35afc5ed510391b9bdc3833farbb /** local address */
91644a5f4d3e992dc208304b50e80bbb236fca89trawick apr_sockaddr_t *local_addr;
6a26fafa58a4654d7ec647a14acb18fa1fecf8f6sf /** remote address; this is the end-point of the next hop, for the address
6a26fafa58a4654d7ec647a14acb18fa1fecf8f6sf * of the request creator, see useragent_addr in request_rec
6a26fafa58a4654d7ec647a14acb18fa1fecf8f6sf */
c41be3600a58bd39a76d1215abcdbbd8e9b1c356minfrin apr_sockaddr_t *client_addr;
e6cc28a5eb3371ba0c38e941855e71ff0054f50erbb
6a26fafa58a4654d7ec647a14acb18fa1fecf8f6sf /** Client's IP address; this is the end-point of the next hop, for the
6a26fafa58a4654d7ec647a14acb18fa1fecf8f6sf * IP of the request creator, see useragent_ip in request_rec
6a26fafa58a4654d7ec647a14acb18fa1fecf8f6sf */
c41be3600a58bd39a76d1215abcdbbd8e9b1c356minfrin char *client_ip;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** Client's DNS name, if known. NULL if DNS hasn't been checked,
952908500d5f99f35afc5ed510391b9bdc3833farbb * "" if it has and no address was found. N.B. Only access this though
952908500d5f99f35afc5ed510391b9bdc3833farbb * get_remote_host() */
952908500d5f99f35afc5ed510391b9bdc3833farbb char *remote_host;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** Only ever set if doing rfc1413 lookups. N.B. Only access this through
952908500d5f99f35afc5ed510391b9bdc3833farbb * get_remote_logname() */
952908500d5f99f35afc5ed510391b9bdc3833farbb char *remote_logname;
952908500d5f99f35afc5ed510391b9bdc3833farbb
952908500d5f99f35afc5ed510391b9bdc3833farbb /** server IP address */
952908500d5f99f35afc5ed510391b9bdc3833farbb char *local_ip;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** used for ap_get_server_name when UseCanonicalName is set to DNS
952908500d5f99f35afc5ed510391b9bdc3833farbb * (ignores setting of HostnameLookups) */
952908500d5f99f35afc5ed510391b9bdc3833farbb char *local_host;
952908500d5f99f35afc5ed510391b9bdc3833farbb
952908500d5f99f35afc5ed510391b9bdc3833farbb /** ID of this connection; unique at any point in time */
742318b93e89c311f66b55f426c4d9cf2c14628bjim long id;
eb0fa8f996539c1cd5e5edf34f46e7e9c199641estas /** Config vector containing pointers to connections per-server
eb0fa8f996539c1cd5e5edf34f46e7e9c199641estas * config structures. */
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgstein struct ap_conf_vector_t *conn_config;
eb0fa8f996539c1cd5e5edf34f46e7e9c199641estas /** Notes on *this* connection: send note from one module to
eb0fa8f996539c1cd5e5edf34f46e7e9c199641estas * another. must remain valid for all requests on this conn */
952908500d5f99f35afc5ed510391b9bdc3833farbb apr_table_t *notes;
9f9307bbe539dbcf96919715315eb64ce3465f5bben /** A list of input filters to be used for this connection */
a93bda3b944fb92e3850db5621b5a27fc0e44509wrowe struct ap_filter_t *input_filters;
9f9307bbe539dbcf96919715315eb64ce3465f5bben /** A list of output filters to be used for this connection */
a93bda3b944fb92e3850db5621b5a27fc0e44509wrowe struct ap_filter_t *output_filters;
ca47a2b6bcea23e8af185c68f256dcbbfd2a0f9dtrawick /** handle to scoreboard information for this connection */
ca47a2b6bcea23e8af185c68f256dcbbfd2a0f9dtrawick void *sbh;
2fc50921b88defeb7127985dfe4b4130175e069ejwoolley /** The bucket allocator to use for all bucket/brigade creations */
2fc50921b88defeb7127985dfe4b4130175e069ejwoolley struct apr_bucket_alloc_t *bucket_alloc;
1250054c500b75b81ccbff16a52a01145650f1e6sf /** The current state of this connection; may be NULL if not used by MPM */
d9039a9aaeaa1359c1147af66c09aeac56ae3ee0pquerna conn_state_t *cs;
742318b93e89c311f66b55f426c4d9cf2c14628bjim /** Is there data pending in the input filters? */
d9039a9aaeaa1359c1147af66c09aeac56ae3ee0pquerna int data_in_input_filters;
2f1bb5376c5c4022383bb729679ca751dd75a2eabrianp /** Is there data pending in the output filters? */
2f1bb5376c5c4022383bb729679ca751dd75a2eabrianp int data_in_output_filters;
ddc593aa9ac8b227d1fd9677a3a2b24539b5d608pquerna
135402675e89e6df0e17735e48f428a1e1d8eb16pquerna /** Are there any filters that clogg/buffer the input stream, breaking
135402675e89e6df0e17735e48f428a1e1d8eb16pquerna * the event mpm.
135402675e89e6df0e17735e48f428a1e1d8eb16pquerna */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf unsigned int clogging_input_filters:1;
742318b93e89c311f66b55f426c4d9cf2c14628bjim
742318b93e89c311f66b55f426c4d9cf2c14628bjim /** have we done double-reverse DNS? -1 yes/failure, 0 not yet,
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf * 1 yes/success */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf signed int double_reverse:2;
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** Are we still talking? */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf unsigned aborted;
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** Are we going to keep the connection alive for another request?
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf * @see ap_conn_keepalive_e */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf ap_conn_keepalive_e keepalive;
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** How many times have we used it? */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf int keepalives;
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf
efd83d1dd1a25688a3093c5a542ae16bacef62ddsf /** Optional connection log level configuration. May point to a server or
efd83d1dd1a25688a3093c5a542ae16bacef62ddsf * per_dir config, i.e. must be copied before modifying */
efd83d1dd1a25688a3093c5a542ae16bacef62ddsf const struct ap_logconf *log;
efd83d1dd1a25688a3093c5a542ae16bacef62ddsf
e302f38fd646764ce1a1e1c578d794aef514a9e5sf /** Id to identify this connection in error log. Set when the first
e302f38fd646764ce1a1e1c578d794aef514a9e5sf * error log entry for this connection is generated.
e302f38fd646764ce1a1e1c578d794aef514a9e5sf */
e302f38fd646764ce1a1e1c578d794aef514a9e5sf const char *log_id;
e302f38fd646764ce1a1e1c578d794aef514a9e5sf
e302f38fd646764ce1a1e1c578d794aef514a9e5sf
cdccf2ac94172d1a4a54bc2e17324e1ef682ccf3pquerna /** This points to the current thread being used to process this request,
cdccf2ac94172d1a4a54bc2e17324e1ef682ccf3pquerna * over the lifetime of a request, the value may change. Users of the connection
24a375e018954538cd72b541d7271b14ce8e1c01trawick * record should not rely upon it staying the same between calls that involve
cdccf2ac94172d1a4a54bc2e17324e1ef682ccf3pquerna * the MPM.
cdccf2ac94172d1a4a54bc2e17324e1ef682ccf3pquerna */
cdccf2ac94172d1a4a54bc2e17324e1ef682ccf3pquerna#if APR_HAS_THREADS
cdccf2ac94172d1a4a54bc2e17324e1ef682ccf3pquerna apr_thread_t *current_thread;
cdccf2ac94172d1a4a54bc2e17324e1ef682ccf3pquerna#endif
943016cae7a40f689cc0b65fd8cf8d4250a21352jim
943016cae7a40f689cc0b65fd8cf8d4250a21352jim /** Array of slave connections (conn_slave_rec *) for this connection. */
943016cae7a40f689cc0b65fd8cf8d4250a21352jim apr_array_header_t *slaves;
943016cae7a40f689cc0b65fd8cf8d4250a21352jim
943016cae7a40f689cc0b65fd8cf8d4250a21352jim /** The "real" master connection. NULL if I am the master. */
943016cae7a40f689cc0b65fd8cf8d4250a21352jim conn_rec *master;
943016cae7a40f689cc0b65fd8cf8d4250a21352jim
943016cae7a40f689cc0b65fd8cf8d4250a21352jim /** context of this connection */
943016cae7a40f689cc0b65fd8cf8d4250a21352jim void *ctx;
06b8f183140c8e02e0974e938a05078b511d1603covener
06b8f183140c8e02e0974e938a05078b511d1603covener /** Context under which this connection was suspended */
06b8f183140c8e02e0974e938a05078b511d1603covener void *suspended_baton;
943016cae7a40f689cc0b65fd8cf8d4250a21352jim};
943016cae7a40f689cc0b65fd8cf8d4250a21352jim
943016cae7a40f689cc0b65fd8cf8d4250a21352jimstruct conn_slave_rec {
943016cae7a40f689cc0b65fd8cf8d4250a21352jim conn_rec *c;
d9039a9aaeaa1359c1147af66c09aeac56ae3ee0pquerna};
d9039a9aaeaa1359c1147af66c09aeac56ae3ee0pquerna
742318b93e89c311f66b55f426c4d9cf2c14628bjim/**
742318b93e89c311f66b55f426c4d9cf2c14628bjim * Enumeration of connection states
ca61ccd0c306c2c72df153688ba1b49f3eceed80sf * The two states CONN_STATE_LINGER_NORMAL and CONN_STATE_LINGER_SHORT may
ca61ccd0c306c2c72df153688ba1b49f3eceed80sf * only be set by the MPM. Use CONN_STATE_LINGER outside of the MPM.
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh */
d9039a9aaeaa1359c1147af66c09aeac56ae3ee0pquernatypedef enum {
d9039a9aaeaa1359c1147af66c09aeac56ae3ee0pquerna CONN_STATE_CHECK_REQUEST_LINE_READABLE,
d9039a9aaeaa1359c1147af66c09aeac56ae3ee0pquerna CONN_STATE_READ_REQUEST_LINE,
ad862ab5716726a2d72a292ba1dfb29566c86153brianp CONN_STATE_HANDLER,
ad862ab5716726a2d72a292ba1dfb29566c86153brianp CONN_STATE_WRITE_COMPLETION,
b0d8a6d437db6f4c222173f27ef81c98622fbd02pquerna CONN_STATE_SUSPENDED,
ca61ccd0c306c2c72df153688ba1b49f3eceed80sf CONN_STATE_LINGER, /* connection may be closed with lingering */
ca61ccd0c306c2c72df153688ba1b49f3eceed80sf CONN_STATE_LINGER_NORMAL, /* MPM has started lingering close with normal timeout */
ca61ccd0c306c2c72df153688ba1b49f3eceed80sf CONN_STATE_LINGER_SHORT /* MPM has started lingering close with short timeout */
d9039a9aaeaa1359c1147af66c09aeac56ae3ee0pquerna} conn_state_e;
d9039a9aaeaa1359c1147af66c09aeac56ae3ee0pquerna
2c487ac43b583db869e743772a7a10b278aa2bcfminfrintypedef enum {
2c487ac43b583db869e743772a7a10b278aa2bcfminfrin CONN_SENSE_DEFAULT,
2c487ac43b583db869e743772a7a10b278aa2bcfminfrin CONN_SENSE_WANT_READ, /* next event must be read */
2c487ac43b583db869e743772a7a10b278aa2bcfminfrin CONN_SENSE_WANT_WRITE /* next event must be write */
2c487ac43b583db869e743772a7a10b278aa2bcfminfrin} conn_sense_e;
2c487ac43b583db869e743772a7a10b278aa2bcfminfrin
742318b93e89c311f66b55f426c4d9cf2c14628bjim/**
742318b93e89c311f66b55f426c4d9cf2c14628bjim * @brief A structure to contain connection state information
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh */
d9039a9aaeaa1359c1147af66c09aeac56ae3ee0pquernastruct conn_state_t {
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** Current state of the connection */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf conn_state_e state;
2c487ac43b583db869e743772a7a10b278aa2bcfminfrin /** Whether to read instead of write, or write instead of read */
2c487ac43b583db869e743772a7a10b278aa2bcfminfrin conn_sense_e sense;
2d2eda71267231c2526be701fe655db125852c1ffielding};
2d2eda71267231c2526be701fe655db125852c1ffielding
2d2eda71267231c2526be701fe655db125852c1ffielding/* Per-vhost config... */
2d2eda71267231c2526be701fe655db125852c1ffielding
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/**
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh * The address 255.255.255.255, when used as a virtualhost address,
2d2eda71267231c2526be701fe655db125852c1ffielding * will become the "default" server when the ip doesn't match other vhosts.
2d2eda71267231c2526be701fe655db125852c1ffielding */
2d2eda71267231c2526be701fe655db125852c1ffielding#define DEFAULT_VHOST_ADDR 0xfffffffful
2d2eda71267231c2526be701fe655db125852c1ffielding
952908500d5f99f35afc5ed510391b9bdc3833farbb
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/**
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @struct server_addr_rec
742318b93e89c311f66b55f426c4d9cf2c14628bjim * @brief A structure to be used for Per-vhost config
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh */
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianhtypedef struct server_addr_rec server_addr_rec;
2d2eda71267231c2526be701fe655db125852c1ffieldingstruct server_addr_rec {
169f62b04de69074b561b4e6dcf6f82572a5e367trawick /** The next server in the list */
2d2eda71267231c2526be701fe655db125852c1ffielding server_addr_rec *next;
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** The name given in "<VirtualHost>" */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf char *virthost;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** The bound address, for this server */
8a261a9f7d18d1e862d63f68e93f288d3e1f0d94trawick apr_sockaddr_t *host_addr;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** The bound port, for this server */
dad234382d8424e1c5a30af2838e172aec9d6d1bdreid apr_port_t host_port;
2d2eda71267231c2526be701fe655db125852c1ffielding};
2d2eda71267231c2526be701fe655db125852c1ffielding
efd83d1dd1a25688a3093c5a542ae16bacef62ddsfstruct ap_logconf {
efd83d1dd1a25688a3093c5a542ae16bacef62ddsf /** The per-module log levels */
e6a8e6527b3b61ab3d4413799e6ef91d4695f3a0sf signed char *module_levels;
efd83d1dd1a25688a3093c5a542ae16bacef62ddsf
efd83d1dd1a25688a3093c5a542ae16bacef62ddsf /** The log level for this server */
efd83d1dd1a25688a3093c5a542ae16bacef62ddsf int level;
efd83d1dd1a25688a3093c5a542ae16bacef62ddsf};
742318b93e89c311f66b55f426c4d9cf2c14628bjim/**
742318b93e89c311f66b55f426c4d9cf2c14628bjim * @brief A structure to store information for each virtual server
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh */
2d2eda71267231c2526be701fe655db125852c1ffieldingstruct server_rec {
952908500d5f99f35afc5ed510391b9bdc3833farbb /** The process this server is running in */
3887202241db08986e94b252fbd06a55e55d4b2dbhyde process_rec *process;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** The next server in the list */
2d2eda71267231c2526be701fe655db125852c1ffielding server_rec *next;
2d2eda71267231c2526be701fe655db125852c1ffielding
2d2eda71267231c2526be701fe655db125852c1ffielding /* Log files --- note that transfer log is now in the modules... */
2d2eda71267231c2526be701fe655db125852c1ffielding
952908500d5f99f35afc5ed510391b9bdc3833farbb /** The name of the error log */
2d2eda71267231c2526be701fe655db125852c1ffielding char *error_fname;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** A file descriptor that references the error log */
1ccd992d37d62c8cb2056126f2234f64ec189bfddougm apr_file_t *error_log;
efd83d1dd1a25688a3093c5a542ae16bacef62ddsf /** The log level configuration */
efd83d1dd1a25688a3093c5a542ae16bacef62ddsf struct ap_logconf log;
56589be3d7a3e9343370df240010c6928cc78b39jkaluza /** External error log writer provider */
56589be3d7a3e9343370df240010c6928cc78b39jkaluza struct ap_errorlog_provider *errorlog_provider;
56589be3d7a3e9343370df240010c6928cc78b39jkaluza /** Handle to be passed to external log provider's logging method */
56589be3d7a3e9343370df240010c6928cc78b39jkaluza void *errorlog_provider_handle;
2d2eda71267231c2526be701fe655db125852c1ffielding
2d2eda71267231c2526be701fe655db125852c1ffielding /* Module-specific configuration for server, and defaults... */
2d2eda71267231c2526be701fe655db125852c1ffielding
742318b93e89c311f66b55f426c4d9cf2c14628bjim /** Config vector containing pointers to modules' per-server config
952908500d5f99f35afc5ed510391b9bdc3833farbb * structures. */
742318b93e89c311f66b55f426c4d9cf2c14628bjim struct ap_conf_vector_t *module_config;
169f62b04de69074b561b4e6dcf6f82572a5e367trawick /** MIME type info, etc., before we start checking per-directory info */
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgstein struct ap_conf_vector_t *lookup_defaults;
952908500d5f99f35afc5ed510391b9bdc3833farbb
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** The name of the server */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf const char *defn_name;
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** The line of the config file that the server was defined on */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf unsigned defn_line_number;
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** true if this is the virtual server */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf char is_virtual;
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /* Information for redirects */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** for redirects, etc. */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf apr_port_t port;
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** The server request scheme for redirect responses */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf const char *server_scheme;
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /* Contact information */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** The admin's contact information */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf char *server_admin;
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** The server hostname */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf char *server_hostname;
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf
2d2eda71267231c2526be701fe655db125852c1ffielding /* Transaction handling */
2d2eda71267231c2526be701fe655db125852c1ffielding
952908500d5f99f35afc5ed510391b9bdc3833farbb /** I haven't got a clue */
2d2eda71267231c2526be701fe655db125852c1ffielding server_addr_rec *addrs;
fa861fc5a880d2c3a5ecc0ec71fa7da556adf5c1wrowe /** Timeout, as an apr interval, before we give up */
fa861fc5a880d2c3a5ecc0ec71fa7da556adf5c1wrowe apr_interval_time_t timeout;
fa861fc5a880d2c3a5ecc0ec71fa7da556adf5c1wrowe /** The apr interval we will wait for another request */
fa861fc5a880d2c3a5ecc0ec71fa7da556adf5c1wrowe apr_interval_time_t keep_alive_timeout;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** Maximum requests per connection */
952908500d5f99f35afc5ed510391b9bdc3833farbb int keep_alive_max;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** Use persistent connections? */
952908500d5f99f35afc5ed510391b9bdc3833farbb int keep_alive;
952908500d5f99f35afc5ed510391b9bdc3833farbb
952908500d5f99f35afc5ed510391b9bdc3833farbb /** Normal names for ServerAlias servers */
952908500d5f99f35afc5ed510391b9bdc3833farbb apr_array_header_t *names;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** Wildcarded names for ServerAlias servers */
952908500d5f99f35afc5ed510391b9bdc3833farbb apr_array_header_t *wild_names;
952908500d5f99f35afc5ed510391b9bdc3833farbb
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** Pathname for ServerPath */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf const char *path;
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf /** Length of path */
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf int pathlen;
78b8e4dd910f03af0a602bc4b63ad7bc69868ee3sf
952908500d5f99f35afc5ed510391b9bdc3833farbb /** limit on size of the HTTP request line */
952908500d5f99f35afc5ed510391b9bdc3833farbb int limit_req_line;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** limit on size of any request header field */
952908500d5f99f35afc5ed510391b9bdc3833farbb int limit_req_fieldsize;
952908500d5f99f35afc5ed510391b9bdc3833farbb /** limit on number of request header fields */
742318b93e89c311f66b55f426c4d9cf2c14628bjim int limit_req_fields;
60262a02cfeba50d60d990b56d0e0c1d1fafb672sctemme
40965c37b2fd320093215de6c3fbd516382077eajim /** Opaque storage location */
40965c37b2fd320093215de6c3fbd516382077eajim void *context;
78ae177952e97903c19115e0f1b0383a5ca22eb4ylavic
823eced0537b42181f3ddf6533a899d2251325e7ylavic /** Whether the keepalive timeout is explicit (1) or
823eced0537b42181f3ddf6533a899d2251325e7ylavic * inherited (0) from the base server (either first
823eced0537b42181f3ddf6533a899d2251325e7ylavic * server on the same IP:port or main server) */
78ae177952e97903c19115e0f1b0383a5ca22eb4ylavic unsigned int keep_alive_timeout_set:1;
2d2eda71267231c2526be701fe655db125852c1ffielding};
2d2eda71267231c2526be701fe655db125852c1ffielding
89da6eb70c41422a20e5f871dbf5950140d128abjim/**
83df3fbb3f37cf5337c8793b4559392a672e0696jim * @struct ap_sload_t
83df3fbb3f37cf5337c8793b4559392a672e0696jim * @brief A structure to hold server load params
89da6eb70c41422a20e5f871dbf5950140d128abjim */
89da6eb70c41422a20e5f871dbf5950140d128abjimtypedef struct ap_sload_t ap_sload_t;
89da6eb70c41422a20e5f871dbf5950140d128abjimstruct ap_sload_t {
83df3fbb3f37cf5337c8793b4559392a672e0696jim /* percentage of process/threads ready/idle (0->100)*/
83df3fbb3f37cf5337c8793b4559392a672e0696jim int idle;
83df3fbb3f37cf5337c8793b4559392a672e0696jim /* percentage of process/threads busy (0->100) */
83df3fbb3f37cf5337c8793b4559392a672e0696jim int busy;
784d6c0670369b9166239b046fec2a5bfa90a390jorton /* total bytes served */
784d6c0670369b9166239b046fec2a5bfa90a390jorton apr_off_t bytes_served;
784d6c0670369b9166239b046fec2a5bfa90a390jorton /* total access count */
784d6c0670369b9166239b046fec2a5bfa90a390jorton unsigned long access_count;
83df3fbb3f37cf5337c8793b4559392a672e0696jim};
83df3fbb3f37cf5337c8793b4559392a672e0696jim
83df3fbb3f37cf5337c8793b4559392a672e0696jim/**
83df3fbb3f37cf5337c8793b4559392a672e0696jim * @struct ap_loadavg_t
83df3fbb3f37cf5337c8793b4559392a672e0696jim * @brief A structure to hold various server loadavg
83df3fbb3f37cf5337c8793b4559392a672e0696jim */
83df3fbb3f37cf5337c8793b4559392a672e0696jimtypedef struct ap_loadavg_t ap_loadavg_t;
83df3fbb3f37cf5337c8793b4559392a672e0696jimstruct ap_loadavg_t {
55d39664d566ef2fe0c97dab0ec4d91416cf7541jim /* current loadavg, ala getloadavg() */
55d39664d566ef2fe0c97dab0ec4d91416cf7541jim float loadavg;
89da6eb70c41422a20e5f871dbf5950140d128abjim /* 5 min loadavg */
89da6eb70c41422a20e5f871dbf5950140d128abjim float loadavg5;
89da6eb70c41422a20e5f871dbf5950140d128abjim /* 15 min loadavg */
89da6eb70c41422a20e5f871dbf5950140d128abjim float loadavg15;
89da6eb70c41422a20e5f871dbf5950140d128abjim};
89da6eb70c41422a20e5f871dbf5950140d128abjim
33510984c759eb3da154ceb0db9b75fa0031d3b4sf/**
33510984c759eb3da154ceb0db9b75fa0031d3b4sf * Get the context_document_root for a request. This is a generalization of
33510984c759eb3da154ceb0db9b75fa0031d3b4sf * the document root, which is too limited in the presence of mappers like
33510984c759eb3da154ceb0db9b75fa0031d3b4sf * mod_userdir and mod_alias. The context_document_root is the directory
33510984c759eb3da154ceb0db9b75fa0031d3b4sf * on disk that maps to the context_prefix URI prefix.
33510984c759eb3da154ceb0db9b75fa0031d3b4sf * @param r The request
33510984c759eb3da154ceb0db9b75fa0031d3b4sf * @note For resources that do not map to the file system or for very complex
33510984c759eb3da154ceb0db9b75fa0031d3b4sf * mappings, this information may still be wrong.
33510984c759eb3da154ceb0db9b75fa0031d3b4sf */
33510984c759eb3da154ceb0db9b75fa0031d3b4sfAP_DECLARE(const char *) ap_context_document_root(request_rec *r);
33510984c759eb3da154ceb0db9b75fa0031d3b4sf
33510984c759eb3da154ceb0db9b75fa0031d3b4sf/**
33510984c759eb3da154ceb0db9b75fa0031d3b4sf * Get the context_prefix for a request. The context_prefix URI prefix
33510984c759eb3da154ceb0db9b75fa0031d3b4sf * maps to the context_document_root on disk.
33510984c759eb3da154ceb0db9b75fa0031d3b4sf * @param r The request
33510984c759eb3da154ceb0db9b75fa0031d3b4sf */
33510984c759eb3da154ceb0db9b75fa0031d3b4sfAP_DECLARE(const char *) ap_context_prefix(request_rec *r);
33510984c759eb3da154ceb0db9b75fa0031d3b4sf
33510984c759eb3da154ceb0db9b75fa0031d3b4sf/** Set context_prefix and context_document_root for a request.
33510984c759eb3da154ceb0db9b75fa0031d3b4sf * @param r The request
33510984c759eb3da154ceb0db9b75fa0031d3b4sf * @param prefix the URI prefix, without trailing slash
33510984c759eb3da154ceb0db9b75fa0031d3b4sf * @param document_root the corresponding directory on disk, without trailing
33510984c759eb3da154ceb0db9b75fa0031d3b4sf * slash
33510984c759eb3da154ceb0db9b75fa0031d3b4sf * @note If one of prefix of document_root is NULL, the corrsponding
33510984c759eb3da154ceb0db9b75fa0031d3b4sf * property will not be changed.
33510984c759eb3da154ceb0db9b75fa0031d3b4sf */
33510984c759eb3da154ceb0db9b75fa0031d3b4sfAP_DECLARE(void) ap_set_context_info(request_rec *r, const char *prefix,
33510984c759eb3da154ceb0db9b75fa0031d3b4sf const char *document_root);
33510984c759eb3da154ceb0db9b75fa0031d3b4sf
33510984c759eb3da154ceb0db9b75fa0031d3b4sf/** Set per-request document root. This is for mass virtual hosting modules
33510984c759eb3da154ceb0db9b75fa0031d3b4sf * that want to provide the correct DOCUMENT_ROOT value to scripts.
33510984c759eb3da154ceb0db9b75fa0031d3b4sf * @param r The request
33510984c759eb3da154ceb0db9b75fa0031d3b4sf * @param document_root the document root for the request.
33510984c759eb3da154ceb0db9b75fa0031d3b4sf */
33510984c759eb3da154ceb0db9b75fa0031d3b4sfAP_DECLARE(void) ap_set_document_root(request_rec *r, const char *document_root);
33510984c759eb3da154ceb0db9b75fa0031d3b4sf
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
952908500d5f99f35afc5ed510391b9bdc3833farbb * Examine a field value (such as a media-/content-type) string and return
952908500d5f99f35afc5ed510391b9bdc3833farbb * it sans any parameters; e.g., strip off any ';charset=foo' and the like.
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param p Pool to allocate memory from
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param intype The field to examine
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @return A copy of the field minus any parameters
952908500d5f99f35afc5ed510391b9bdc3833farbb */
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(char *) ap_field_noparam(apr_pool_t *p, const char *intype);
952908500d5f99f35afc5ed510391b9bdc3833farbb
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
952908500d5f99f35afc5ed510391b9bdc3833farbb * Convert a time from an integer into a string in a specified format
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param p The pool to allocate memory from
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param t The time to convert
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param fmt The format to use for the conversion
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param gmt Convert the time for GMT?
952908500d5f99f35afc5ed510391b9bdc3833farbb * @return The string that represents the specified time
952908500d5f99f35afc5ed510391b9bdc3833farbb */
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(char *) ap_ht_time(apr_pool_t *p, apr_time_t t, const char *fmt, int gmt);
2d2eda71267231c2526be701fe655db125852c1ffielding
2d2eda71267231c2526be701fe655db125852c1ffielding/* String handling. The *_nc variants allow you to use non-const char **s as
2d2eda71267231c2526be701fe655db125852c1ffielding arguments (unfortunately C won't automatically convert a char ** to a const
2d2eda71267231c2526be701fe655db125852c1ffielding char **) */
2d2eda71267231c2526be701fe655db125852c1ffielding
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
d91c51fbf73bd6697b41b8402bf6bb7fd8ab3d4dminfrin * Get the characters until the first occurrence of a specified character
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param p The pool to allocate memory from
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param line The string to get the characters from
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param stop The character to stop at
952908500d5f99f35afc5ed510391b9bdc3833farbb * @return A copy of the characters up to the first stop character
952908500d5f99f35afc5ed510391b9bdc3833farbb */
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(char *) ap_getword(apr_pool_t *p, const char **line, char stop);
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
d91c51fbf73bd6697b41b8402bf6bb7fd8ab3d4dminfrin * Get the characters until the first occurrence of a specified character
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param p The pool to allocate memory from
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param line The string to get the characters from
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param stop The character to stop at
952908500d5f99f35afc5ed510391b9bdc3833farbb * @return A copy of the characters up to the first stop character
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @note This is the same as ap_getword(), except it doesn't use const char **.
952908500d5f99f35afc5ed510391b9bdc3833farbb */
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(char *) ap_getword_nc(apr_pool_t *p, char **line, char stop);
952908500d5f99f35afc5ed510391b9bdc3833farbb
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
952908500d5f99f35afc5ed510391b9bdc3833farbb * Get the first word from a given string. A word is defined as all characters
952908500d5f99f35afc5ed510391b9bdc3833farbb * up to the first whitespace.
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param p The pool to allocate memory from
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param line The string to traverse
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @return The first word in the line
952908500d5f99f35afc5ed510391b9bdc3833farbb */
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(char *) ap_getword_white(apr_pool_t *p, const char **line);
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
952908500d5f99f35afc5ed510391b9bdc3833farbb * Get the first word from a given string. A word is defined as all characters
952908500d5f99f35afc5ed510391b9bdc3833farbb * up to the first whitespace.
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param p The pool to allocate memory from
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param line The string to traverse
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @return The first word in the line
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @note The same as ap_getword_white(), except it doesn't use const char**
952908500d5f99f35afc5ed510391b9bdc3833farbb */
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(char *) ap_getword_white_nc(apr_pool_t *p, char **line);
952908500d5f99f35afc5ed510391b9bdc3833farbb
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
d91c51fbf73bd6697b41b8402bf6bb7fd8ab3d4dminfrin * Get all characters from the first occurrence of @a stop to the first "\0"
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param p The pool to allocate memory from
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param line The line to traverse
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param stop The character to start at
d91c51fbf73bd6697b41b8402bf6bb7fd8ab3d4dminfrin * @return A copy of all characters after the first occurrence of the specified
952908500d5f99f35afc5ed510391b9bdc3833farbb * character
952908500d5f99f35afc5ed510391b9bdc3833farbb */
759f4a24d09e28c4eaca9f97311b497fc15cb5c7benAP_DECLARE(char *) ap_getword_nulls(apr_pool_t *p, const char **line,
11e076839c8d5a82d55e710194d0daac51390dbdsf char stop);
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
d91c51fbf73bd6697b41b8402bf6bb7fd8ab3d4dminfrin * Get all characters from the first occurrence of @a stop to the first "\0"
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param p The pool to allocate memory from
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param line The line to traverse
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param stop The character to start at
d91c51fbf73bd6697b41b8402bf6bb7fd8ab3d4dminfrin * @return A copy of all characters after the first occurrence of the specified
952908500d5f99f35afc5ed510391b9bdc3833farbb * character
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @note The same as ap_getword_nulls(), except it doesn't use const char **.
952908500d5f99f35afc5ed510391b9bdc3833farbb */
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(char *) ap_getword_nulls_nc(apr_pool_t *p, char **line, char stop);
952908500d5f99f35afc5ed510391b9bdc3833farbb
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
952908500d5f99f35afc5ed510391b9bdc3833farbb * Get the second word in the string paying attention to quoting
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param p The pool to allocate from
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param line The line to traverse
952908500d5f99f35afc5ed510391b9bdc3833farbb * @return A copy of the string
952908500d5f99f35afc5ed510391b9bdc3833farbb */
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(char *) ap_getword_conf(apr_pool_t *p, const char **line);
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
952908500d5f99f35afc5ed510391b9bdc3833farbb * Get the second word in the string paying attention to quoting
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param p The pool to allocate from
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param line The line to traverse
952908500d5f99f35afc5ed510391b9bdc3833farbb * @return A copy of the string
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @note The same as ap_getword_conf(), except it doesn't use const char **.
952908500d5f99f35afc5ed510391b9bdc3833farbb */
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(char *) ap_getword_conf_nc(apr_pool_t *p, char **line);
952908500d5f99f35afc5ed510391b9bdc3833farbb
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
bf507cc1e6ad55303c3d436c6ca153f46c788be6sf * Check a string for any config define or environment variable construct
bf507cc1e6ad55303c3d436c6ca153f46c788be6sf * and replace each of them by the value of that variable, if it exists.
bf507cc1e6ad55303c3d436c6ca153f46c788be6sf * The default syntax of the constructs is ${ENV} but can be changed by
bf507cc1e6ad55303c3d436c6ca153f46c788be6sf * setting the define::* config defines. If the variable does not exist,
bf507cc1e6ad55303c3d436c6ca153f46c788be6sf * leave the ${ENV} construct alone but print a warning.
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param p The pool to allocate from
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param word The string to check
952908500d5f99f35afc5ed510391b9bdc3833farbb * @return The string with the replaced environment variables
952908500d5f99f35afc5ed510391b9bdc3833farbb */
742318b93e89c311f66b55f426c4d9cf2c14628bjimAP_DECLARE(const char *) ap_resolve_env(apr_pool_t *p, const char * word);
2d2eda71267231c2526be701fe655db125852c1ffielding
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
952908500d5f99f35afc5ed510391b9bdc3833farbb * Size an HTTP header field list item, as separated by a comma.
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param field The field to size
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param len The length of the field
742318b93e89c311f66b55f426c4d9cf2c14628bjim * @return The return value is a pointer to the beginning of the non-empty
742318b93e89c311f66b55f426c4d9cf2c14628bjim * list item within the original string (or NULL if there is none) and the
742318b93e89c311f66b55f426c4d9cf2c14628bjim * address of field is shifted to the next non-comma, non-whitespace
952908500d5f99f35afc5ed510391b9bdc3833farbb * character. len is the length of the item excluding any beginning whitespace.
952908500d5f99f35afc5ed510391b9bdc3833farbb */
aecb17a45c6d3ee4729ed5f68dc4270f211ee7a8fieldingAP_DECLARE(const char *) ap_size_list_item(const char **field, int *len);
952908500d5f99f35afc5ed510391b9bdc3833farbb
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
952908500d5f99f35afc5ed510391b9bdc3833farbb * Retrieve an HTTP header field list item, as separated by a comma,
952908500d5f99f35afc5ed510391b9bdc3833farbb * while stripping insignificant whitespace and lowercasing anything not in
742318b93e89c311f66b55f426c4d9cf2c14628bjim * a quoted string or comment.
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param p The pool to allocate from
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param field The field to retrieve
742318b93e89c311f66b55f426c4d9cf2c14628bjim * @return The return value is a new string containing the converted list
742318b93e89c311f66b55f426c4d9cf2c14628bjim * item (or NULL if none) and the address pointed to by field is
952908500d5f99f35afc5ed510391b9bdc3833farbb * shifted to the next non-comma, non-whitespace.
952908500d5f99f35afc5ed510391b9bdc3833farbb */
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(char *) ap_get_list_item(apr_pool_t *p, const char **field);
952908500d5f99f35afc5ed510391b9bdc3833farbb
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
952908500d5f99f35afc5ed510391b9bdc3833farbb * Find an item in canonical form (lowercase, no extra spaces) within
742318b93e89c311f66b55f426c4d9cf2c14628bjim * an HTTP field value list.
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param p The pool to allocate from
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param line The field value list to search
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param tok The token to search for
952908500d5f99f35afc5ed510391b9bdc3833farbb * @return 1 if found, 0 if not found.
952908500d5f99f35afc5ed510391b9bdc3833farbb */
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(int) ap_find_list_item(apr_pool_t *p, const char *line, const char *tok);
2d2eda71267231c2526be701fe655db125852c1ffielding
decb536ebd4b7b94c7450c2e1daa491943135abdminfrin/**
decb536ebd4b7b94c7450c2e1daa491943135abdminfrin * Do a weak ETag comparison within an HTTP field value list.
decb536ebd4b7b94c7450c2e1daa491943135abdminfrin * @param p The pool to allocate from
decb536ebd4b7b94c7450c2e1daa491943135abdminfrin * @param line The field value list to search
decb536ebd4b7b94c7450c2e1daa491943135abdminfrin * @param tok The token to search for
decb536ebd4b7b94c7450c2e1daa491943135abdminfrin * @return 1 if found, 0 if not found.
decb536ebd4b7b94c7450c2e1daa491943135abdminfrin */
decb536ebd4b7b94c7450c2e1daa491943135abdminfrinAP_DECLARE(int) ap_find_etag_weak(apr_pool_t *p, const char *line, const char *tok);
decb536ebd4b7b94c7450c2e1daa491943135abdminfrin
decb536ebd4b7b94c7450c2e1daa491943135abdminfrin/**
decb536ebd4b7b94c7450c2e1daa491943135abdminfrin * Do a strong ETag comparison within an HTTP field value list.
decb536ebd4b7b94c7450c2e1daa491943135abdminfrin * @param p The pool to allocate from
decb536ebd4b7b94c7450c2e1daa491943135abdminfrin * @param line The field value list to search
decb536ebd4b7b94c7450c2e1daa491943135abdminfrin * @param tok The token to search for
decb536ebd4b7b94c7450c2e1daa491943135abdminfrin * @return 1 if found, 0 if not found.
decb536ebd4b7b94c7450c2e1daa491943135abdminfrin */
decb536ebd4b7b94c7450c2e1daa491943135abdminfrinAP_DECLARE(int) ap_find_etag_strong(apr_pool_t *p, const char *line, const char *tok);
decb536ebd4b7b94c7450c2e1daa491943135abdminfrin
d7550aefd0524ab33c52ff4099fdc9a2e23bac53jorton/**
d7550aefd0524ab33c52ff4099fdc9a2e23bac53jorton * Retrieve an array of tokens in the format "1#token" defined in RFC2616. Only
d7550aefd0524ab33c52ff4099fdc9a2e23bac53jorton * accepts ',' as a delimiter, does not accept quoted strings, and errors on
d7550aefd0524ab33c52ff4099fdc9a2e23bac53jorton * any separator.
d7550aefd0524ab33c52ff4099fdc9a2e23bac53jorton * @param p The pool to allocate from
d7550aefd0524ab33c52ff4099fdc9a2e23bac53jorton * @param tok The line to read tokens from
d7550aefd0524ab33c52ff4099fdc9a2e23bac53jorton * @param tokens Pointer to an array of tokens. If not NULL, must be an array
d7550aefd0524ab33c52ff4099fdc9a2e23bac53jorton * of char*, otherwise it will be allocated on @a p when a token is found
d7550aefd0524ab33c52ff4099fdc9a2e23bac53jorton * @param skip_invalid If true, when an invalid separator is encountered, it
d7550aefd0524ab33c52ff4099fdc9a2e23bac53jorton * will be ignored.
d7550aefd0524ab33c52ff4099fdc9a2e23bac53jorton * @return NULL on success, an error string otherwise.
d7550aefd0524ab33c52ff4099fdc9a2e23bac53jorton * @remark *tokens may be NULL on output if NULL in input and no token is found
d7550aefd0524ab33c52ff4099fdc9a2e23bac53jorton */
d7550aefd0524ab33c52ff4099fdc9a2e23bac53jortonAP_DECLARE(const char *) ap_parse_token_list_strict(apr_pool_t *p, const char *tok,
d7550aefd0524ab33c52ff4099fdc9a2e23bac53jorton apr_array_header_t **tokens,
d7550aefd0524ab33c52ff4099fdc9a2e23bac53jorton int skip_invalid);
d7550aefd0524ab33c52ff4099fdc9a2e23bac53jorton
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
971ced4989415d939afba8d70c82a9ce0113bceend * Retrieve a token, spacing over it and adjusting the pointer to
952908500d5f99f35afc5ed510391b9bdc3833farbb * the first non-white byte afterwards. Note that these tokens
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * are delimited by semis and commas and can also be delimited
952908500d5f99f35afc5ed510391b9bdc3833farbb * by whitespace at the caller's option.
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param p The pool to allocate from
971ced4989415d939afba8d70c82a9ce0113bceend * @param accept_line The line to retrieve the token from (adjusted afterwards)
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param accept_white Is it delimited by whitespace
971ced4989415d939afba8d70c82a9ce0113bceend * @return the token
952908500d5f99f35afc5ed510391b9bdc3833farbb */
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(char *) ap_get_token(apr_pool_t *p, const char **accept_line, int accept_white);
952908500d5f99f35afc5ed510391b9bdc3833farbb
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
742318b93e89c311f66b55f426c4d9cf2c14628bjim * Find http tokens, see the definition of token from RFC2068
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param p The pool to allocate from
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param line The line to find the token
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param tok The token to find
952908500d5f99f35afc5ed510391b9bdc3833farbb * @return 1 if the token is found, 0 otherwise
952908500d5f99f35afc5ed510391b9bdc3833farbb */
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(int) ap_find_token(apr_pool_t *p, const char *line, const char *tok);
952908500d5f99f35afc5ed510391b9bdc3833farbb
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
952908500d5f99f35afc5ed510391b9bdc3833farbb * find http tokens from the end of the line
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param p The pool to allocate from
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param line The line to find the token
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param tok The token to find
952908500d5f99f35afc5ed510391b9bdc3833farbb * @return 1 if the token is found, 0 otherwise
952908500d5f99f35afc5ed510391b9bdc3833farbb */
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(int) ap_find_last_token(apr_pool_t *p, const char *line, const char *tok);
2d2eda71267231c2526be701fe655db125852c1ffielding
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
952908500d5f99f35afc5ed510391b9bdc3833farbb * Check for an Absolute URI syntax
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param u The string to check
952908500d5f99f35afc5ed510391b9bdc3833farbb * @return 1 if URI, 0 otherwise
952908500d5f99f35afc5ed510391b9bdc3833farbb */
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(int) ap_is_url(const char *u);
952908500d5f99f35afc5ed510391b9bdc3833farbb
fb8ee8b7a3a2503b95bf47685f9083e0b9834e6fminfrin/**
fb8ee8b7a3a2503b95bf47685f9083e0b9834e6fminfrin * Unescape a string
fb8ee8b7a3a2503b95bf47685f9083e0b9834e6fminfrin * @param url The string to unescape
fb8ee8b7a3a2503b95bf47685f9083e0b9834e6fminfrin * @return 0 on success, non-zero otherwise
fb8ee8b7a3a2503b95bf47685f9083e0b9834e6fminfrin */
fb8ee8b7a3a2503b95bf47685f9083e0b9834e6fminfrinAP_DECLARE(int) ap_unescape_all(char *url);
fb8ee8b7a3a2503b95bf47685f9083e0b9834e6fminfrin
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
952908500d5f99f35afc5ed510391b9bdc3833farbb * Unescape a URL
8419e6f8bff1a3617933f3ba760d2bdec7442f44coar * @param url The url to unescape
952908500d5f99f35afc5ed510391b9bdc3833farbb * @return 0 on success, non-zero otherwise
174594c7abbf8cf2fc8095809b4a43cf959c2ef5minfrin * @deprecated Replaced by apr_unescape_url() in APR
952908500d5f99f35afc5ed510391b9bdc3833farbb */
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(int) ap_unescape_url(char *url);
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh
8419e6f8bff1a3617933f3ba760d2bdec7442f44coar/**
8419e6f8bff1a3617933f3ba760d2bdec7442f44coar * Unescape a URL, but leaving %2f (slashes) escaped
8419e6f8bff1a3617933f3ba760d2bdec7442f44coar * @param url The url to unescape
7d84798eed7ad93b66b88841974525641749a9b1trawick * @param decode_slashes Whether or not slashes should be decoded
8419e6f8bff1a3617933f3ba760d2bdec7442f44coar * @return 0 on success, non-zero otherwise
174594c7abbf8cf2fc8095809b4a43cf959c2ef5minfrin * @deprecated Replaced by apr_unescape_url() in APR
8419e6f8bff1a3617933f3ba760d2bdec7442f44coar */
3770ed746d69c7a4111cba9966169bd5d7a509a6poirierAP_DECLARE(int) ap_unescape_url_keep2f(char *url, int decode_slashes);
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh
81cc440ca73845f44dc589db106d3feb7a36f33bminfrin/**
81cc440ca73845f44dc589db106d3feb7a36f33bminfrin * Unescape an application/x-www-form-urlencoded string
81cc440ca73845f44dc589db106d3feb7a36f33bminfrin * @param query The query to unescape
81cc440ca73845f44dc589db106d3feb7a36f33bminfrin * @return 0 on success, non-zero otherwise
174594c7abbf8cf2fc8095809b4a43cf959c2ef5minfrin * @deprecated Replaced by apr_unescape_url() in APR
81cc440ca73845f44dc589db106d3feb7a36f33bminfrin */
81cc440ca73845f44dc589db106d3feb7a36f33bminfrinAP_DECLARE(int) ap_unescape_urlencoded(char *query);
81cc440ca73845f44dc589db106d3feb7a36f33bminfrin
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * Convert all double slashes to single slashes
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param name The string to convert
952908500d5f99f35afc5ed510391b9bdc3833farbb */
d385a718b411c35c25ddf750fb4d2533148c000bsfAP_DECLARE(void) ap_no2slash(char *name)
d385a718b411c35c25ddf750fb4d2533148c000bsf AP_FN_ATTR_NONNULL_ALL;
952908500d5f99f35afc5ed510391b9bdc3833farbb
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * Remove all ./ and xx/../ substrings from a file name. Also remove
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * any leading ../ or /../ substrings.
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param name the file name to parse
952908500d5f99f35afc5ed510391b9bdc3833farbb */
d385a718b411c35c25ddf750fb4d2533148c000bsfAP_DECLARE(void) ap_getparents(char *name)
d385a718b411c35c25ddf750fb4d2533148c000bsf AP_FN_ATTR_NONNULL_ALL;
952908500d5f99f35afc5ed510391b9bdc3833farbb
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
952908500d5f99f35afc5ed510391b9bdc3833farbb * Escape a path segment, as defined in RFC 1808
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param p The pool to allocate from
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param s The path to convert
952908500d5f99f35afc5ed510391b9bdc3833farbb * @return The converted URL
174594c7abbf8cf2fc8095809b4a43cf959c2ef5minfrin * @deprecated Replaced by apr_pescape_path_segment() in APR
952908500d5f99f35afc5ed510391b9bdc3833farbb */
d385a718b411c35c25ddf750fb4d2533148c000bsfAP_DECLARE(char *) ap_escape_path_segment(apr_pool_t *p, const char *s)
d385a718b411c35c25ddf750fb4d2533148c000bsf AP_FN_ATTR_NONNULL_ALL;
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh
fb8ee8b7a3a2503b95bf47685f9083e0b9834e6fminfrin/**
fb8ee8b7a3a2503b95bf47685f9083e0b9834e6fminfrin * Escape a path segment, as defined in RFC 1808, to a preallocated buffer.
fb8ee8b7a3a2503b95bf47685f9083e0b9834e6fminfrin * @param c The preallocated buffer to write to
fb8ee8b7a3a2503b95bf47685f9083e0b9834e6fminfrin * @param s The path to convert
fb8ee8b7a3a2503b95bf47685f9083e0b9834e6fminfrin * @return The converted URL (c)
174594c7abbf8cf2fc8095809b4a43cf959c2ef5minfrin * @deprecated Replaced by apr_escape_path_segment() in APR
fb8ee8b7a3a2503b95bf47685f9083e0b9834e6fminfrin */
d385a718b411c35c25ddf750fb4d2533148c000bsfAP_DECLARE(char *) ap_escape_path_segment_buffer(char *c, const char *s)
d385a718b411c35c25ddf750fb4d2533148c000bsf AP_FN_ATTR_NONNULL_ALL;
fb8ee8b7a3a2503b95bf47685f9083e0b9834e6fminfrin
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
81815de686a37b22ba5a1b23db736e23dd2b63d3humbedooh * convert an OS path to a URL in an OS dependent way.
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param p The pool to allocate from
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param path The path to convert
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param partial if set, assume that the path will be appended to something
6c0e8bc4051537fb59dbca7d80c0a0ca9cf8917asf * with a '/' in it (and thus does not prefix "./").
270cd5fa1853d1e54d0e46e8b3f7c84af76cc674jailletc * @return The converted URL, with one byte of extra space after the NUL
270cd5fa1853d1e54d0e46e8b3f7c84af76cc674jailletc * to allow the caller to add a trailing '/'.
174594c7abbf8cf2fc8095809b4a43cf959c2ef5minfrin * @deprecated Replaced by apr_pescape_path() in APR
952908500d5f99f35afc5ed510391b9bdc3833farbb */
d385a718b411c35c25ddf750fb4d2533148c000bsfAP_DECLARE(char *) ap_os_escape_path(apr_pool_t *p, const char *path, int partial)
d385a718b411c35c25ddf750fb4d2533148c000bsf AP_FN_ATTR_NONNULL_ALL;
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** @see ap_os_escape_path */
2d2eda71267231c2526be701fe655db125852c1ffielding#define ap_escape_uri(ppool,path) ap_os_escape_path(ppool,path,1)
952908500d5f99f35afc5ed510391b9bdc3833farbb
81cc440ca73845f44dc589db106d3feb7a36f33bminfrin/**
81cc440ca73845f44dc589db106d3feb7a36f33bminfrin * Escape a string as application/x-www-form-urlencoded
81cc440ca73845f44dc589db106d3feb7a36f33bminfrin * @param p The pool to allocate from
81cc440ca73845f44dc589db106d3feb7a36f33bminfrin * @param s The path to convert
81cc440ca73845f44dc589db106d3feb7a36f33bminfrin * @return The converted URL
174594c7abbf8cf2fc8095809b4a43cf959c2ef5minfrin * @deprecated Replaced by apr_pescape_url() in APR
81cc440ca73845f44dc589db106d3feb7a36f33bminfrin */
d385a718b411c35c25ddf750fb4d2533148c000bsfAP_DECLARE(char *) ap_escape_urlencoded(apr_pool_t *p, const char *s)
d385a718b411c35c25ddf750fb4d2533148c000bsf AP_FN_ATTR_NONNULL_ALL;
81cc440ca73845f44dc589db106d3feb7a36f33bminfrin
81cc440ca73845f44dc589db106d3feb7a36f33bminfrin/**
81cc440ca73845f44dc589db106d3feb7a36f33bminfrin * Escape a string as application/x-www-form-urlencoded, to a preallocated buffer
81cc440ca73845f44dc589db106d3feb7a36f33bminfrin * @param c The preallocated buffer to write to
81cc440ca73845f44dc589db106d3feb7a36f33bminfrin * @param s The path to convert
81cc440ca73845f44dc589db106d3feb7a36f33bminfrin * @return The converted URL (c)
174594c7abbf8cf2fc8095809b4a43cf959c2ef5minfrin * @deprecated Replaced by apr_escape_url() in APR
81cc440ca73845f44dc589db106d3feb7a36f33bminfrin */
d385a718b411c35c25ddf750fb4d2533148c000bsfAP_DECLARE(char *) ap_escape_urlencoded_buffer(char *c, const char *s)
d385a718b411c35c25ddf750fb4d2533148c000bsf AP_FN_ATTR_NONNULL_ALL;
81cc440ca73845f44dc589db106d3feb7a36f33bminfrin
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
952908500d5f99f35afc5ed510391b9bdc3833farbb * Escape an html string
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param p The pool to allocate from
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param s The html to escape
952908500d5f99f35afc5ed510391b9bdc3833farbb * @return The escaped string
174594c7abbf8cf2fc8095809b4a43cf959c2ef5minfrin * @deprecated Replaced by apr_pescape_entity() in APR
952908500d5f99f35afc5ed510391b9bdc3833farbb */
8c3667cd1d0db08647793137c0d1aa7f6526bebfniq#define ap_escape_html(p,s) ap_escape_html2(p,s,0)
8c3667cd1d0db08647793137c0d1aa7f6526bebfniq/**
8c3667cd1d0db08647793137c0d1aa7f6526bebfniq * Escape an html string
8c3667cd1d0db08647793137c0d1aa7f6526bebfniq * @param p The pool to allocate from
8c3667cd1d0db08647793137c0d1aa7f6526bebfniq * @param s The html to escape
c779aea0c9b7c47c2e4fd258e3f54835a849625dpoirier * @param toasc Whether to escape all non-ASCII chars to \&\#nnn;
8c3667cd1d0db08647793137c0d1aa7f6526bebfniq * @return The escaped string
174594c7abbf8cf2fc8095809b4a43cf959c2ef5minfrin * @deprecated Replaced by apr_pescape_entity() in APR
8c3667cd1d0db08647793137c0d1aa7f6526bebfniq */
d385a718b411c35c25ddf750fb4d2533148c000bsfAP_DECLARE(char *) ap_escape_html2(apr_pool_t *p, const char *s, int toasc)
d385a718b411c35c25ddf750fb4d2533148c000bsf AP_FN_ATTR_NONNULL_ALL;
952908500d5f99f35afc5ed510391b9bdc3833farbb
3de8d8649277a02f53aa4f06121420985e8eee08nd/**
3de8d8649277a02f53aa4f06121420985e8eee08nd * Escape a string for logging
3de8d8649277a02f53aa4f06121420985e8eee08nd * @param p The pool to allocate from
82acfa3f57607ae78326104c420a317260554a47nd * @param str The string to escape
3de8d8649277a02f53aa4f06121420985e8eee08nd * @return The escaped string
174594c7abbf8cf2fc8095809b4a43cf959c2ef5minfrin * @deprecated Replaced by apr_pescape_echo() in APR
3de8d8649277a02f53aa4f06121420985e8eee08nd */
d385a718b411c35c25ddf750fb4d2533148c000bsfAP_DECLARE(char *) ap_escape_logitem(apr_pool_t *p, const char *str)
d385a718b411c35c25ddf750fb4d2533148c000bsf AP_FN_ATTR_NONNULL((1));
3de8d8649277a02f53aa4f06121420985e8eee08nd
82acfa3f57607ae78326104c420a317260554a47nd/**
82acfa3f57607ae78326104c420a317260554a47nd * Escape a string for logging into the error log (without a pool)
82acfa3f57607ae78326104c420a317260554a47nd * @param dest The buffer to write to
82acfa3f57607ae78326104c420a317260554a47nd * @param source The string to escape
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @param buflen The buffer size for the escaped string (including "\0")
82acfa3f57607ae78326104c420a317260554a47nd * @return The len of the escaped string (always < maxlen)
174594c7abbf8cf2fc8095809b4a43cf959c2ef5minfrin * @deprecated Replaced by apr_escape_echo() in APR
82acfa3f57607ae78326104c420a317260554a47nd */
82acfa3f57607ae78326104c420a317260554a47ndAP_DECLARE(apr_size_t) ap_escape_errorlog_item(char *dest, const char *source,
d385a718b411c35c25ddf750fb4d2533148c000bsf apr_size_t buflen)
d385a718b411c35c25ddf750fb4d2533148c000bsf AP_FN_ATTR_NONNULL((1));
82acfa3f57607ae78326104c420a317260554a47nd
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
952908500d5f99f35afc5ed510391b9bdc3833farbb * Construct a full hostname
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param p The pool to allocate from
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param hostname The hostname of the server
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param port The port the server is running on
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param r The current request
952908500d5f99f35afc5ed510391b9bdc3833farbb * @return The server's hostname
952908500d5f99f35afc5ed510391b9bdc3833farbb */
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(char *) ap_construct_server(apr_pool_t *p, const char *hostname,
d385a718b411c35c25ddf750fb4d2533148c000bsf apr_port_t port, const request_rec *r)
d385a718b411c35c25ddf750fb4d2533148c000bsf AP_FN_ATTR_NONNULL((1,4));
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
952908500d5f99f35afc5ed510391b9bdc3833farbb * Escape a shell command
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param p The pool to allocate from
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param s The command to escape
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @return The escaped shell command
174594c7abbf8cf2fc8095809b4a43cf959c2ef5minfrin * @deprecated Replaced with apr_escape_shell() in APR
952908500d5f99f35afc5ed510391b9bdc3833farbb */
d385a718b411c35c25ddf750fb4d2533148c000bsfAP_DECLARE(char *) ap_escape_shell_cmd(apr_pool_t *p, const char *s)
51365d4fb8fc556146f420468ebd63cae8f48478sf AP_FN_ATTR_NONNULL_ALL;
2d2eda71267231c2526be701fe655db125852c1ffielding
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
952908500d5f99f35afc5ed510391b9bdc3833farbb * Count the number of directories in a path
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param path The path to count
952908500d5f99f35afc5ed510391b9bdc3833farbb * @return The number of directories
952908500d5f99f35afc5ed510391b9bdc3833farbb */
d385a718b411c35c25ddf750fb4d2533148c000bsfAP_DECLARE(int) ap_count_dirs(const char *path)
d385a718b411c35c25ddf750fb4d2533148c000bsf AP_FN_ATTR_NONNULL_ALL;
7c7372abe2484e7fcf81937b93496d1246e5b816gstein
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * Copy at most @a n leading directories of @a s into @a d. @a d
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * should be at least as large as @a s plus 1 extra byte
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben *
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param d The location to copy to
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param s The location to copy from
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param n The number of directories to copy
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @return value is the ever useful pointer to the trailing "\0" of d
742318b93e89c311f66b55f426c4d9cf2c14628bjim * @note on platforms with drive letters, n = 0 returns the "/" root,
59ae852bea7d507f61999f982ded8219d2c0ec15wrowe * whereas n = 1 returns the "d:/" root. On all other platforms, n = 0
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * returns the empty string. */
d385a718b411c35c25ddf750fb4d2533148c000bsfAP_DECLARE(char *) ap_make_dirstr_prefix(char *d, const char *s, int n)
d385a718b411c35c25ddf750fb4d2533148c000bsf AP_FN_ATTR_NONNULL_ALL;
7c7372abe2484e7fcf81937b93496d1246e5b816gstein
952908500d5f99f35afc5ed510391b9bdc3833farbb/**
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * Return the parent directory name (including trailing /) of the file
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @a s
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param p The pool to allocate from
952908500d5f99f35afc5ed510391b9bdc3833farbb * @param s The file to get the parent of
952908500d5f99f35afc5ed510391b9bdc3833farbb * @return A copy of the file's parent directory
952908500d5f99f35afc5ed510391b9bdc3833farbb */
d385a718b411c35c25ddf750fb4d2533148c000bsfAP_DECLARE(char *) ap_make_dirstr_parent(apr_pool_t *p, const char *s)
d385a718b411c35c25ddf750fb4d2533148c000bsf AP_FN_ATTR_NONNULL_ALL;
58619148951981bcfa5c506ad8ce745aa8831980rbb
58619148951981bcfa5c506ad8ce745aa8831980rbb/**
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * Given a directory and filename, create a single path from them. This
748bb59b279a47f77e239106a3436bdeb195e0acrbowen * function is smart enough to ensure that there is a single '/' between the
58619148951981bcfa5c506ad8ce745aa8831980rbb * directory and file names
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param a The pool to allocate from
58619148951981bcfa5c506ad8ce745aa8831980rbb * @param dir The directory name
58619148951981bcfa5c506ad8ce745aa8831980rbb * @param f The filename
6c0e8bc4051537fb59dbca7d80c0a0ca9cf8917asf * @return A copy of the full path, with one byte of extra space after the NUL
6c0e8bc4051537fb59dbca7d80c0a0ca9cf8917asf * to allow the caller to add a trailing '/'.
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @note Never consider using this function if you are dealing with filesystem
3d72602d1d9e6f0d49d20f0d0a71831c160ef589wrowe * names that need to remain canonical, unless you are merging an apr_dir_read
3d72602d1d9e6f0d49d20f0d0a71831c160ef589wrowe * path and returned filename. Otherwise, the result is not canonical.
58619148951981bcfa5c506ad8ce745aa8831980rbb */
d385a718b411c35c25ddf750fb4d2533148c000bsfAP_DECLARE(char *) ap_make_full_path(apr_pool_t *a, const char *dir, const char *f)
d385a718b411c35c25ddf750fb4d2533148c000bsf AP_FN_ATTR_NONNULL_ALL;
2d2eda71267231c2526be701fe655db125852c1ffielding
3d72602d1d9e6f0d49d20f0d0a71831c160ef589wrowe/**
3d72602d1d9e6f0d49d20f0d0a71831c160ef589wrowe * Test if the given path has an an absolute path.
3d72602d1d9e6f0d49d20f0d0a71831c160ef589wrowe * @param p The pool to allocate from
3d72602d1d9e6f0d49d20f0d0a71831c160ef589wrowe * @param dir The directory name
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh * @note The converse is not necessarily true, some OS's (Win32/OS2/Netware) have
3d72602d1d9e6f0d49d20f0d0a71831c160ef589wrowe * multiple forms of absolute paths. This only reports if the path is absolute
3d72602d1d9e6f0d49d20f0d0a71831c160ef589wrowe * in a canonical sense.
3d72602d1d9e6f0d49d20f0d0a71831c160ef589wrowe */
d385a718b411c35c25ddf750fb4d2533148c000bsfAP_DECLARE(int) ap_os_is_path_absolute(apr_pool_t *p, const char *dir)
d385a718b411c35c25ddf750fb4d2533148c000bsf AP_FN_ATTR_NONNULL_ALL;
3d72602d1d9e6f0d49d20f0d0a71831c160ef589wrowe
58619148951981bcfa5c506ad8ce745aa8831980rbb/**
58619148951981bcfa5c506ad8ce745aa8831980rbb * Does the provided string contain wildcard characters? This is useful
58619148951981bcfa5c506ad8ce745aa8831980rbb * for determining if the string should be passed to strcmp_match or to strcmp.
58619148951981bcfa5c506ad8ce745aa8831980rbb * The only wildcard characters recognized are '?' and '*'
58619148951981bcfa5c506ad8ce745aa8831980rbb * @param str The string to check
58619148951981bcfa5c506ad8ce745aa8831980rbb * @return 1 if the string has wildcards, 0 otherwise
58619148951981bcfa5c506ad8ce745aa8831980rbb */
d385a718b411c35c25ddf750fb4d2533148c000bsfAP_DECLARE(int) ap_is_matchexp(const char *str)
d385a718b411c35c25ddf750fb4d2533148c000bsf AP_FN_ATTR_NONNULL_ALL;
58619148951981bcfa5c506ad8ce745aa8831980rbb
58619148951981bcfa5c506ad8ce745aa8831980rbb/**
58619148951981bcfa5c506ad8ce745aa8831980rbb * Determine if a string matches a patterm containing the wildcards '?' or '*'
58619148951981bcfa5c506ad8ce745aa8831980rbb * @param str The string to check
92d6e181c597b97647d750c43a7bc3626e056b59gstein * @param expected The pattern to match against
a6cfa54fd43d09ef9fa1bc4649039ada0a340db8humbedooh * @return 0 if the two strings match, 1 otherwise
58619148951981bcfa5c506ad8ce745aa8831980rbb */
d385a718b411c35c25ddf750fb4d2533148c000bsfAP_DECLARE(int) ap_strcmp_match(const char *str, const char *expected)
d385a718b411c35c25ddf750fb4d2533148c000bsf AP_FN_ATTR_NONNULL_ALL;
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh
58619148951981bcfa5c506ad8ce745aa8831980rbb/**
58619148951981bcfa5c506ad8ce745aa8831980rbb * Determine if a string matches a patterm containing the wildcards '?' or '*',
58619148951981bcfa5c506ad8ce745aa8831980rbb * ignoring case
58619148951981bcfa5c506ad8ce745aa8831980rbb * @param str The string to check
92d6e181c597b97647d750c43a7bc3626e056b59gstein * @param expected The pattern to match against
a6cfa54fd43d09ef9fa1bc4649039ada0a340db8humbedooh * @return 0 if the two strings match, 1 otherwise
58619148951981bcfa5c506ad8ce745aa8831980rbb */
d385a718b411c35c25ddf750fb4d2533148c000bsfAP_DECLARE(int) ap_strcasecmp_match(const char *str, const char *expected)
d385a718b411c35c25ddf750fb4d2533148c000bsf AP_FN_ATTR_NONNULL_ALL;
58619148951981bcfa5c506ad8ce745aa8831980rbb
58619148951981bcfa5c506ad8ce745aa8831980rbb/**
58619148951981bcfa5c506ad8ce745aa8831980rbb * Find the first occurrence of the substring s2 in s1, regardless of case
58619148951981bcfa5c506ad8ce745aa8831980rbb * @param s1 The string to search
58619148951981bcfa5c506ad8ce745aa8831980rbb * @param s2 The substring to search for
58619148951981bcfa5c506ad8ce745aa8831980rbb * @return A pointer to the beginning of the substring
3e0494829cf6e8ac61e80fd82b1133111a52614cbrianp * @remark See apr_strmatch() for a faster alternative
58619148951981bcfa5c506ad8ce745aa8831980rbb */
d385a718b411c35c25ddf750fb4d2533148c000bsfAP_DECLARE(char *) ap_strcasestr(const char *s1, const char *s2)
d385a718b411c35c25ddf750fb4d2533148c000bsf AP_FN_ATTR_NONNULL_ALL;
58619148951981bcfa5c506ad8ce745aa8831980rbb
30c095035b1d5910cc239a1384c816aef228beb5jim/**
30c095035b1d5910cc239a1384c816aef228beb5jim * Return a pointer to the location inside of bigstring immediately after prefix
30c095035b1d5910cc239a1384c816aef228beb5jim * @param bigstring The input string
30c095035b1d5910cc239a1384c816aef228beb5jim * @param prefix The prefix to strip away
30c095035b1d5910cc239a1384c816aef228beb5jim * @return A pointer relative to bigstring after prefix
30c095035b1d5910cc239a1384c816aef228beb5jim */
bdadc326446cae4a51bf75811fbe01a3a362df64gsteinAP_DECLARE(const char *) ap_stripprefix(const char *bigstring,
d385a718b411c35c25ddf750fb4d2533148c000bsf const char *prefix)
d385a718b411c35c25ddf750fb4d2533148c000bsf AP_FN_ATTR_NONNULL_ALL;
30c095035b1d5910cc239a1384c816aef228beb5jim
58619148951981bcfa5c506ad8ce745aa8831980rbb/**
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * Decode a base64 encoded string into memory allocated from a pool
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param p The pool to allocate from
58619148951981bcfa5c506ad8ce745aa8831980rbb * @param bufcoded The encoded string
58619148951981bcfa5c506ad8ce745aa8831980rbb * @return The decoded string
174594c7abbf8cf2fc8095809b4a43cf959c2ef5minfrin * @deprecated Replaced by apr_pbase64_decode() in APR.
58619148951981bcfa5c506ad8ce745aa8831980rbb */
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(char *) ap_pbase64decode(apr_pool_t *p, const char *bufcoded);
58619148951981bcfa5c506ad8ce745aa8831980rbb
58619148951981bcfa5c506ad8ce745aa8831980rbb/**
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * Encode a string into memory allocated from a pool in base 64 format
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param p The pool to allocate from
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @param string The plaintext string
58619148951981bcfa5c506ad8ce745aa8831980rbb * @return The encoded string
174594c7abbf8cf2fc8095809b4a43cf959c2ef5minfrin * @deprecated Replaced by apr_pbase64_encode() in APR.
58619148951981bcfa5c506ad8ce745aa8831980rbb */
742318b93e89c311f66b55f426c4d9cf2c14628bjimAP_DECLARE(char *) ap_pbase64encode(apr_pool_t *p, char *string);
58619148951981bcfa5c506ad8ce745aa8831980rbb
58619148951981bcfa5c506ad8ce745aa8831980rbb/**
e0cb33839fe1b103e960da9538156de474d290e2sf * Compile a regular expression to be used later. The regex is freed when
e0cb33839fe1b103e960da9538156de474d290e2sf * the pool is destroyed.
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param p The pool to allocate from
58619148951981bcfa5c506ad8ce745aa8831980rbb * @param pattern the regular expression to compile
58619148951981bcfa5c506ad8ce745aa8831980rbb * @param cflags The bitwise or of one or more of the following:
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @li REG_EXTENDED - Use POSIX extended Regular Expressions
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @li REG_ICASE - Ignore case
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @li REG_NOSUB - Support for substring addressing of matches
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * not required
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @li REG_NEWLINE - Match-any-character operators don't match new-line
58619148951981bcfa5c506ad8ce745aa8831980rbb * @return The compiled regular expression
58619148951981bcfa5c506ad8ce745aa8831980rbb */
ef5650b61a8e35f3cc93ec07e73efc17ea329894jortonAP_DECLARE(ap_regex_t *) ap_pregcomp(apr_pool_t *p, const char *pattern,
ef5650b61a8e35f3cc93ec07e73efc17ea329894jorton int cflags);
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh
58619148951981bcfa5c506ad8ce745aa8831980rbb/**
58619148951981bcfa5c506ad8ce745aa8831980rbb * Free the memory associated with a compiled regular expression
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param p The pool the regex was allocated from
58619148951981bcfa5c506ad8ce745aa8831980rbb * @param reg The regular expression to free
e0cb33839fe1b103e960da9538156de474d290e2sf * @note This function is only necessary if the regex should be cleaned
e0cb33839fe1b103e960da9538156de474d290e2sf * up before the pool
58619148951981bcfa5c506ad8ce745aa8831980rbb */
ef5650b61a8e35f3cc93ec07e73efc17ea329894jortonAP_DECLARE(void) ap_pregfree(apr_pool_t *p, ap_regex_t *reg);
58619148951981bcfa5c506ad8ce745aa8831980rbb
58619148951981bcfa5c506ad8ce745aa8831980rbb/**
742318b93e89c311f66b55f426c4d9cf2c14628bjim * After performing a successful regex match, you may use this function to
58619148951981bcfa5c506ad8ce745aa8831980rbb * perform a series of string substitutions based on subexpressions that were
cda2a8c4fe289419f62e8b9607cafe4812974840sf * matched during the call to ap_regexec. This function is limited to
cda2a8c4fe289419f62e8b9607cafe4812974840sf * result strings of 64K. Consider using ap_pregsub_ex() instead.
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param p The pool to allocate from
742318b93e89c311f66b55f426c4d9cf2c14628bjim * @param input An arbitrary string containing $1 through $9. These are
58619148951981bcfa5c506ad8ce745aa8831980rbb * replaced with the corresponding matched sub-expressions
58619148951981bcfa5c506ad8ce745aa8831980rbb * @param source The string that was originally matched to the regex
58619148951981bcfa5c506ad8ce745aa8831980rbb * @param nmatch the nmatch returned from ap_pregex
58619148951981bcfa5c506ad8ce745aa8831980rbb * @param pmatch the pmatch array returned from ap_pregex
975bdabd8564af8a8bc075b5e70eb77af84793b6sf * @return The substituted string, or NULL on error
58619148951981bcfa5c506ad8ce745aa8831980rbb */
b02dfdb611f84136664b3c05e4d4d704aeabbf63wroweAP_DECLARE(char *) ap_pregsub(apr_pool_t *p, const char *input,
b02dfdb611f84136664b3c05e4d4d704aeabbf63wrowe const char *source, apr_size_t nmatch,
b02dfdb611f84136664b3c05e4d4d704aeabbf63wrowe ap_regmatch_t pmatch[]);
2d2eda71267231c2526be701fe655db125852c1ffielding
cda2a8c4fe289419f62e8b9607cafe4812974840sf/**
cda2a8c4fe289419f62e8b9607cafe4812974840sf * After performing a successful regex match, you may use this function to
cda2a8c4fe289419f62e8b9607cafe4812974840sf * perform a series of string substitutions based on subexpressions that were
cda2a8c4fe289419f62e8b9607cafe4812974840sf * matched during the call to ap_regexec
cda2a8c4fe289419f62e8b9607cafe4812974840sf * @param p The pool to allocate from
cda2a8c4fe289419f62e8b9607cafe4812974840sf * @param result where to store the result, will be set to NULL on error
cda2a8c4fe289419f62e8b9607cafe4812974840sf * @param input An arbitrary string containing $1 through $9. These are
cda2a8c4fe289419f62e8b9607cafe4812974840sf * replaced with the corresponding matched sub-expressions
cda2a8c4fe289419f62e8b9607cafe4812974840sf * @param source The string that was originally matched to the regex
cda2a8c4fe289419f62e8b9607cafe4812974840sf * @param nmatch the nmatch returned from ap_pregex
cda2a8c4fe289419f62e8b9607cafe4812974840sf * @param pmatch the pmatch array returned from ap_pregex
0f7233952e2732c08e1848a0209ab207d4ada35asf * @param maxlen the maximum string length to return, 0 for unlimited
493a2727fc008e52b271c7fb11cdcf9a15ce1fcdtrawick * @return APR_SUCCESS if successful, APR_ENOMEM or other error code otherwise.
cda2a8c4fe289419f62e8b9607cafe4812974840sf */
cda2a8c4fe289419f62e8b9607cafe4812974840sfAP_DECLARE(apr_status_t) ap_pregsub_ex(apr_pool_t *p, char **result,
cda2a8c4fe289419f62e8b9607cafe4812974840sf const char *input, const char *source,
b02dfdb611f84136664b3c05e4d4d704aeabbf63wrowe apr_size_t nmatch,
b02dfdb611f84136664b3c05e4d4d704aeabbf63wrowe ap_regmatch_t pmatch[],
cda2a8c4fe289419f62e8b9607cafe4812974840sf apr_size_t maxlen);
cda2a8c4fe289419f62e8b9607cafe4812974840sf
58619148951981bcfa5c506ad8ce745aa8831980rbb/**
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * We want to downcase the type/subtype for comparison purposes
58619148951981bcfa5c506ad8ce745aa8831980rbb * but nothing else because ;parameter=foo values are case sensitive.
58619148951981bcfa5c506ad8ce745aa8831980rbb * @param s The content-type to convert to lowercase
58619148951981bcfa5c506ad8ce745aa8831980rbb */
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(void) ap_content_type_tolower(char *s);
7c7372abe2484e7fcf81937b93496d1246e5b816gstein
58619148951981bcfa5c506ad8ce745aa8831980rbb/**
58619148951981bcfa5c506ad8ce745aa8831980rbb * convert a string to all lowercase
742318b93e89c311f66b55f426c4d9cf2c14628bjim * @param s The string to convert to lowercase
58619148951981bcfa5c506ad8ce745aa8831980rbb */
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(void) ap_str_tolower(char *s);
58619148951981bcfa5c506ad8ce745aa8831980rbb
2c3a18efdb0536acb42f25758b66bb85a67a9131sf/**
2c3a18efdb0536acb42f25758b66bb85a67a9131sf * convert a string to all uppercase
742318b93e89c311f66b55f426c4d9cf2c14628bjim * @param s The string to convert to uppercase
2c3a18efdb0536acb42f25758b66bb85a67a9131sf */
2c3a18efdb0536acb42f25758b66bb85a67a9131sfAP_DECLARE(void) ap_str_toupper(char *s);
2c3a18efdb0536acb42f25758b66bb85a67a9131sf
58619148951981bcfa5c506ad8ce745aa8831980rbb/**
742318b93e89c311f66b55f426c4d9cf2c14628bjim * Search a string from left to right for the first occurrence of a
58619148951981bcfa5c506ad8ce745aa8831980rbb * specific character
58619148951981bcfa5c506ad8ce745aa8831980rbb * @param str The string to search
58619148951981bcfa5c506ad8ce745aa8831980rbb * @param c The character to search for
58619148951981bcfa5c506ad8ce745aa8831980rbb * @return The index of the first occurrence of c in str
58619148951981bcfa5c506ad8ce745aa8831980rbb */
11e076839c8d5a82d55e710194d0daac51390dbdsfAP_DECLARE(int) ap_ind(const char *str, char c); /* Sigh... */
58619148951981bcfa5c506ad8ce745aa8831980rbb
58619148951981bcfa5c506ad8ce745aa8831980rbb/**
742318b93e89c311f66b55f426c4d9cf2c14628bjim * Search a string from right to left for the first occurrence of a
58619148951981bcfa5c506ad8ce745aa8831980rbb * specific character
58619148951981bcfa5c506ad8ce745aa8831980rbb * @param str The string to search
58619148951981bcfa5c506ad8ce745aa8831980rbb * @param c The character to search for
58619148951981bcfa5c506ad8ce745aa8831980rbb * @return The index of the first occurrence of c in str
58619148951981bcfa5c506ad8ce745aa8831980rbb */
aecb17a45c6d3ee4729ed5f68dc4270f211ee7a8fieldingAP_DECLARE(int) ap_rind(const char *str, char c);
2d2eda71267231c2526be701fe655db125852c1ffielding
58619148951981bcfa5c506ad8ce745aa8831980rbb/**
c779aea0c9b7c47c2e4fd258e3f54835a849625dpoirier * Given a string, replace any bare &quot; with \\&quot; .
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param p The pool to allocate memory from
c779aea0c9b7c47c2e4fd258e3f54835a849625dpoirier * @param instring The string to search for &quot;
742318b93e89c311f66b55f426c4d9cf2c14628bjim * @return A copy of the string with escaped quotes
174594c7abbf8cf2fc8095809b4a43cf959c2ef5minfrin * @deprecated Replaced by apr_pescape_echo() in APR
58619148951981bcfa5c506ad8ce745aa8831980rbb */
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(char *) ap_escape_quotes(apr_pool_t *p, const char *instring);
2d2eda71267231c2526be701fe655db125852c1ffielding
783334f576bfb7ef44623faf7af44a65cf13b9b4jim/**
783334f576bfb7ef44623faf7af44a65cf13b9b4jim * Given a string, append the PID deliminated by delim.
783334f576bfb7ef44623faf7af44a65cf13b9b4jim * Usually used to create a pid-appended filepath name
783334f576bfb7ef44623faf7af44a65cf13b9b4jim * (eg: /a/b/foo -> /a/b/foo.6726). A function, and not
783334f576bfb7ef44623faf7af44a65cf13b9b4jim * a macro, to avoid unistd.h dependency
783334f576bfb7ef44623faf7af44a65cf13b9b4jim * @param p The pool to allocate memory from
783334f576bfb7ef44623faf7af44a65cf13b9b4jim * @param string The string to append the PID to
783334f576bfb7ef44623faf7af44a65cf13b9b4jim * @param delim The string to use to deliminate the string from the PID
742318b93e89c311f66b55f426c4d9cf2c14628bjim * @return A copy of the string with the PID appended
783334f576bfb7ef44623faf7af44a65cf13b9b4jim */
783334f576bfb7ef44623faf7af44a65cf13b9b4jimAP_DECLARE(char *) ap_append_pid(apr_pool_t *p, const char *string,
783334f576bfb7ef44623faf7af44a65cf13b9b4jim const char *delim);
783334f576bfb7ef44623faf7af44a65cf13b9b4jim
9257af3c6aaeaf201fccb3e3c87cf8c41783fdb7rpluem/**
9257af3c6aaeaf201fccb3e3c87cf8c41783fdb7rpluem * Parse a given timeout parameter string into an apr_interval_time_t value.
9257af3c6aaeaf201fccb3e3c87cf8c41783fdb7rpluem * The unit of the time interval is given as postfix string to the numeric
9257af3c6aaeaf201fccb3e3c87cf8c41783fdb7rpluem * string. Currently the following units are understood:
9257af3c6aaeaf201fccb3e3c87cf8c41783fdb7rpluem *
9257af3c6aaeaf201fccb3e3c87cf8c41783fdb7rpluem * ms : milliseconds
9257af3c6aaeaf201fccb3e3c87cf8c41783fdb7rpluem * s : seconds
9257af3c6aaeaf201fccb3e3c87cf8c41783fdb7rpluem * mi[n] : minutes
9257af3c6aaeaf201fccb3e3c87cf8c41783fdb7rpluem * h : hours
9257af3c6aaeaf201fccb3e3c87cf8c41783fdb7rpluem *
9257af3c6aaeaf201fccb3e3c87cf8c41783fdb7rpluem * If no unit is contained in the given timeout parameter the default_time_unit
9257af3c6aaeaf201fccb3e3c87cf8c41783fdb7rpluem * will be used instead.
9257af3c6aaeaf201fccb3e3c87cf8c41783fdb7rpluem * @param timeout_parameter The string containing the timeout parameter.
9257af3c6aaeaf201fccb3e3c87cf8c41783fdb7rpluem * @param timeout The timeout value to be returned.
9257af3c6aaeaf201fccb3e3c87cf8c41783fdb7rpluem * @param default_time_unit The default time unit to use if none is specified
9257af3c6aaeaf201fccb3e3c87cf8c41783fdb7rpluem * in timeout_parameter.
9257af3c6aaeaf201fccb3e3c87cf8c41783fdb7rpluem * @return Status value indicating whether the parsing was successful or not.
9257af3c6aaeaf201fccb3e3c87cf8c41783fdb7rpluem */
9257af3c6aaeaf201fccb3e3c87cf8c41783fdb7rpluemAP_DECLARE(apr_status_t) ap_timeout_parameter_parse(
9257af3c6aaeaf201fccb3e3c87cf8c41783fdb7rpluem const char *timeout_parameter,
9257af3c6aaeaf201fccb3e3c87cf8c41783fdb7rpluem apr_interval_time_t *timeout,
9257af3c6aaeaf201fccb3e3c87cf8c41783fdb7rpluem const char *default_time_unit);
9257af3c6aaeaf201fccb3e3c87cf8c41783fdb7rpluem
7c66a25db06001672e6ec5485b69bc7f3c342753jim/**
7c66a25db06001672e6ec5485b69bc7f3c342753jim * Determine if a request has a request body or not.
7c66a25db06001672e6ec5485b69bc7f3c342753jim *
7c66a25db06001672e6ec5485b69bc7f3c342753jim * @param r the request_rec of the request
7c66a25db06001672e6ec5485b69bc7f3c342753jim * @return truth value
7c66a25db06001672e6ec5485b69bc7f3c342753jim */
7c66a25db06001672e6ec5485b69bc7f3c342753jimAP_DECLARE(int) ap_request_has_body(request_rec *r);
742318b93e89c311f66b55f426c4d9cf2c14628bjim
b8055f3cb7e560830169cd1117a47b86abae41b4jim/**
dac0f846350698d2a3e65c814daf82721bafc502jim * Cleanup a string (mainly to be filesystem safe)
dac0f846350698d2a3e65c814daf82721bafc502jim * We only allow '_' and alphanumeric chars. Non-printable
b8055f3cb7e560830169cd1117a47b86abae41b4jim * map to 'x' and all others map to '_'
b8055f3cb7e560830169cd1117a47b86abae41b4jim *
b8055f3cb7e560830169cd1117a47b86abae41b4jim * @param p pool to use to allocate dest
b8055f3cb7e560830169cd1117a47b86abae41b4jim * @param src string to clean up
b8055f3cb7e560830169cd1117a47b86abae41b4jim * @param dest cleaned up, allocated string
b8055f3cb7e560830169cd1117a47b86abae41b4jim * @return Status value indicating whether the cleaning was successful or not.
b8055f3cb7e560830169cd1117a47b86abae41b4jim */
8689050b83e255d70c85e89a9990afa6514a10ebsfAP_DECLARE(apr_status_t) ap_pstr2_alnum(apr_pool_t *p, const char *src,
8689050b83e255d70c85e89a9990afa6514a10ebsf const char **dest);
b8055f3cb7e560830169cd1117a47b86abae41b4jim
b8055f3cb7e560830169cd1117a47b86abae41b4jim/**
dac0f846350698d2a3e65c814daf82721bafc502jim * Cleanup a string (mainly to be filesystem safe)
dac0f846350698d2a3e65c814daf82721bafc502jim * We only allow '_' and alphanumeric chars. Non-printable
b8055f3cb7e560830169cd1117a47b86abae41b4jim * map to 'x' and all others map to '_'
b8055f3cb7e560830169cd1117a47b86abae41b4jim *
b8055f3cb7e560830169cd1117a47b86abae41b4jim * @param src string to clean up
b8055f3cb7e560830169cd1117a47b86abae41b4jim * @param dest cleaned up, pre-allocated string
b8055f3cb7e560830169cd1117a47b86abae41b4jim * @return Status value indicating whether the cleaning was successful or not.
b8055f3cb7e560830169cd1117a47b86abae41b4jim */
dac0f846350698d2a3e65c814daf82721bafc502jimAP_DECLARE(apr_status_t) ap_str2_alnum(const char *src, char *dest);
b8055f3cb7e560830169cd1117a47b86abae41b4jim
29ecbd9db1622e74964264d078336f7604d65093jim/**
29ecbd9db1622e74964264d078336f7604d65093jim * Structure to store the contents of an HTTP form of the type
29ecbd9db1622e74964264d078336f7604d65093jim * application/x-www-form-urlencoded.
742318b93e89c311f66b55f426c4d9cf2c14628bjim *
29ecbd9db1622e74964264d078336f7604d65093jim * Currently it contains the name as a char* of maximum length
29ecbd9db1622e74964264d078336f7604d65093jim * HUGE_STRING_LEN, and a value in the form of a bucket brigade
29ecbd9db1622e74964264d078336f7604d65093jim * of arbitrary length.
29ecbd9db1622e74964264d078336f7604d65093jim */
29ecbd9db1622e74964264d078336f7604d65093jimtypedef struct {
29ecbd9db1622e74964264d078336f7604d65093jim const char *name;
29ecbd9db1622e74964264d078336f7604d65093jim apr_bucket_brigade *value;
29ecbd9db1622e74964264d078336f7604d65093jim} ap_form_pair_t;
29ecbd9db1622e74964264d078336f7604d65093jim
29ecbd9db1622e74964264d078336f7604d65093jim/**
29ecbd9db1622e74964264d078336f7604d65093jim * Read the body and parse any form found, which must be of the
29ecbd9db1622e74964264d078336f7604d65093jim * type application/x-www-form-urlencoded.
29ecbd9db1622e74964264d078336f7604d65093jim * @param r request containing POSTed form data
29ecbd9db1622e74964264d078336f7604d65093jim * @param f filter
29ecbd9db1622e74964264d078336f7604d65093jim * @param ptr returned array of ap_form_pair_t
29ecbd9db1622e74964264d078336f7604d65093jim * @param num max num of params or -1 for unlimited
29ecbd9db1622e74964264d078336f7604d65093jim * @param size max size allowed for parsed data
29ecbd9db1622e74964264d078336f7604d65093jim * @return OK or HTTP error
29ecbd9db1622e74964264d078336f7604d65093jim */
29ecbd9db1622e74964264d078336f7604d65093jimAP_DECLARE(int) ap_parse_form_data(request_rec *r, struct ap_filter_t *f,
11e076839c8d5a82d55e710194d0daac51390dbdsf apr_array_header_t **ptr,
29ecbd9db1622e74964264d078336f7604d65093jim apr_size_t num, apr_size_t size);
29ecbd9db1622e74964264d078336f7604d65093jim
2d2eda71267231c2526be701fe655db125852c1ffielding/* Misc system hackery */
58619148951981bcfa5c506ad8ce745aa8831980rbb/**
58619148951981bcfa5c506ad8ce745aa8831980rbb * Given the name of an object in the file system determine if it is a directory
742318b93e89c311f66b55f426c4d9cf2c14628bjim * @param p The pool to allocate from
58619148951981bcfa5c506ad8ce745aa8831980rbb * @param name The name of the object to check
58619148951981bcfa5c506ad8ce745aa8831980rbb * @return 1 if it is a directory, 0 otherwise
30c095035b1d5910cc239a1384c816aef228beb5jim */
47ab8dcf8ad581569376f2e04ef16bc785bb122aakeAP_DECLARE(int) ap_is_rdirectory(apr_pool_t *p, const char *name);
7c7372abe2484e7fcf81937b93496d1246e5b816gstein
30c095035b1d5910cc239a1384c816aef228beb5jim/**
30c095035b1d5910cc239a1384c816aef228beb5jim * Given the name of an object in the file system determine if it is a directory - this version is symlink aware
742318b93e89c311f66b55f426c4d9cf2c14628bjim * @param p The pool to allocate from
30c095035b1d5910cc239a1384c816aef228beb5jim * @param name The name of the object to check
30c095035b1d5910cc239a1384c816aef228beb5jim * @return 1 if it is a directory, 0 otherwise
58619148951981bcfa5c506ad8ce745aa8831980rbb */
47ab8dcf8ad581569376f2e04ef16bc785bb122aakeAP_DECLARE(int) ap_is_directory(apr_pool_t *p, const char *name);
2d2eda71267231c2526be701fe655db125852c1ffielding
2d2eda71267231c2526be701fe655db125852c1ffielding#ifdef _OSD_POSIX
2d2eda71267231c2526be701fe655db125852c1ffieldingextern int os_init_job_environment(server_rec *s, const char *user_name, int one_process);
2d2eda71267231c2526be701fe655db125852c1ffielding#endif /* _OSD_POSIX */
2d2eda71267231c2526be701fe655db125852c1ffielding
58619148951981bcfa5c506ad8ce745aa8831980rbb/**
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * Determine the local host name for the current machine
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben * @param p The pool to allocate from
58619148951981bcfa5c506ad8ce745aa8831980rbb * @return A copy of the local host name
c861a36fe9c9a78c4fcb97e29fc1099a5ea81173rbb */
58619148951981bcfa5c506ad8ce745aa8831980rbbchar *ap_get_local_host(apr_pool_t *p);
2d2eda71267231c2526be701fe655db125852c1ffielding
58619148951981bcfa5c506ad8ce745aa8831980rbb/**
58619148951981bcfa5c506ad8ce745aa8831980rbb * Log an assertion to the error log
58619148951981bcfa5c506ad8ce745aa8831980rbb * @param szExp The assertion that failed
58619148951981bcfa5c506ad8ce745aa8831980rbb * @param szFile The file the assertion is in
58619148951981bcfa5c506ad8ce745aa8831980rbb * @param nLine The line the assertion is defined on
58619148951981bcfa5c506ad8ce745aa8831980rbb */
3d96ee83babeec32482c9082c9426340cee8c44dwroweAP_DECLARE(void) ap_log_assert(const char *szExp, const char *szFile, int nLine)
11e076839c8d5a82d55e710194d0daac51390dbdsf __attribute__((noreturn));
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh
742318b93e89c311f66b55f426c4d9cf2c14628bjim/**
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @internal Internal Assert function
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh */
2d2eda71267231c2526be701fe655db125852c1ffielding#define ap_assert(exp) ((exp) ? (void)0 : ap_log_assert(#exp,__FILE__,__LINE__))
2d2eda71267231c2526be701fe655db125852c1ffielding
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/**
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh * Redefine assert() to something more useful for an Apache...
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh *
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh * Use ap_assert() if the condition should always be checked.
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh * Use AP_DEBUG_ASSERT() if the condition should only be checked when AP_DEBUG
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh * is defined.
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh */
0186cb43574836fc95a0506456210c94cfc3ea6ftrawick#ifdef AP_DEBUG
6e70165f24ec2e664764a9402e358eb0f6e99a3dtrawick#define AP_DEBUG_ASSERT(exp) ap_assert(exp)
0186cb43574836fc95a0506456210c94cfc3ea6ftrawick#else
6e70165f24ec2e664764a9402e358eb0f6e99a3dtrawick#define AP_DEBUG_ASSERT(exp) ((void)0)
0186cb43574836fc95a0506456210c94cfc3ea6ftrawick#endif
0186cb43574836fc95a0506456210c94cfc3ea6ftrawick
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/**
6dee1d79cfcd3174e4ddbbafc0994f5acbde893ftrawick * @defgroup stopsignal Flags which indicate places where the server should stop for debugging.
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh * @{
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh * A set of flags which indicate places where the server should raise(SIGSTOP).
2d2eda71267231c2526be701fe655db125852c1ffielding * This is useful for debugging, because you can then attach to that process
2d2eda71267231c2526be701fe655db125852c1ffielding * with gdb and continue. This is important in cases where one_process
2d2eda71267231c2526be701fe655db125852c1ffielding * debugging isn't possible.
2d2eda71267231c2526be701fe655db125852c1ffielding */
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** stop on a Detach */
11e076839c8d5a82d55e710194d0daac51390dbdsf#define SIGSTOP_DETACH 1
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** stop making a child process */
11e076839c8d5a82d55e710194d0daac51390dbdsf#define SIGSTOP_MAKE_CHILD 2
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** stop spawning a child process */
11e076839c8d5a82d55e710194d0daac51390dbdsf#define SIGSTOP_SPAWN_CHILD 4
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** stop spawning a child process with a piped log */
11e076839c8d5a82d55e710194d0daac51390dbdsf#define SIGSTOP_PIPED_LOG_SPAWN 8
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** stop spawning a CGI child process */
11e076839c8d5a82d55e710194d0daac51390dbdsf#define SIGSTOP_CGI_CHILD 16
2d2eda71267231c2526be701fe655db125852c1ffielding
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** Macro to get GDB started */
2d2eda71267231c2526be701fe655db125852c1ffielding#ifdef DEBUG_SIGSTOP
2d2eda71267231c2526be701fe655db125852c1ffieldingextern int raise_sigstop_flags;
11e076839c8d5a82d55e710194d0daac51390dbdsf#define RAISE_SIGSTOP(x) do { \
11e076839c8d5a82d55e710194d0daac51390dbdsf if (raise_sigstop_flags & SIGSTOP_##x) raise(SIGSTOP);\
2d2eda71267231c2526be701fe655db125852c1ffielding } while (0)
2d2eda71267231c2526be701fe655db125852c1ffielding#else
2d2eda71267231c2526be701fe655db125852c1ffielding#define RAISE_SIGSTOP(x)
2d2eda71267231c2526be701fe655db125852c1ffielding#endif
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** @} */
9f9307bbe539dbcf96919715315eb64ce3465f5bben/**
9f9307bbe539dbcf96919715315eb64ce3465f5bben * Get HTML describing the address and (optionally) admin of the server.
9f9307bbe539dbcf96919715315eb64ce3465f5bben * @param prefix Text which is prepended to the return value
9f9307bbe539dbcf96919715315eb64ce3465f5bben * @param r The request_rec
9f9307bbe539dbcf96919715315eb64ce3465f5bben * @return HTML describing the server, allocated in @a r's pool.
9f9307bbe539dbcf96919715315eb64ce3465f5bben */
6a2bd1d848ec0984e2e675b8bb88cef8768d4a32bjhAP_DECLARE(const char *) ap_psignature(const char *prefix, request_rec *r);
2d2eda71267231c2526be701fe655db125852c1ffielding
0e6e93183d91142d7cf9ffbf502114ff77bd9e19ben /* The C library has functions that allow const to be silently dropped ...
0e6e93183d91142d7cf9ffbf502114ff77bd9e19ben these macros detect the drop in maintainer mode, but use the native
9521cafc02c2caafc8f9594006994ed1f62540a4dreid methods for normal builds
18173b5033350759b5aa4f6d9a4fd9e12d440135trawick
742318b93e89c311f66b55f426c4d9cf2c14628bjim Note that on some platforms (e.g., AIX with gcc, Solaris with gcc), string.h needs
18173b5033350759b5aa4f6d9a4fd9e12d440135trawick to be included before the macros are defined or compilation will fail.
0e6e93183d91142d7cf9ffbf502114ff77bd9e19ben */
18173b5033350759b5aa4f6d9a4fd9e12d440135trawick#include <string.h>
18173b5033350759b5aa4f6d9a4fd9e12d440135trawick
84ba82304285b4bb1aafd5c6cdada5ce74c29973strikerAP_DECLARE(char *) ap_strchr(char *s, int c);
84ba82304285b4bb1aafd5c6cdada5ce74c29973strikerAP_DECLARE(const char *) ap_strchr_c(const char *s, int c);
84ba82304285b4bb1aafd5c6cdada5ce74c29973strikerAP_DECLARE(char *) ap_strrchr(char *s, int c);
84ba82304285b4bb1aafd5c6cdada5ce74c29973strikerAP_DECLARE(const char *) ap_strrchr_c(const char *s, int c);
84ba82304285b4bb1aafd5c6cdada5ce74c29973strikerAP_DECLARE(char *) ap_strstr(char *s, const char *c);
84ba82304285b4bb1aafd5c6cdada5ce74c29973strikerAP_DECLARE(const char *) ap_strstr_c(const char *s, const char *c);
6bb524f1895f30265a1431afc460977d391cb36bsfAP_DECLARE(void *) ap_palloc_debug(apr_pool_t *p, apr_size_t size);
6bb524f1895f30265a1431afc460977d391cb36bsfAP_DECLARE(void *) ap_pcalloc_debug(apr_pool_t *p, apr_size_t size);
84ba82304285b4bb1aafd5c6cdada5ce74c29973striker
0e6e93183d91142d7cf9ffbf502114ff77bd9e19ben#ifdef AP_DEBUG
0e6e93183d91142d7cf9ffbf502114ff77bd9e19ben
5f7c351eb2a69d8cef6c3e98e27ce6158a0b1780rbb#undef strchr
13ac66e9c773fd63bf3c5e33a8de956df3feaf5dfuankg# define strchr(s, c) ap_strchr(s,c)
5f7c351eb2a69d8cef6c3e98e27ce6158a0b1780rbb#undef strrchr
13ac66e9c773fd63bf3c5e33a8de956df3feaf5dfuankg# define strrchr(s, c) ap_strrchr(s,c)
dca927eafb338b9de9d0214818136c16d436e3fdrbb#undef strstr
dca927eafb338b9de9d0214818136c16d436e3fdrbb# define strstr(s, c) ap_strstr(s,c)
0e6e93183d91142d7cf9ffbf502114ff77bd9e19ben
28b0137157301f3b03148e7b8b3b7f9a2c3423adsf#if !defined(AP_DEBUG_NO_ALLOC_POISON) && !APR_POOL_DEBUG
6bb524f1895f30265a1431afc460977d391cb36bsf/*
6bb524f1895f30265a1431afc460977d391cb36bsf * ap_palloc_debug initializes allocated memory to non-zero
6bb524f1895f30265a1431afc460977d391cb36bsf */
6bb524f1895f30265a1431afc460977d391cb36bsf#define apr_palloc ap_palloc_debug
6bb524f1895f30265a1431afc460977d391cb36bsf/*
6bb524f1895f30265a1431afc460977d391cb36bsf * this is necessary to avoid useless double memset of memory
6bb524f1895f30265a1431afc460977d391cb36bsf * with ap_palloc_debug
6bb524f1895f30265a1431afc460977d391cb36bsf */
6bb524f1895f30265a1431afc460977d391cb36bsf#ifdef apr_pcalloc
6bb524f1895f30265a1431afc460977d391cb36bsf#undef apr_pcalloc
6bb524f1895f30265a1431afc460977d391cb36bsf#endif
6bb524f1895f30265a1431afc460977d391cb36bsf#define apr_pcalloc ap_pcalloc_debug
6bb524f1895f30265a1431afc460977d391cb36bsf#endif
6bb524f1895f30265a1431afc460977d391cb36bsf
0e6e93183d91142d7cf9ffbf502114ff77bd9e19ben#else
0e6e93183d91142d7cf9ffbf502114ff77bd9e19ben
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** use this instead of strchr */
13ac66e9c773fd63bf3c5e33a8de956df3feaf5dfuankg# define ap_strchr(s, c) strchr(s, c)
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** use this instead of strchr */
13ac66e9c773fd63bf3c5e33a8de956df3feaf5dfuankg# define ap_strchr_c(s, c) strchr(s, c)
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** use this instead of strrchr */
13ac66e9c773fd63bf3c5e33a8de956df3feaf5dfuankg# define ap_strrchr(s, c) strrchr(s, c)
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** use this instead of strrchr */
13ac66e9c773fd63bf3c5e33a8de956df3feaf5dfuankg# define ap_strrchr_c(s, c) strrchr(s, c)
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** use this instead of strrstr*/
13ac66e9c773fd63bf3c5e33a8de956df3feaf5dfuankg# define ap_strstr(s, c) strstr(s, c)
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh/** use this instead of strrstr*/
13ac66e9c773fd63bf3c5e33a8de956df3feaf5dfuankg# define ap_strstr_c(s, c) strstr(s, c)
0e6e93183d91142d7cf9ffbf502114ff77bd9e19ben
0e6e93183d91142d7cf9ffbf502114ff77bd9e19ben#endif
0a09a4a642f7c0d367598394411dbdd4a6d8cd09fielding
7bf4eb9638a127fbfbc402d2c0e4ec0085934cf0sf/**
7bf4eb9638a127fbfbc402d2c0e4ec0085934cf0sf * Generate pseudo random bytes.
7bf4eb9638a127fbfbc402d2c0e4ec0085934cf0sf * This is a convenience interface to apr_random. It is cheaper but less
7bf4eb9638a127fbfbc402d2c0e4ec0085934cf0sf * secure than apr_generate_random_bytes().
7bf4eb9638a127fbfbc402d2c0e4ec0085934cf0sf * @param buf where to store the bytes
7bf4eb9638a127fbfbc402d2c0e4ec0085934cf0sf * @param size number of bytes to generate
7bf4eb9638a127fbfbc402d2c0e4ec0085934cf0sf * @note ap_random_insecure_bytes() is thread-safe, it uses a mutex on
7bf4eb9638a127fbfbc402d2c0e4ec0085934cf0sf * threaded MPMs.
7bf4eb9638a127fbfbc402d2c0e4ec0085934cf0sf */
db68899293b375438612f0aca6b1afecbc38cdd6sfAP_DECLARE(void) ap_random_insecure_bytes(void *buf, apr_size_t size);
7bf4eb9638a127fbfbc402d2c0e4ec0085934cf0sf
7bf4eb9638a127fbfbc402d2c0e4ec0085934cf0sf/**
7bf4eb9638a127fbfbc402d2c0e4ec0085934cf0sf * Get a pseudo random number in a range.
7bf4eb9638a127fbfbc402d2c0e4ec0085934cf0sf * @param min low end of range
7bf4eb9638a127fbfbc402d2c0e4ec0085934cf0sf * @param max high end of range
7bf4eb9638a127fbfbc402d2c0e4ec0085934cf0sf * @return a number in the range
7bf4eb9638a127fbfbc402d2c0e4ec0085934cf0sf */
db68899293b375438612f0aca6b1afecbc38cdd6sfAP_DECLARE(apr_uint32_t) ap_random_pick(apr_uint32_t min, apr_uint32_t max);
7bf4eb9638a127fbfbc402d2c0e4ec0085934cf0sf
3a59bb90be3bc6246632384c3d885b875ae507d5sf/**
3a59bb90be3bc6246632384c3d885b875ae507d5sf * Abort with a error message signifying out of memory
3a59bb90be3bc6246632384c3d885b875ae507d5sf */
3a59bb90be3bc6246632384c3d885b875ae507d5sfAP_DECLARE(void) ap_abort_on_oom(void) __attribute__((noreturn));
3a59bb90be3bc6246632384c3d885b875ae507d5sf
3a59bb90be3bc6246632384c3d885b875ae507d5sf/**
3a59bb90be3bc6246632384c3d885b875ae507d5sf * Wrapper for malloc() that calls ap_abort_on_oom() if out of memory
3a59bb90be3bc6246632384c3d885b875ae507d5sf * @param size size of the memory block
3a59bb90be3bc6246632384c3d885b875ae507d5sf * @return pointer to the allocated memory
3a59bb90be3bc6246632384c3d885b875ae507d5sf * @note ap_malloc may be implemented as a macro
3a59bb90be3bc6246632384c3d885b875ae507d5sf */
a054609255eb3b10ed30e5471b18ea0e7d5f735esfAP_DECLARE(void *) ap_malloc(size_t size)
a054609255eb3b10ed30e5471b18ea0e7d5f735esf __attribute__((malloc))
a054609255eb3b10ed30e5471b18ea0e7d5f735esf AP_FN_ATTR_ALLOC_SIZE(1);
3a59bb90be3bc6246632384c3d885b875ae507d5sf
3a59bb90be3bc6246632384c3d885b875ae507d5sf/**
3a59bb90be3bc6246632384c3d885b875ae507d5sf * Wrapper for calloc() that calls ap_abort_on_oom() if out of memory
3a59bb90be3bc6246632384c3d885b875ae507d5sf * @param nelem number of elements to allocate memory for
3a59bb90be3bc6246632384c3d885b875ae507d5sf * @param size size of a single element
3a59bb90be3bc6246632384c3d885b875ae507d5sf * @return pointer to the allocated memory
3a59bb90be3bc6246632384c3d885b875ae507d5sf * @note ap_calloc may be implemented as a macro
3a59bb90be3bc6246632384c3d885b875ae507d5sf */
a054609255eb3b10ed30e5471b18ea0e7d5f735esfAP_DECLARE(void *) ap_calloc(size_t nelem, size_t size)
a054609255eb3b10ed30e5471b18ea0e7d5f735esf __attribute__((malloc))
a054609255eb3b10ed30e5471b18ea0e7d5f735esf AP_FN_ATTR_ALLOC_SIZE2(1,2);
3a59bb90be3bc6246632384c3d885b875ae507d5sf
3a59bb90be3bc6246632384c3d885b875ae507d5sf/**
3a59bb90be3bc6246632384c3d885b875ae507d5sf * Wrapper for realloc() that calls ap_abort_on_oom() if out of memory
3a59bb90be3bc6246632384c3d885b875ae507d5sf * @param ptr pointer to the old memory block (or NULL)
3a59bb90be3bc6246632384c3d885b875ae507d5sf * @param size new size of the memory block
3a59bb90be3bc6246632384c3d885b875ae507d5sf * @return pointer to the reallocated memory
3a59bb90be3bc6246632384c3d885b875ae507d5sf * @note ap_realloc may be implemented as a macro
3a59bb90be3bc6246632384c3d885b875ae507d5sf */
3a59bb90be3bc6246632384c3d885b875ae507d5sfAP_DECLARE(void *) ap_realloc(void *ptr, size_t size)
a054609255eb3b10ed30e5471b18ea0e7d5f735esf AP_FN_ATTR_WARN_UNUSED_RESULT
afad052e4bb49a658c69cad2312ffb50f749d223sf AP_FN_ATTR_ALLOC_SIZE(2);
3a59bb90be3bc6246632384c3d885b875ae507d5sf
89da6eb70c41422a20e5f871dbf5950140d128abjim/**
89da6eb70c41422a20e5f871dbf5950140d128abjim * Get server load params
89da6eb70c41422a20e5f871dbf5950140d128abjim * @param ld struct to populate: -1 in fields means error
89da6eb70c41422a20e5f871dbf5950140d128abjim */
dfe5322f3c2ada80a08e7acecd0bd47a249f530csfAP_DECLARE(void) ap_get_sload(ap_sload_t *ld)
dfe5322f3c2ada80a08e7acecd0bd47a249f530csf AP_FN_ATTR_NONNULL_ALL;
7bf4eb9638a127fbfbc402d2c0e4ec0085934cf0sf
83df3fbb3f37cf5337c8793b4559392a672e0696jim/**
83df3fbb3f37cf5337c8793b4559392a672e0696jim * Get server load averages (ala getloadavg)
83df3fbb3f37cf5337c8793b4559392a672e0696jim * @param ld struct to populate: -1 in fields means error
83df3fbb3f37cf5337c8793b4559392a672e0696jim */
dfe5322f3c2ada80a08e7acecd0bd47a249f530csfAP_DECLARE(void) ap_get_loadavg(ap_loadavg_t *ld)
dfe5322f3c2ada80a08e7acecd0bd47a249f530csf AP_FN_ATTR_NONNULL_ALL;
83df3fbb3f37cf5337c8793b4559392a672e0696jim
5b89dd41cdd1eb736fec0d120d68f71e9503caf6sf/**
5b89dd41cdd1eb736fec0d120d68f71e9503caf6sf * Convert binary data into a hex string
5b89dd41cdd1eb736fec0d120d68f71e9503caf6sf * @param src pointer to the data
5b89dd41cdd1eb736fec0d120d68f71e9503caf6sf * @param srclen length of the data
5b89dd41cdd1eb736fec0d120d68f71e9503caf6sf * @param dest pointer to buffer of length (2 * srclen + 1). The resulting
5b89dd41cdd1eb736fec0d120d68f71e9503caf6sf * string will be NUL-terminated.
174594c7abbf8cf2fc8095809b4a43cf959c2ef5minfrin * @deprecated Replaced by apr_escape_hex() in APR
5b89dd41cdd1eb736fec0d120d68f71e9503caf6sf */
dfe5322f3c2ada80a08e7acecd0bd47a249f530csfAP_DECLARE(void) ap_bin2hex(const void *src, apr_size_t srclen, char *dest)
dfe5322f3c2ada80a08e7acecd0bd47a249f530csf AP_FN_ATTR_NONNULL_ALL;
83df3fbb3f37cf5337c8793b4559392a672e0696jim
4576c1a9ef54cd1e5555ee07d016a7f559f80338sf/**
4576c1a9ef54cd1e5555ee07d016a7f559f80338sf * Check if string contains a control character
4576c1a9ef54cd1e5555ee07d016a7f559f80338sf * @param str the string to check
4576c1a9ef54cd1e5555ee07d016a7f559f80338sf * @return 1 if yes, 0 if no control characters
4576c1a9ef54cd1e5555ee07d016a7f559f80338sf */
4576c1a9ef54cd1e5555ee07d016a7f559f80338sfAP_DECLARE(int) ap_has_cntrl(const char *str)
4576c1a9ef54cd1e5555ee07d016a7f559f80338sf AP_FN_ATTR_NONNULL_ALL;
4576c1a9ef54cd1e5555ee07d016a7f559f80338sf
eafcc0ebf263d0ba69855b6e10958c4c1a2361bdsf/**
eafcc0ebf263d0ba69855b6e10958c4c1a2361bdsf * Wrapper for @a apr_password_validate() to cache expensive calculations
eafcc0ebf263d0ba69855b6e10958c4c1a2361bdsf * @param r the current request
eafcc0ebf263d0ba69855b6e10958c4c1a2361bdsf * @param username username of the user
eafcc0ebf263d0ba69855b6e10958c4c1a2361bdsf * @param passwd password string
eafcc0ebf263d0ba69855b6e10958c4c1a2361bdsf * @param hash hash string to be passwd to @a apr_password_validate()
eafcc0ebf263d0ba69855b6e10958c4c1a2361bdsf * @return APR_SUCCESS if passwords match, APR_EMISMATCH or error otherwise
eafcc0ebf263d0ba69855b6e10958c4c1a2361bdsf * @note Currently, ap_password_validate() only caches the result of the
eafcc0ebf263d0ba69855b6e10958c4c1a2361bdsf * most recent call with the same connection as @a r.
eafcc0ebf263d0ba69855b6e10958c4c1a2361bdsf * In the future, it may also do rate-limiting against brute-force
eafcc0ebf263d0ba69855b6e10958c4c1a2361bdsf * attacks.
eafcc0ebf263d0ba69855b6e10958c4c1a2361bdsf */
eafcc0ebf263d0ba69855b6e10958c4c1a2361bdsfAP_DECLARE(apr_status_t) ap_password_validate(request_rec *r,
eafcc0ebf263d0ba69855b6e10958c4c1a2361bdsf const char *username,
eafcc0ebf263d0ba69855b6e10958c4c1a2361bdsf const char *passwd,
eafcc0ebf263d0ba69855b6e10958c4c1a2361bdsf const char *hash);
eafcc0ebf263d0ba69855b6e10958c4c1a2361bdsf
02881698c37253936bb9ed43a36a457f3d305115druggeri/**
02881698c37253936bb9ed43a36a457f3d305115druggeri * Short function to execute a command and return the first line of
f0eaa043a2c80e21c1e9eace464378f52c818b7ctrawick * output minus \\r \\n. Useful for "obscuring" passwords via exec calls
02881698c37253936bb9ed43a36a457f3d305115druggeri * @param p the pool to allocate from
02881698c37253936bb9ed43a36a457f3d305115druggeri * @param cmd the command to execute
02881698c37253936bb9ed43a36a457f3d305115druggeri * @param argv the arguments to pass to the cmd
02881698c37253936bb9ed43a36a457f3d305115druggeri * @return ptr to characters or NULL on any error
02881698c37253936bb9ed43a36a457f3d305115druggeri */
02881698c37253936bb9ed43a36a457f3d305115druggeriAP_DECLARE(char *) ap_get_exec_line(apr_pool_t *p,
02881698c37253936bb9ed43a36a457f3d305115druggeri const char *cmd,
02881698c37253936bb9ed43a36a457f3d305115druggeri const char * const *argv);
02881698c37253936bb9ed43a36a457f3d305115druggeri
eafcc0ebf263d0ba69855b6e10958c4c1a2361bdsf
13ac66e9c773fd63bf3c5e33a8de956df3feaf5dfuankg#define AP_NORESTART APR_OS_START_USEERR + 1
55d986c77300fd39420b41f765b08c15b4c6418drbb
2d2eda71267231c2526be701fe655db125852c1ffielding#ifdef __cplusplus
2d2eda71267231c2526be701fe655db125852c1ffielding}
2d2eda71267231c2526be701fe655db125852c1ffielding#endif
2d2eda71267231c2526be701fe655db125852c1ffielding
11e076839c8d5a82d55e710194d0daac51390dbdsf#endif /* !APACHE_HTTPD_H */
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/** @} //APACHE Daemon */
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/** @} //APACHE Core */
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/** @} //APACHE super group */
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh