Blame include/httpd.h

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