Annotation of win32/apache13/src/include/httpd.h, revision 1.1.1.1

1.1       parser      1: /* ====================================================================
                      2:  * Copyright (c) 1995-1999 The Apache Group.  All rights reserved.
                      3:  *
                      4:  * Redistribution and use in source and binary forms, with or without
                      5:  * modification, are permitted provided that the following conditions
                      6:  * are met:
                      7:  *
                      8:  * 1. Redistributions of source code must retain the above copyright
                      9:  *    notice, this list of conditions and the following disclaimer. 
                     10:  *
                     11:  * 2. Redistributions in binary form must reproduce the above copyright
                     12:  *    notice, this list of conditions and the following disclaimer in
                     13:  *    the documentation and/or other materials provided with the
                     14:  *    distribution.
                     15:  *
                     16:  * 3. All advertising materials mentioning features or use of this
                     17:  *    software must display the following acknowledgment:
                     18:  *    "This product includes software developed by the Apache Group
                     19:  *    for use in the Apache HTTP server project (http://www.apache.org/)."
                     20:  *
                     21:  * 4. The names "Apache Server" and "Apache Group" must not be used to
                     22:  *    endorse or promote products derived from this software without
                     23:  *    prior written permission. For written permission, please contact
                     24:  *    apache@apache.org.
                     25:  *
                     26:  * 5. Products derived from this software may not be called "Apache"
                     27:  *    nor may "Apache" appear in their names without prior written
                     28:  *    permission of the Apache Group.
                     29:  *
                     30:  * 6. Redistributions of any form whatsoever must retain the following
                     31:  *    acknowledgment:
                     32:  *    "This product includes software developed by the Apache Group
                     33:  *    for use in the Apache HTTP server project (http://www.apache.org/)."
                     34:  *
                     35:  * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
                     36:  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     37:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
                     38:  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
                     39:  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
                     40:  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
                     41:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
                     42:  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     43:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
                     44:  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
                     45:  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
                     46:  * OF THE POSSIBILITY OF SUCH DAMAGE.
                     47:  * ====================================================================
                     48:  *
                     49:  * This software consists of voluntary contributions made by many
                     50:  * individuals on behalf of the Apache Group and was originally based
                     51:  * on public domain software written at the National Center for
                     52:  * Supercomputing Applications, University of Illinois, Urbana-Champaign.
                     53:  * For more information on the Apache Group and the Apache HTTP server
                     54:  * project, please see <http://www.apache.org/>.
                     55:  *
                     56:  */
                     57: 
                     58: #ifndef APACHE_HTTPD_H
                     59: #define APACHE_HTTPD_H
                     60: 
                     61: #ifdef __cplusplus
                     62: extern "C" {
                     63: #endif
                     64: 
                     65: /*
                     66:  * httpd.h: header for simple (ha! not anymore) http daemon
                     67:  */
                     68: 
                     69: /* Headers in which EVERYONE has an interest... */
                     70: 
                     71: #include "ap_config.h"
                     72: #include "ap_alloc.h"
                     73: #include "buff.h"
                     74: #include "ap.h"
                     75: 
                     76: /* ----------------------------- config dir ------------------------------ */
                     77: 
                     78: /* Define this to be the default server home dir. Most things later in this
                     79:  * file with a relative pathname will have this added.
                     80:  */
                     81: #ifndef HTTPD_ROOT
                     82: #ifdef OS2
                     83: /* Set default for OS/2 file system */
                     84: #define HTTPD_ROOT "/os2httpd"
                     85: #elif defined(WIN32)
                     86: /* Set default for Windows file system */
                     87: #define HTTPD_ROOT "/apache"
                     88: #elif defined(BEOS)
                     89: #define HTTPD_ROOT "/boot/home/apache"
                     90: #elif defined(NETWARE)
                     91: #define HTTPD_ROOT "sys:/apache"
                     92: #else
                     93: #define HTTPD_ROOT "/usr/local/apache"
                     94: #endif
                     95: #endif /* HTTPD_ROOT */
                     96: 
                     97: /* Default location of documents.  Can be overridden by the DocumentRoot
                     98:  * directive.
                     99:  */
                    100: #ifndef DOCUMENT_LOCATION
                    101: #ifdef OS2
                    102: /* Set default for OS/2 file system */
                    103: #define DOCUMENT_LOCATION  HTTPD_ROOT "/docs"
                    104: #else
                    105: #define DOCUMENT_LOCATION  HTTPD_ROOT "/htdocs"
                    106: #endif
                    107: #endif /* DOCUMENT_LOCATION */
                    108: 
                    109: /* Max. number of dynamically loaded modules */
                    110: #ifndef DYNAMIC_MODULE_LIMIT
                    111: #define DYNAMIC_MODULE_LIMIT 64
                    112: #endif
                    113: 
                    114: /* Default administrator's address */
                    115: #define DEFAULT_ADMIN "[no address given]"
                    116: 
                    117: /* The target name of the installed Apache */
                    118: #ifndef TARGET
                    119: #define TARGET "httpd"
                    120: #endif
                    121: 
                    122: /* 
                    123:  * --------- You shouldn't have to edit anything below this line ----------
                    124:  *
                    125:  * Any modifications to any defaults not defined above should be done in the 
                    126:  * respective config. file. 
                    127:  *
                    128:  */
                    129: 
                    130: 
                    131: /* -- Internal representation for a HTTP protocol number, e.g., HTTP/1.1 -- */
                    132: 
                    133: #define HTTP_VERSION(major,minor) (1000*(major)+(minor))
                    134: #define HTTP_VERSION_MAJOR(number) ((number)/1000)
                    135: #define HTTP_VERSION_MINOR(number) ((number)%1000)
                    136: 
                    137: 
                    138: /* -------------- Port number for server running standalone --------------- */
                    139: 
                    140: #define DEFAULT_HTTP_PORT      80
                    141: #define DEFAULT_HTTPS_PORT     443
                    142: #define ap_is_default_port(port,r)     ((port) == ap_default_port(r))
                    143: #define ap_http_method(r)      "http"
                    144: #define ap_default_port(r)     DEFAULT_HTTP_PORT
                    145: 
                    146: /* --------- Default user name and group name running standalone ---------- */
                    147: /* --- These may be specified as numbers by placing a # before a number --- */
                    148: 
                    149: #ifndef DEFAULT_USER
                    150: #define DEFAULT_USER "#-1"
                    151: #endif
                    152: #ifndef DEFAULT_GROUP
                    153: #define DEFAULT_GROUP "#-1"
                    154: #endif
                    155: 
                    156: /* The name of the log files */
                    157: #ifndef DEFAULT_XFERLOG
                    158: #if defined(OS2) || defined(WIN32)
                    159: #define DEFAULT_XFERLOG "logs/access.log"
                    160: #else
                    161: #define DEFAULT_XFERLOG "logs/access_log"
                    162: #endif
                    163: #endif /* DEFAULT_XFERLOG */
                    164: 
                    165: #ifndef DEFAULT_ERRORLOG
                    166: #if defined(OS2) || defined(WIN32)
                    167: #define DEFAULT_ERRORLOG "logs/error.log"
                    168: #else
                    169: #define DEFAULT_ERRORLOG "logs/error_log"
                    170: #endif
                    171: #endif /* DEFAULT_ERRORLOG */
                    172: 
                    173: #ifndef DEFAULT_PIDLOG
                    174: #define DEFAULT_PIDLOG "logs/httpd.pid"
                    175: #endif
                    176: #ifndef DEFAULT_SCOREBOARD
                    177: #define DEFAULT_SCOREBOARD "logs/apache_runtime_status"
                    178: #endif
                    179: #ifndef DEFAULT_LOCKFILE
                    180: #define DEFAULT_LOCKFILE "logs/accept.lock"
                    181: #endif
                    182: 
                    183: /* Define this to be what your HTML directory content files are called */
                    184: #ifndef DEFAULT_INDEX
                    185: #define DEFAULT_INDEX "index.html"
                    186: #endif
                    187: 
                    188: /* Define this to 1 if you want fancy indexing, 0 otherwise */
                    189: #ifndef DEFAULT_INDEXING
                    190: #define DEFAULT_INDEXING 0
                    191: #endif
                    192: 
                    193: /* Define this to be what type you'd like returned for files with unknown */
                    194: /* suffixes.  MUST be all lower case. */
                    195: #ifndef DEFAULT_CONTENT_TYPE
                    196: #define DEFAULT_CONTENT_TYPE "text/plain"
                    197: #endif
                    198: 
                    199: /* Define this to be what your per-directory security files are called */
                    200: #ifndef DEFAULT_ACCESS_FNAME
                    201: #ifdef OS2
                    202: /* Set default for OS/2 file system */
                    203: #define DEFAULT_ACCESS_FNAME "htaccess"
                    204: #else
                    205: #define DEFAULT_ACCESS_FNAME ".htaccess"
                    206: #endif
                    207: #endif /* DEFAULT_ACCESS_FNAME */
                    208: 
                    209: /* The name of the server config file */
                    210: #ifndef SERVER_CONFIG_FILE
                    211: #define SERVER_CONFIG_FILE "conf/httpd.conf"
                    212: #endif
                    213: 
                    214: /* The name of the document config file */
                    215: #ifndef RESOURCE_CONFIG_FILE
                    216: #define RESOURCE_CONFIG_FILE "conf/srm.conf"
                    217: #endif
                    218: 
                    219: /* The name of the MIME types file */
                    220: #ifndef TYPES_CONFIG_FILE
                    221: #define TYPES_CONFIG_FILE "conf/mime.types"
                    222: #endif
                    223: 
                    224: /* The name of the access file */
                    225: #ifndef ACCESS_CONFIG_FILE
                    226: #define ACCESS_CONFIG_FILE "conf/access.conf"
                    227: #endif
                    228: 
                    229: /* Whether we should enable rfc1413 identity checking */
                    230: #ifndef DEFAULT_RFC1413
                    231: #define DEFAULT_RFC1413 0
                    232: #endif
                    233: /* The default directory in user's home dir */
                    234: #ifndef DEFAULT_USER_DIR
                    235: #define DEFAULT_USER_DIR "public_html"
                    236: #endif
                    237: 
                    238: /* The default path for CGI scripts if none is currently set */
                    239: #ifndef DEFAULT_PATH
                    240: #define DEFAULT_PATH "/bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin"
                    241: #endif
                    242: 
                    243: /* The path to the shell interpreter, for parsed docs */
                    244: #ifndef SHELL_PATH
                    245: #if defined(OS2) || defined(WIN32)
                    246: /* Set default for OS/2 and Windows file system */
                    247: #define SHELL_PATH "CMD.EXE"
                    248: #else
                    249: #define SHELL_PATH "/bin/sh"
                    250: #endif
                    251: #endif /* SHELL_PATH */
                    252: 
                    253: /* The path to the suExec wrapper, can be overridden in Configuration */
                    254: #ifndef SUEXEC_BIN
                    255: #define SUEXEC_BIN  HTTPD_ROOT "/bin/suexec"
                    256: #endif
                    257: 
                    258: /* The default string lengths */
                    259: #define MAX_STRING_LEN HUGE_STRING_LEN
                    260: #define HUGE_STRING_LEN 8192
                    261: 
                    262: /* The timeout for waiting for messages */
                    263: #ifndef DEFAULT_TIMEOUT
                    264: #define DEFAULT_TIMEOUT 300
                    265: #endif
                    266: 
                    267: /* The timeout for waiting for keepalive timeout until next request */
                    268: #ifndef DEFAULT_KEEPALIVE_TIMEOUT
                    269: #define DEFAULT_KEEPALIVE_TIMEOUT 15
                    270: #endif
                    271: 
                    272: /* The number of requests to entertain per connection */
                    273: #ifndef DEFAULT_KEEPALIVE
                    274: #define DEFAULT_KEEPALIVE 100
                    275: #endif
                    276: 
                    277: /* The size of the server's internal read-write buffers */
                    278: #define IOBUFSIZE 8192
                    279: 
                    280: /* Number of servers to spawn off by default --- also, if fewer than
                    281:  * this free when the caretaker checks, it will spawn more.
                    282:  */
                    283: #ifndef DEFAULT_START_DAEMON
                    284: #define DEFAULT_START_DAEMON 5
                    285: #endif
                    286: 
                    287: /* Maximum number of *free* server processes --- more than this, and
                    288:  * they will die off.
                    289:  */
                    290: 
                    291: #ifndef DEFAULT_MAX_FREE_DAEMON
                    292: #define DEFAULT_MAX_FREE_DAEMON 10
                    293: #endif
                    294: 
                    295: /* Minimum --- fewer than this, and more will be created */
                    296: 
                    297: #ifndef DEFAULT_MIN_FREE_DAEMON
                    298: #define DEFAULT_MIN_FREE_DAEMON 5
                    299: #endif
                    300: 
                    301: /* Limit on the total --- clients will be locked out if more servers than
                    302:  * this are needed.  It is intended solely to keep the server from crashing
                    303:  * when things get out of hand.
                    304:  *
                    305:  * We keep a hard maximum number of servers, for two reasons --- first off,
                    306:  * in case something goes seriously wrong, we want to stop the fork bomb
                    307:  * short of actually crashing the machine we're running on by filling some
                    308:  * kernel table.  Secondly, it keeps the size of the scoreboard file small
                    309:  * enough that we can read the whole thing without worrying too much about
                    310:  * the overhead.
                    311:  */
                    312: #ifndef HARD_SERVER_LIMIT
                    313: #ifdef WIN32
                    314: #define HARD_SERVER_LIMIT 1024
                    315: #else
                    316: #define HARD_SERVER_LIMIT 256
                    317: #endif
                    318: #endif
                    319: 
                    320: /*
                    321:  * Special Apache error codes. These are basically used
                    322:  *  in http_main.c so we can keep track of various errors.
                    323:  *
                    324:  *   APEXIT_OK:
                    325:  *     A normal exit
                    326:  *   APEXIT_INIT:
                    327:  *     A fatal error arising during the server's init sequence
                    328:  *   APEXIT_CHILDINIT:
                    329:  *     The child died during it's init sequence
                    330:  *   APEXIT_CHILDFATAL:
                    331:  *     A fatal error, resulting in the whole server aborting.
                    332:  *     If a child exits with this error, the parent process
                    333:  *     considers this a server-wide fatal error and aborts.
                    334:  *                 
                    335:  */
                    336: #define APEXIT_OK              0x0
                    337: #define APEXIT_INIT            0x2
                    338: #define APEXIT_CHILDINIT       0x3
                    339: #define APEXIT_CHILDFATAL      0xf
                    340: 
                    341: /*
                    342:  * (Unix, OS/2 only)
                    343:  * Interval, in microseconds, between scoreboard maintenance.  During
                    344:  * each scoreboard maintenance cycle the parent decides if it needs to
                    345:  * spawn a new child (to meet MinSpareServers requirements), or kill off
                    346:  * a child (to meet MaxSpareServers requirements).  It will only spawn or
                    347:  * kill one child per cycle.  Setting this too low will chew cpu.  The
                    348:  * default is probably sufficient for everyone.  But some people may want
                    349:  * to raise this on servers which aren't dedicated to httpd and where they
                    350:  * don't like the httpd waking up each second to see what's going on.
                    351:  */
                    352: #ifndef SCOREBOARD_MAINTENANCE_INTERVAL
                    353: #define SCOREBOARD_MAINTENANCE_INTERVAL 1000000
                    354: #endif
                    355: 
                    356: /* Number of requests to try to handle in a single process.  If <= 0,
                    357:  * the children don't die off.  That's the default here, since I'm still
                    358:  * interested in finding and stanching leaks.
                    359:  */
                    360: 
                    361: #ifndef DEFAULT_MAX_REQUESTS_PER_CHILD
                    362: #define DEFAULT_MAX_REQUESTS_PER_CHILD 0
                    363: #endif
                    364: 
                    365: #ifndef DEFAULT_THREADS_PER_CHILD
                    366: #define DEFAULT_THREADS_PER_CHILD 50
                    367: #endif
                    368: #ifndef DEFAULT_EXCESS_REQUESTS_PER_CHILD
                    369: #define DEFAULT_EXCESS_REQUESTS_PER_CHILD 0
                    370: #endif
                    371: 
                    372: /* The maximum length of the queue of pending connections, as defined
                    373:  * by listen(2).  Under some systems, it should be increased if you
                    374:  * are experiencing a heavy TCP SYN flood attack.
                    375:  *
                    376:  * It defaults to 511 instead of 512 because some systems store it 
                    377:  * as an 8-bit datatype; 512 truncated to 8-bits is 0, while 511 is 
                    378:  * 255 when truncated.
                    379:  */
                    380: 
                    381: #ifndef DEFAULT_LISTENBACKLOG
                    382: #define DEFAULT_LISTENBACKLOG 511
                    383: #endif
                    384: 
                    385: /* Limits on the size of various request items.  These limits primarily
                    386:  * exist to prevent simple denial-of-service attacks on a server based
                    387:  * on misuse of the protocol.  The recommended values will depend on the
                    388:  * nature of the server resources -- CGI scripts and database backends
                    389:  * might require large values, but most servers could get by with much
                    390:  * smaller limits than we use below.  The request message body size can
                    391:  * be limited by the per-dir config directive LimitRequestBody.
                    392:  *
                    393:  * Internal buffer sizes are two bytes more than the DEFAULT_LIMIT_REQUEST_LINE
                    394:  * and DEFAULT_LIMIT_REQUEST_FIELDSIZE below, which explains the 8190.
                    395:  * These two limits can be lowered (but not raised) by the server config
                    396:  * directives LimitRequestLine and LimitRequestFieldsize, respectively.
                    397:  *
                    398:  * DEFAULT_LIMIT_REQUEST_FIELDS can be modified or disabled (set = 0) by
                    399:  * the server config directive LimitRequestFields.
                    400:  */
                    401: #ifndef DEFAULT_LIMIT_REQUEST_LINE
                    402: #define DEFAULT_LIMIT_REQUEST_LINE 8190
                    403: #endif /* default limit on bytes in Request-Line (Method+URI+HTTP-version) */
                    404: #ifndef DEFAULT_LIMIT_REQUEST_FIELDSIZE
                    405: #define DEFAULT_LIMIT_REQUEST_FIELDSIZE 8190
                    406: #endif /* default limit on bytes in any one header field  */
                    407: #ifndef DEFAULT_LIMIT_REQUEST_FIELDS
                    408: #define DEFAULT_LIMIT_REQUEST_FIELDS 100
                    409: #endif /* default limit on number of request header fields */
                    410: 
                    411: /*
                    412:  * The default default character set name to add if AddDefaultCharset is 
                    413:  * enabled.  Overridden with AddDefaultCharsetName.
                    414:  */
                    415: #define DEFAULT_ADD_DEFAULT_CHARSET_NAME "iso-8859-1"
                    416: 
                    417: /*
                    418:  * The below defines the base string of the Server: header. Additional
                    419:  * tokens can be added via the ap_add_version_component() API call.
                    420:  *
                    421:  * The tokens are listed in order of their significance for identifying the
                    422:  * application.
                    423:  *
                    424:  * "Product tokens should be short and to the point -- use of them for 
                    425:  * advertizing or other non-essential information is explicitly forbidden."
                    426:  *
                    427:  * Example: "Apache/1.1.0 MrWidget/0.1-alpha" 
                    428:  */
                    429: 
                    430: #define SERVER_BASEVENDOR   "Apache Group"
                    431: #define SERVER_BASEPRODUCT  "Apache"
                    432: #define SERVER_BASEREVISION "1.3.14"
                    433: #define SERVER_BASEVERSION  SERVER_BASEPRODUCT "/" SERVER_BASEREVISION
                    434: 
                    435: #define SERVER_PRODUCT  SERVER_BASEPRODUCT
                    436: #define SERVER_REVISION SERVER_BASEREVISION
                    437: #define SERVER_VERSION  SERVER_PRODUCT "/" SERVER_REVISION
                    438: enum server_token_type {
                    439:     SrvTk_MIN,         /* eg: Apache/1.3.0 */
                    440:     SrvTk_OS,          /* eg: Apache/1.3.0 (UNIX) */
                    441:     SrvTk_FULL,                /* eg: Apache/1.3.0 (UNIX) PHP/3.0 FooBar/1.2b */
                    442:     SrvTk_PRODUCT_ONLY /* eg: Apache */
                    443: };
                    444: 
                    445: API_EXPORT(const char *) ap_get_server_version(void);
                    446: API_EXPORT(void) ap_add_version_component(const char *component);
                    447: API_EXPORT(const char *) ap_get_server_built(void);
                    448: 
                    449: /* Numeric release version identifier: MMNNFFRBB: major minor fix final beta
                    450:  * Always increases along the same track as the source branch.
                    451:  * For example, Apache 1.4.2 would be '10402100', 2.5b7 would be '20500007'.
                    452:  */
                    453: #define APACHE_RELEASE 10314100
                    454: 
                    455: #define SERVER_PROTOCOL "HTTP/1.1"
                    456: #ifndef SERVER_SUPPORT
                    457: #define SERVER_SUPPORT "http://www.apache.org/"
                    458: #endif
                    459: 
                    460: #define DECLINED -1            /* Module declines to handle */
                    461: #define DONE -2                        /* Module has served the response completely 
                    462:                                 *  - it's safe to die() with no more output
                    463:                                 */
                    464: #define OK 0                   /* Module has handled this stage. */
                    465: 
                    466: 
                    467: /* ----------------------- HTTP Status Codes  ------------------------- */
                    468: 
                    469: /* The size of the static array in http_protocol.c for storing
                    470:  * all of the potential response status-lines (a sparse table).
                    471:  * A future version should dynamically generate the table at startup.
                    472:  */
                    473: #define RESPONSE_CODES 55
                    474: 
                    475: #define HTTP_CONTINUE                      100
                    476: #define HTTP_SWITCHING_PROTOCOLS           101
                    477: #define HTTP_PROCESSING                    102
                    478: #define HTTP_OK                            200
                    479: #define HTTP_CREATED                       201
                    480: #define HTTP_ACCEPTED                      202
                    481: #define HTTP_NON_AUTHORITATIVE             203
                    482: #define HTTP_NO_CONTENT                    204
                    483: #define HTTP_RESET_CONTENT                 205
                    484: #define HTTP_PARTIAL_CONTENT               206
                    485: #define HTTP_MULTI_STATUS                  207
                    486: #define HTTP_MULTIPLE_CHOICES              300
                    487: #define HTTP_MOVED_PERMANENTLY             301
                    488: #define HTTP_MOVED_TEMPORARILY             302
                    489: #define HTTP_SEE_OTHER                     303
                    490: #define HTTP_NOT_MODIFIED                  304
                    491: #define HTTP_USE_PROXY                     305
                    492: #define HTTP_TEMPORARY_REDIRECT            307
                    493: #define HTTP_BAD_REQUEST                   400
                    494: #define HTTP_UNAUTHORIZED                  401
                    495: #define HTTP_PAYMENT_REQUIRED              402
                    496: #define HTTP_FORBIDDEN                     403
                    497: #define HTTP_NOT_FOUND                     404
                    498: #define HTTP_METHOD_NOT_ALLOWED            405
                    499: #define HTTP_NOT_ACCEPTABLE                406
                    500: #define HTTP_PROXY_AUTHENTICATION_REQUIRED 407
                    501: #define HTTP_REQUEST_TIME_OUT              408
                    502: #define HTTP_CONFLICT                      409
                    503: #define HTTP_GONE                          410
                    504: #define HTTP_LENGTH_REQUIRED               411
                    505: #define HTTP_PRECONDITION_FAILED           412
                    506: #define HTTP_REQUEST_ENTITY_TOO_LARGE      413
                    507: #define HTTP_REQUEST_URI_TOO_LARGE         414
                    508: #define HTTP_UNSUPPORTED_MEDIA_TYPE        415
                    509: #define HTTP_RANGE_NOT_SATISFIABLE         416
                    510: #define HTTP_EXPECTATION_FAILED            417
                    511: #define HTTP_UNPROCESSABLE_ENTITY          422
                    512: #define HTTP_LOCKED                        423
                    513: #define HTTP_FAILED_DEPENDENCY             424
                    514: #define HTTP_INTERNAL_SERVER_ERROR         500
                    515: #define HTTP_NOT_IMPLEMENTED               501
                    516: #define HTTP_BAD_GATEWAY                   502
                    517: #define HTTP_SERVICE_UNAVAILABLE           503
                    518: #define HTTP_GATEWAY_TIME_OUT              504
                    519: #define HTTP_VERSION_NOT_SUPPORTED         505
                    520: #define HTTP_VARIANT_ALSO_VARIES           506
                    521: #define HTTP_INSUFFICIENT_STORAGE          507
                    522: #define HTTP_NOT_EXTENDED                  510
                    523: 
                    524: #define DOCUMENT_FOLLOWS    HTTP_OK
                    525: #define PARTIAL_CONTENT     HTTP_PARTIAL_CONTENT
                    526: #define MULTIPLE_CHOICES    HTTP_MULTIPLE_CHOICES
                    527: #define MOVED               HTTP_MOVED_PERMANENTLY
                    528: #define REDIRECT            HTTP_MOVED_TEMPORARILY
                    529: #define USE_LOCAL_COPY      HTTP_NOT_MODIFIED
                    530: #define BAD_REQUEST         HTTP_BAD_REQUEST
                    531: #define AUTH_REQUIRED       HTTP_UNAUTHORIZED
                    532: #define FORBIDDEN           HTTP_FORBIDDEN
                    533: #define NOT_FOUND           HTTP_NOT_FOUND
                    534: #define METHOD_NOT_ALLOWED  HTTP_METHOD_NOT_ALLOWED
                    535: #define NOT_ACCEPTABLE      HTTP_NOT_ACCEPTABLE
                    536: #define LENGTH_REQUIRED     HTTP_LENGTH_REQUIRED
                    537: #define PRECONDITION_FAILED HTTP_PRECONDITION_FAILED
                    538: #define SERVER_ERROR        HTTP_INTERNAL_SERVER_ERROR
                    539: #define NOT_IMPLEMENTED     HTTP_NOT_IMPLEMENTED
                    540: #define BAD_GATEWAY         HTTP_BAD_GATEWAY
                    541: #define VARIANT_ALSO_VARIES HTTP_VARIANT_ALSO_VARIES
                    542: 
                    543: #define ap_is_HTTP_INFO(x)         (((x) >= 100)&&((x) < 200))
                    544: #define ap_is_HTTP_SUCCESS(x)      (((x) >= 200)&&((x) < 300))
                    545: #define ap_is_HTTP_REDIRECT(x)     (((x) >= 300)&&((x) < 400))
                    546: #define ap_is_HTTP_ERROR(x)        (((x) >= 400)&&((x) < 600))
                    547: #define ap_is_HTTP_CLIENT_ERROR(x) (((x) >= 400)&&((x) < 500))
                    548: #define ap_is_HTTP_SERVER_ERROR(x) (((x) >= 500)&&((x) < 600))
                    549: 
                    550: #define ap_status_drops_connection(x) \
                    551:                                    (((x) == HTTP_BAD_REQUEST)           || \
                    552:                                     ((x) == HTTP_REQUEST_TIME_OUT)      || \
                    553:                                     ((x) == HTTP_LENGTH_REQUIRED)       || \
                    554:                                     ((x) == HTTP_REQUEST_ENTITY_TOO_LARGE) || \
                    555:                                     ((x) == HTTP_REQUEST_URI_TOO_LARGE) || \
                    556:                                     ((x) == HTTP_INTERNAL_SERVER_ERROR) || \
                    557:                                     ((x) == HTTP_SERVICE_UNAVAILABLE) || \
                    558:                                    ((x) == HTTP_NOT_IMPLEMENTED))
                    559: 
                    560: /* Methods recognized (but not necessarily handled) by the server.
                    561:  * These constants are used in bit shifting masks of size int, so it is
                    562:  * unsafe to have more methods than bits in an int.  HEAD == M_GET.
                    563:  */
                    564: #define M_GET        0
                    565: #define M_PUT        1
                    566: #define M_POST       2
                    567: #define M_DELETE     3
                    568: #define M_CONNECT    4
                    569: #define M_OPTIONS    5
                    570: #define M_TRACE      6
                    571: #define M_PATCH      7
                    572: #define M_PROPFIND   8
                    573: #define M_PROPPATCH  9
                    574: #define M_MKCOL     10
                    575: #define M_COPY      11
                    576: #define M_MOVE      12
                    577: #define M_LOCK      13
                    578: #define M_UNLOCK    14
                    579: #define M_INVALID   15
                    580: 
                    581: #define METHODS     16
                    582: 
                    583: #define CGI_MAGIC_TYPE "application/x-httpd-cgi"
                    584: #define INCLUDES_MAGIC_TYPE "text/x-server-parsed-html"
                    585: #define INCLUDES_MAGIC_TYPE3 "text/x-server-parsed-html3"
                    586: #ifdef CHARSET_EBCDIC
                    587: #define ASCIITEXT_MAGIC_TYPE_PREFIX "text/x-ascii-" /* Text files whose content-type starts with this are passed thru unconverted */
                    588: #endif /*CHARSET_EBCDIC*/
                    589: #define MAP_FILE_MAGIC_TYPE "application/x-type-map"
                    590: #define ASIS_MAGIC_TYPE "httpd/send-as-is"
                    591: #define DIR_MAGIC_TYPE "httpd/unix-directory"
                    592: #define STATUS_MAGIC_TYPE "application/x-httpd-status"
                    593: 
                    594: /*
                    595:  * Define the HTML doctype strings centrally.
                    596:  */
                    597: #define DOCTYPE_HTML_2_0  "<!DOCTYPE HTML PUBLIC \"-//IETF//" \
                    598:                           "DTD HTML 2.0//EN\">\n"
                    599: #define DOCTYPE_HTML_3_2  "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
                    600:                           "DTD HTML 3.2 Final//EN\">\n"
                    601: #define DOCTYPE_HTML_4_0S "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
                    602:                           "DTD HTML 4.0//EN\"\n" \
                    603:                           "\"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
                    604: #define DOCTYPE_HTML_4_0T "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
                    605:                           "DTD HTML 4.0 Transitional//EN\"\n" \
                    606:                           "\"http://www.w3.org/TR/REC-html40/loose.dtd\">\n"
                    607: #define DOCTYPE_HTML_4_0F "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
                    608:                           "DTD HTML 4.0 Frameset//EN\"\n" \
                    609:                           "\"http://www.w3.org/TR/REC-html40/frameset.dtd\">\n"
                    610: 
                    611: /* Just in case your linefeed isn't the one the other end is expecting. */
                    612: #ifndef CHARSET_EBCDIC
                    613: #define LF 10
                    614: #define CR 13
                    615: #define CRLF "\015\012"
                    616: #define OS_ASC(c) (c)
                    617: #else /* CHARSET_EBCDIC */
                    618: #include "ebcdic.h"
                    619: /* OSD_POSIX uses the EBCDIC charset. The transition ASCII->EBCDIC is done in
                    620:  * the buff package (bread/bputs/bwrite), so everywhere else, we use
                    621:  * "native EBCDIC" CR and NL characters. These are therefore defined as
                    622:  * '\r' and '\n'.
                    623:  * NB: this is not the whole truth - sometimes \015 and \012 are contained
                    624:  * in literal (EBCDIC!) strings, so these are not converted but passed.
                    625:  */
                    626: #define CR '\r'
                    627: #define LF '\n'
                    628: #define CRLF "\r\n"
                    629: #define OS_ASC(c) (os_toascii[c])
                    630: #endif /* CHARSET_EBCDIC */
                    631: 
                    632: /* Possible values for request_rec.read_body (set by handling module):
                    633:  *    REQUEST_NO_BODY          Send 413 error if message has any body
                    634:  *    REQUEST_CHUNKED_ERROR    Send 411 error if body without Content-Length
                    635:  *    REQUEST_CHUNKED_DECHUNK  If chunked, remove the chunks for me.
                    636:  *    REQUEST_CHUNKED_PASS     Pass the chunks to me without removal.
                    637:  */
                    638: #define REQUEST_NO_BODY          0
                    639: #define REQUEST_CHUNKED_ERROR    1
                    640: #define REQUEST_CHUNKED_DECHUNK  2
                    641: #define REQUEST_CHUNKED_PASS     3
                    642: 
                    643: /* Things which may vary per file-lookup WITHIN a request ---
                    644:  * e.g., state of MIME config.  Basically, the name of an object, info
                    645:  * about the object, and any other info we may ahve which may need to
                    646:  * change as we go poking around looking for it (e.g., overridden by
                    647:  * .htaccess files).
                    648:  *
                    649:  * Note how the default state of almost all these things is properly
                    650:  * zero, so that allocating it with pcalloc does the right thing without
                    651:  * a whole lot of hairy initialization... so long as we are willing to
                    652:  * make the (fairly) portable assumption that the bit pattern of a NULL
                    653:  * pointer is, in fact, zero.
                    654:  */
                    655: 
                    656: /* This represents the result of calling htaccess; these are cached for
                    657:  * each request.
                    658:  */
                    659: struct htaccess_result {
                    660:     char *dir;                 /* the directory to which this applies */
                    661:     int override;              /* the overrides allowed for the .htaccess file */
                    662:     void *htaccess;            /* the configuration directives */
                    663: /* the next one, or NULL if no more; N.B. never change this */
                    664:     const struct htaccess_result *next;
                    665: };
                    666: 
                    667: typedef struct conn_rec conn_rec;
                    668: typedef struct server_rec server_rec;
                    669: typedef struct request_rec request_rec;
                    670: typedef struct listen_rec listen_rec;
                    671: 
                    672: #include "util_uri.h"
                    673: 
                    674: enum proxyreqtype {
                    675:     NOT_PROXY=0,
                    676:     STD_PROXY,
                    677:     PROXY_PASS
                    678: };
                    679: 
                    680: struct request_rec {
                    681: 
                    682:     ap_pool *pool;
                    683:     conn_rec *connection;
                    684:     server_rec *server;
                    685: 
                    686:     request_rec *next;         /* If we wind up getting redirected,
                    687:                                 * pointer to the request we redirected to.
                    688:                                 */
                    689:     request_rec *prev;         /* If this is an internal redirect,
                    690:                                 * pointer to where we redirected *from*.
                    691:                                 */
                    692: 
                    693:     request_rec *main;         /* If this is a sub_request (see request.h) 
                    694:                                 * pointer back to the main request.
                    695:                                 */
                    696: 
                    697:     /* Info about the request itself... we begin with stuff that only
                    698:      * protocol.c should ever touch...
                    699:      */
                    700: 
                    701:     char *the_request;         /* First line of request, so we can log it */
                    702:     int assbackwards;          /* HTTP/0.9, "simple" request */
                    703:     enum proxyreqtype proxyreq;/* A proxy request (calculated during
                    704:                                 * post_read_request or translate_name) */
                    705:     int header_only;           /* HEAD request, as opposed to GET */
                    706:     char *protocol;            /* Protocol, as given to us, or HTTP/0.9 */
                    707:     int proto_num;             /* Number version of protocol; 1.1 = 1001 */
                    708:     const char *hostname;      /* Host, as set by full URI or Host: */
                    709: 
                    710:     time_t request_time;       /* When the request started */
                    711: 
                    712:     const char *status_line;   /* Status line, if set by script */
                    713:     int status;                        /* In any case */
                    714: 
                    715:     /* Request method, two ways; also, protocol, etc..  Outside of protocol.c,
                    716:      * look, but don't touch.
                    717:      */
                    718: 
                    719:     const char *method;                /* GET, HEAD, POST, etc. */
                    720:     int method_number;         /* M_GET, M_POST, etc. */
                    721: 
                    722:     /*
                    723:        allowed is a bitvector of the allowed methods.
                    724: 
                    725:        A handler must ensure that the request method is one that
                    726:        it is capable of handling.  Generally modules should DECLINE
                    727:        any request methods they do not handle.  Prior to aborting the
                    728:        handler like this the handler should set r->allowed to the list
                    729:        of methods that it is willing to handle.  This bitvector is used
                    730:        to construct the "Allow:" header required for OPTIONS requests,
                    731:        and METHOD_NOT_ALLOWED and NOT_IMPLEMENTED status codes.
                    732: 
                    733:        Since the default_handler deals with OPTIONS, all modules can
                    734:        usually decline to deal with OPTIONS.  TRACE is always allowed,
                    735:        modules don't need to set it explicitly.
                    736: 
                    737:        Since the default_handler will always handle a GET, a
                    738:        module which does *not* implement GET should probably return
                    739:        METHOD_NOT_ALLOWED.  Unfortunately this means that a Script GET
                    740:        handler can't be installed by mod_actions.
                    741:     */
                    742:     int allowed;               /* Allowed methods - for 405, OPTIONS, etc */
                    743: 
                    744:     int sent_bodyct;           /* byte count in stream is for body */
                    745:     long bytes_sent;           /* body byte count, for easy access */
                    746:     time_t mtime;              /* Time the resource was last modified */
                    747: 
                    748:     /* HTTP/1.1 connection-level features */
                    749: 
                    750:     int chunked;               /* sending chunked transfer-coding */
                    751:     int byterange;             /* number of byte ranges */
                    752:     char *boundary;            /* multipart/byteranges boundary */
                    753:     const char *range;         /* The Range: header */
                    754:     long clength;              /* The "real" content length */
                    755: 
                    756:     long remaining;            /* bytes left to read */
                    757:     long read_length;          /* bytes that have been read */
                    758:     int read_body;             /* how the request body should be read */
                    759:     int read_chunked;          /* reading chunked transfer-coding */
                    760:     unsigned expecting_100;    /* is client waiting for a 100 response? */
                    761: 
                    762:     /* MIME header environments, in and out.  Also, an array containing
                    763:      * environment variables to be passed to subprocesses, so people can
                    764:      * write modules to add to that environment.
                    765:      *
                    766:      * The difference between headers_out and err_headers_out is that the
                    767:      * latter are printed even on error, and persist across internal redirects
                    768:      * (so the headers printed for ErrorDocument handlers will have them).
                    769:      *
                    770:      * The 'notes' table is for notes from one module to another, with no
                    771:      * other set purpose in mind...
                    772:      */
                    773: 
                    774:     table *headers_in;
                    775:     table *headers_out;
                    776:     table *err_headers_out;
                    777:     table *subprocess_env;
                    778:     table *notes;
                    779: 
                    780:     /* content_type, handler, content_encoding, content_language, and all
                    781:      * content_languages MUST be lowercased strings.  They may be pointers
                    782:      * to static strings; they should not be modified in place.
                    783:      */
                    784:     const char *content_type;  /* Break these out --- we dispatch on 'em */
                    785:     const char *handler;       /* What we *really* dispatch on           */
                    786: 
                    787:     const char *content_encoding;
                    788:     const char *content_language;      /* for back-compat. only -- do not use */
                    789:     array_header *content_languages;   /* array of (char*) */
                    790: 
                    791:     char *vlist_validator;      /* variant list validator (if negotiated) */
                    792: 
                    793:     int no_cache;
                    794:     int no_local_copy;
                    795: 
                    796:     /* What object is being requested (either directly, or via include
                    797:      * or content-negotiation mapping).
                    798:      */
                    799: 
                    800:     char *unparsed_uri;                /* the uri without any parsing performed */
                    801:     char *uri;                 /* the path portion of the URI */
                    802:     char *filename;
                    803:     char *path_info;
                    804:     char *args;                        /* QUERY_ARGS, if any */
                    805:     struct stat finfo;         /* ST_MODE set to zero if no such file */
                    806:     uri_components parsed_uri; /* components of uri, dismantled */
                    807: 
                    808:     /* Various other config info which may change with .htaccess files
                    809:      * These are config vectors, with one void* pointer for each module
                    810:      * (the thing pointed to being the module's business).
                    811:      */
                    812: 
                    813:     void *per_dir_config;      /* Options set in config files, etc. */
                    814:     void *request_config;      /* Notes on *this* request */
                    815: 
                    816: /*
                    817:  * a linked list of the configuration directives in the .htaccess files
                    818:  * accessed by this request.
                    819:  * N.B. always add to the head of the list, _never_ to the end.
                    820:  * that way, a sub request's list can (temporarily) point to a parent's list
                    821:  */
                    822:     const struct htaccess_result *htaccess;
                    823: 
                    824:     /* On systems with case insensitive file systems (Windows, OS/2, etc.), 
                    825:      * r->filename is case canonicalized (folded to either lower or upper 
                    826:      * case, depending on the specific system) to accomodate file access
                    827:      * checking. case_preserved_filename is the same as r->filename 
                    828:      * except case is preserved. There is at least one instance where Apache 
                    829:      * needs access to the case preserved filename: Java class files published 
                    830:      * with WebDAV need to preserve filename case to make the Java compiler 
                    831:      * happy.
                    832:      */
                    833:     char *case_preserved_filename;
                    834: 
                    835: /* Things placed at the end of the record to avoid breaking binary
                    836:  * compatibility.  It would be nice to remember to reorder the entire
                    837:  * record to improve 64bit alignment the next time we need to break
                    838:  * binary compatibility for some other reason.
                    839:  */
                    840: };
                    841: 
                    842: 
                    843: /* Things which are per connection
                    844:  */
                    845: 
                    846: struct conn_rec {
                    847: 
                    848:     ap_pool *pool;
                    849:     server_rec *server;
                    850:     server_rec *base_server;   /* Physical vhost this conn come in on */
                    851:     void *vhost_lookup_data;   /* used by http_vhost.c */
                    852: 
                    853:     /* Information about the connection itself */
                    854: 
                    855:     int child_num;             /* The number of the child handling conn_rec */
                    856:     BUFF *client;              /* Connection to the guy */
                    857: 
                    858:     /* Who is the client? */
                    859: 
                    860:     struct sockaddr_in local_addr;     /* local address */
                    861:     struct sockaddr_in remote_addr;    /* remote address */
                    862:     char *remote_ip;           /* Client's IP address */
                    863:     char *remote_host;         /* Client's DNS name, if known.
                    864:                                 * NULL if DNS hasn't been checked,
                    865:                                 * "" if it has and no address was found.
                    866:                                 * N.B. Only access this though
                    867:                                 * get_remote_host() */
                    868:     char *remote_logname;      /* Only ever set if doing rfc1413 lookups.
                    869:                                 * N.B. Only access this through
                    870:                                 * get_remote_logname() */
                    871:     char *user;                        /* If an authentication check was made,
                    872:                                 * this gets set to the user name.  We assume
                    873:                                 * that there's only one user per connection(!)
                    874:                                 */
                    875:     char *ap_auth_type;                /* Ditto. */
                    876: 
                    877:     unsigned aborted:1;                /* Are we still talking? */
                    878:     signed int keepalive:2;    /* Are we using HTTP Keep-Alive?
                    879:                                 * -1 fatal error, 0 undecided, 1 yes */
                    880:     unsigned keptalive:1;      /* Did we use HTTP Keep-Alive? */
                    881:     signed int double_reverse:2;/* have we done double-reverse DNS?
                    882:                                 * -1 yes/failure, 0 not yet, 1 yes/success */
                    883:     int keepalives;            /* How many times have we used it? */
                    884:     char *local_ip;            /* server IP address */
                    885:     char *local_host;          /* used for ap_get_server_name when
                    886:                                 * UseCanonicalName is set to DNS
                    887:                                 * (ignores setting of HostnameLookups) */
                    888: };
                    889: 
                    890: /* Per-vhost config... */
                    891: 
                    892: /* The address 255.255.255.255, when used as a virtualhost address,
                    893:  * will become the "default" server when the ip doesn't match other vhosts.
                    894:  */
                    895: #define DEFAULT_VHOST_ADDR 0xfffffffful
                    896: 
                    897: typedef struct server_addr_rec server_addr_rec;
                    898: struct server_addr_rec {
                    899:     server_addr_rec *next;
                    900:     struct in_addr host_addr;  /* The bound address, for this server */
                    901:     unsigned short host_port;  /* The bound port, for this server */
                    902:     char *virthost;            /* The name given in <VirtualHost> */
                    903: };
                    904: 
                    905: struct server_rec {
                    906: 
                    907:     server_rec *next;
                    908: 
                    909:     /* description of where the definition came from */
                    910:     const char *defn_name;
                    911:     unsigned defn_line_number;
                    912: 
                    913:     /* Full locations of server config info */
                    914: 
                    915:     char *srm_confname;
                    916:     char *access_confname;
                    917: 
                    918:     /* Contact information */
                    919: 
                    920:     char *server_admin;
                    921:     char *server_hostname;
                    922:     unsigned short port;       /* for redirects, etc. */
                    923: 
                    924:     /* Log files --- note that transfer log is now in the modules... */
                    925: 
                    926:     char *error_fname;
                    927:     FILE *error_log;
                    928:     int loglevel;
                    929: 
                    930:     /* Module-specific configuration for server, and defaults... */
                    931: 
                    932:     int is_virtual;            /* true if this is the virtual server */
                    933:     void *module_config;       /* Config vector containing pointers to
                    934:                                 * modules' per-server config structures.
                    935:                                 */
                    936:     void *lookup_defaults;     /* MIME type info, etc., before we start
                    937:                                 * checking per-directory info.
                    938:                                 */
                    939:     /* Transaction handling */
                    940: 
                    941:     server_addr_rec *addrs;
                    942:     int timeout;               /* Timeout, in seconds, before we give up */
                    943:     int keep_alive_timeout;    /* Seconds we'll wait for another request */
                    944:     int keep_alive_max;                /* Maximum requests per connection */
                    945:     int keep_alive;            /* Use persistent connections? */
                    946:     int send_buffer_size;      /* size of TCP send buffer (in bytes) */
                    947: 
                    948:     char *path;                        /* Pathname for ServerPath */
                    949:     int pathlen;               /* Length of path */
                    950: 
                    951:     array_header *names;       /* Normal names for ServerAlias servers */
                    952:     array_header *wild_names;  /* Wildcarded names for ServerAlias servers */
                    953: 
                    954:     uid_t server_uid;        /* effective user id when calling exec wrapper */
                    955:     gid_t server_gid;        /* effective group id when calling exec wrapper */
                    956: 
                    957:     int limit_req_line;      /* limit on size of the HTTP request line    */
                    958:     int limit_req_fieldsize; /* limit on size of any request header field */
                    959:     int limit_req_fields;    /* limit on number of request header fields  */
                    960: };
                    961: 
                    962: /* These are more like real hosts than virtual hosts */
                    963: struct listen_rec {
                    964:     listen_rec *next;
                    965:     struct sockaddr_in local_addr;     /* local IP address and port */
                    966:     int fd;
                    967:     int used;                  /* Only used during restart */        
                    968: /* more stuff here, like which protocol is bound to the port */
                    969: };
                    970: 
                    971: /* Prototypes for utilities... util.c.
                    972:  */
                    973: 
                    974: extern void ap_util_init(void);
                    975: 
                    976: /* Time */
                    977: extern API_VAR_EXPORT const char ap_month_snames[12][4];
                    978: extern API_VAR_EXPORT const char ap_day_snames[7][4];
                    979: 
                    980: API_EXPORT(struct tm *) ap_get_gmtoff(int *tz);
                    981: API_EXPORT(char *) ap_get_time(void);
                    982: API_EXPORT(char *) ap_field_noparam(pool *p, const char *intype);
                    983: API_EXPORT(char *) ap_ht_time(pool *p, time_t t, const char *fmt, int gmt);
                    984: API_EXPORT(char *) ap_gm_timestr_822(pool *p, time_t t);
                    985: 
                    986: /* String handling. The *_nc variants allow you to use non-const char **s as
                    987:    arguments (unfortunately C won't automatically convert a char ** to a const
                    988:    char **) */
                    989: 
                    990: API_EXPORT(char *) ap_getword(pool *p, const char **line, char stop);
                    991: API_EXPORT(char *) ap_getword_nc(pool *p, char **line, char stop);
                    992: API_EXPORT(char *) ap_getword_white(pool *p, const char **line);
                    993: API_EXPORT(char *) ap_getword_white_nc(pool *p, char **line);
                    994: API_EXPORT(char *) ap_getword_nulls(pool *p, const char **line, char stop);
                    995: API_EXPORT(char *) ap_getword_nulls_nc(pool *p, char **line, char stop);
                    996: API_EXPORT(char *) ap_getword_conf(pool *p, const char **line);
                    997: API_EXPORT(char *) ap_getword_conf_nc(pool *p, char **line);
                    998: 
                    999: API_EXPORT(const char *) ap_size_list_item(const char **field, int *len);
                   1000: API_EXPORT(char *) ap_get_list_item(pool *p, const char **field);
                   1001: API_EXPORT(int) ap_find_list_item(pool *p, const char *line, const char *tok);
                   1002: 
                   1003: API_EXPORT(char *) ap_get_token(pool *p, const char **accept_line, int accept_white);
                   1004: API_EXPORT(int) ap_find_token(pool *p, const char *line, const char *tok);
                   1005: API_EXPORT(int) ap_find_last_token(pool *p, const char *line, const char *tok);
                   1006: 
                   1007: API_EXPORT(int) ap_is_url(const char *u);
                   1008: API_EXPORT(int) ap_unescape_url(char *url);
                   1009: API_EXPORT(void) ap_no2slash(char *name);
                   1010: API_EXPORT(void) ap_getparents(char *name);
                   1011: API_EXPORT(char *) ap_escape_path_segment(pool *p, const char *s);
                   1012: API_EXPORT(char *) ap_os_escape_path(pool *p, const char *path, int partial);
                   1013: #define ap_escape_uri(ppool,path) ap_os_escape_path(ppool,path,1)
                   1014: API_EXPORT(char *) ap_escape_html(pool *p, const char *s);
                   1015: API_EXPORT(char *) ap_construct_server(pool *p, const char *hostname,
                   1016:                                    unsigned port, const request_rec *r);
                   1017: API_EXPORT(char *) ap_escape_shell_cmd(pool *p, const char *s);
                   1018: 
                   1019: API_EXPORT(int) ap_count_dirs(const char *path);
                   1020: API_EXPORT(char *) ap_make_dirstr_prefix(char *d, const char *s, int n);
                   1021: API_EXPORT(char *) ap_make_dirstr_parent(pool *p, const char *s);
                   1022: /* deprecated.  The previous two routines are preferred. */
                   1023: API_EXPORT(char *) ap_make_dirstr(pool *a, const char *s, int n);
                   1024: API_EXPORT(char *) ap_make_full_path(pool *a, const char *dir, const char *f);
                   1025: 
                   1026: API_EXPORT(int) ap_is_matchexp(const char *str);
                   1027: API_EXPORT(int) ap_strcmp_match(const char *str, const char *exp);
                   1028: API_EXPORT(int) ap_strcasecmp_match(const char *str, const char *exp);
                   1029: API_EXPORT(char *) ap_stripprefix(const char *bigstring, const char *prefix);
                   1030: API_EXPORT(char *) ap_strcasestr(const char *s1, const char *s2);
                   1031: API_EXPORT(char *) ap_pbase64decode(pool *p, const char *bufcoded);
                   1032: API_EXPORT(char *) ap_pbase64encode(pool *p, char *string); 
                   1033: API_EXPORT(char *) ap_uudecode(pool *p, const char *bufcoded);
                   1034: API_EXPORT(char *) ap_uuencode(pool *p, char *string); 
                   1035: 
                   1036: #ifdef OS2
                   1037: void os2pathname(char *path);
                   1038: char *ap_double_quotes(pool *p, char *str);
                   1039: #endif
                   1040: 
                   1041: API_EXPORT(int)    ap_regexec(const regex_t *preg, const char *string,
                   1042:                               size_t nmatch, regmatch_t pmatch[], int eflags);
                   1043: API_EXPORT(size_t) ap_regerror(int errcode, const regex_t *preg, 
                   1044:                                char *errbuf, size_t errbuf_size);
                   1045: API_EXPORT(char *) ap_pregsub(pool *p, const char *input, const char *source,
                   1046:                               size_t nmatch, regmatch_t pmatch[]);
                   1047: 
                   1048: API_EXPORT(void) ap_content_type_tolower(char *);
                   1049: API_EXPORT(void) ap_str_tolower(char *);
                   1050: API_EXPORT(int) ap_ind(const char *, char);    /* Sigh... */
                   1051: API_EXPORT(int) ap_rind(const char *, char);
                   1052: 
                   1053: API_EXPORT(char *) ap_escape_quotes (pool *p, const char *instring);
                   1054: API_EXPORT(void) ap_remove_spaces(char *dest, char *src);
                   1055: 
                   1056: /* Common structure for reading of config files / passwd files etc. */
                   1057: typedef struct {
                   1058:     int (*getch) (void *param);        /* a getc()-like function */
                   1059:     void *(*getstr) (void *buf, size_t bufsiz, void *param); /* a fgets()-like function */
                   1060:     int (*close) (void *param);        /* a close hander function */
                   1061:     void *param;               /* the argument passed to getch/getstr/close */
                   1062:     const char *name;          /* the filename / description */
                   1063:     unsigned line_number;      /* current line number, starting at 1 */
                   1064: } configfile_t;
                   1065: 
                   1066: /* Open a configfile_t as FILE, return open configfile_t struct pointer */
                   1067: API_EXPORT(configfile_t *) ap_pcfg_openfile(pool *p, const char *name);
                   1068: 
                   1069: /* Allocate a configfile_t handle with user defined functions and params */
                   1070: API_EXPORT(configfile_t *) ap_pcfg_open_custom(pool *p, const char *descr,
                   1071:     void *param,
                   1072:     int(*getc_func)(void*),
                   1073:     void *(*gets_func) (void *buf, size_t bufsiz, void *param),
                   1074:     int(*close_func)(void *param));
                   1075: 
                   1076: /* Read one line from open configfile_t, strip LF, increase line number */
                   1077: API_EXPORT(int) ap_cfg_getline(char *buf, size_t bufsize, configfile_t *cfp);
                   1078: 
                   1079: /* Read one char from open configfile_t, increase line number upon LF */
                   1080: API_EXPORT(int) ap_cfg_getc(configfile_t *cfp);
                   1081: 
                   1082: /* Detach from open configfile_t, calling the close handler */
                   1083: API_EXPORT(int) ap_cfg_closefile(configfile_t *cfp);
                   1084: 
                   1085: #ifdef NEED_STRERROR
                   1086: char *strerror(int err);
                   1087: #endif
                   1088: 
                   1089: /* Misc system hackery */
                   1090: 
                   1091: API_EXPORT(uid_t) ap_uname2id(const char *name);
                   1092: API_EXPORT(gid_t) ap_gname2id(const char *name);
                   1093: API_EXPORT(int) ap_is_directory(const char *name);
                   1094: API_EXPORT(int) ap_is_rdirectory(const char *name);
                   1095: API_EXPORT(int) ap_can_exec(const struct stat *);
                   1096: API_EXPORT(void) ap_chdir_file(const char *file);
                   1097: 
                   1098: #ifndef HAVE_CANONICAL_FILENAME
                   1099: /*
                   1100:  *  We can't define these in os.h because of dependence on pool pointer.
                   1101:  */
                   1102: #define ap_os_canonical_filename(p,f)  (f)
                   1103: #define ap_os_case_canonical_filename(p,f)  (f)
                   1104: #define ap_os_systemcase_filename(p,f)  (f)
                   1105: #else
                   1106: API_EXPORT(char *) ap_os_canonical_filename(pool *p, const char *file);
                   1107: #ifdef WIN32
                   1108: API_EXPORT(char *) ap_os_case_canonical_filename(pool *pPool, const char *szFile);
                   1109: API_EXPORT(char *) ap_os_systemcase_filename(pool *pPool, const char *szFile);
                   1110: #elif defined(OS2)
                   1111: API_EXPORT(char *) ap_os_case_canonical_filename(pool *pPool, const char *szFile);
                   1112: API_EXPORT(char *) ap_os_systemcase_filename(pool *pPool, const char *szFile);
                   1113: #else
                   1114: /* XXX: This makes little sense for NETWARE ... NETWARE is case insensitive?
                   1115:  */
                   1116: #define ap_os_case_canonical_filename(p,f) ap_os_canonical_filename(p,f)
                   1117: #define ap_os_systemcase_filename(p,f) ap_os_canonical_filename(p,f)
                   1118: #endif
                   1119: #endif
                   1120: 
                   1121: #ifdef _OSD_POSIX
                   1122: extern const char *os_set_account(pool *p, const char *account);
                   1123: extern int os_init_job_environment(server_rec *s, const char *user_name, int one_process);
                   1124: #endif /* _OSD_POSIX */
                   1125: 
                   1126: char *ap_get_local_host(pool *);
                   1127: unsigned long ap_get_virthost_addr(char *hostname, unsigned short *port);
                   1128: 
                   1129: extern API_VAR_EXPORT time_t ap_restart_time;
                   1130: 
                   1131: /*
                   1132:  * Apache tries to keep all of its long term filehandles (such as log files,
                   1133:  * and sockets) above this number.  This is to workaround problems in many
                   1134:  * third party libraries that are compiled with a small FD_SETSIZE.  There
                   1135:  * should be no reason to lower this, because it's only advisory.  If a file
                   1136:  * can't be allocated above this number then it will remain in the "slack"
                   1137:  * area.
                   1138:  *
                   1139:  * Only the low slack line is used by default.  If HIGH_SLACK_LINE is defined
                   1140:  * then an attempt is also made to keep all non-FILE * files above the high
                   1141:  * slack line.  This is to work around a Solaris C library limitation, where it
                   1142:  * uses an unsigned char to store the file descriptor.
                   1143:  */
                   1144: #ifndef LOW_SLACK_LINE
                   1145: #define LOW_SLACK_LINE 15
                   1146: #endif
                   1147: /* #define HIGH_SLACK_LINE      255 */
                   1148: 
                   1149: /*
                   1150:  * The ap_slack() function takes a fd, and tries to move it above the indicated
                   1151:  * line.  It returns an fd which may or may not have moved above the line, and
                   1152:  * never fails.  If the high line was requested and it fails it will also try
                   1153:  * the low line.
                   1154:  */
                   1155: #ifdef NO_SLACK
                   1156: #define ap_slack(fd,line)   (fd)
                   1157: #else
                   1158: int ap_slack(int fd, int line);
                   1159: #define AP_SLACK_LOW   1
                   1160: #define AP_SLACK_HIGH  2
                   1161: #endif
                   1162: 
                   1163: API_EXPORT(char *) ap_escape_quotes(pool *p, const char *instr);
                   1164: 
                   1165: /*
                   1166:  * Redefine assert() to something more useful for an Apache...
                   1167:  */
                   1168: API_EXPORT(void) ap_log_assert(const char *szExp, const char *szFile, int nLine)
                   1169:                            __attribute__((noreturn));
                   1170: #define ap_assert(exp) ((exp) ? (void)0 : ap_log_assert(#exp,__FILE__,__LINE__))
                   1171: 
                   1172: /* The optimized timeout code only works if we're not MULTITHREAD and we're
                   1173:  * also not using a scoreboard file
                   1174:  */
                   1175: #if !defined (MULTITHREAD) && \
                   1176:     (defined (USE_MMAP_SCOREBOARD) || defined (USE_SHMGET_SCOREBOARD))
                   1177: #define OPTIMIZE_TIMEOUTS
                   1178: #endif
                   1179: 
                   1180: /* A set of flags which indicate places where the server should raise(SIGSTOP).
                   1181:  * This is useful for debugging, because you can then attach to that process
                   1182:  * with gdb and continue.  This is important in cases where one_process
                   1183:  * debugging isn't possible.
                   1184:  */
                   1185: #define SIGSTOP_DETACH                 1
                   1186: #define SIGSTOP_MAKE_CHILD             2
                   1187: #define SIGSTOP_SPAWN_CHILD            4
                   1188: #define SIGSTOP_PIPED_LOG_SPAWN                8
                   1189: #define SIGSTOP_CGI_CHILD              16
                   1190: 
                   1191: #ifdef DEBUG_SIGSTOP
                   1192: extern int raise_sigstop_flags;
                   1193: #define RAISE_SIGSTOP(x)       do { \
                   1194:        if (raise_sigstop_flags & SIGSTOP_##x) raise(SIGSTOP);\
                   1195:     } while (0)
                   1196: #else
                   1197: #define RAISE_SIGSTOP(x)
                   1198: #endif
                   1199: 
                   1200: API_EXPORT(extern const char *) ap_psignature(const char *prefix, request_rec *r);
                   1201: 
                   1202: /* strtoul does not exist on sunos4. */
                   1203: #ifdef strtoul
                   1204: #undef strtoul
                   1205: #endif
                   1206: #define strtoul strtoul_is_not_a_portable_function_use_strtol_instead
                   1207: 
                   1208: #ifdef __cplusplus
                   1209: }
                   1210: #endif
                   1211: 
                   1212: #endif /* !APACHE_HTTPD_H */

E-mail: