Annotation of win32/apache13/src/include/http_core.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_HTTP_CORE_H
                     59: #define APACHE_HTTP_CORE_H
                     60: 
                     61: #ifdef __cplusplus
                     62: extern "C" {
                     63: #endif
                     64: 
                     65: /*****************************************************************
                     66:  *
                     67:  * The most basic server code is encapsulated in a single module
                     68:  * known as the core, which is just *barely* functional enough to
                     69:  * serve documents, though not terribly well.
                     70:  *
                     71:  * Largely for NCSA back-compatibility reasons, the core needs to
                     72:  * make pieces of its config structures available to other modules.
                     73:  * The accessors are declared here, along with the interpretation
                     74:  * of one of them (allow_options).
                     75:  */
                     76: 
                     77: #define OPT_NONE 0
                     78: #define OPT_INDEXES 1
                     79: #define OPT_INCLUDES 2
                     80: #define OPT_SYM_LINKS 4
                     81: #define OPT_EXECCGI 8
                     82: #define OPT_UNSET 16
                     83: #define OPT_INCNOEXEC 32
                     84: #define OPT_SYM_OWNER 64
                     85: #define OPT_MULTI 128
                     86: #define OPT_ALL (OPT_INDEXES|OPT_INCLUDES|OPT_SYM_LINKS|OPT_EXECCGI)
                     87: 
                     88: /* options for get_remote_host() */
                     89: /* REMOTE_HOST returns the hostname, or NULL if the hostname
                     90:  * lookup fails.  It will force a DNS lookup according to the
                     91:  * HostnameLookups setting.
                     92:  */
                     93: #define REMOTE_HOST (0)
                     94: 
                     95: /* REMOTE_NAME returns the hostname, or the dotted quad if the
                     96:  * hostname lookup fails.  It will force a DNS lookup according
                     97:  * to the HostnameLookups setting.
                     98:  */
                     99: #define REMOTE_NAME (1)
                    100: 
                    101: /* REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is
                    102:  * never forced.
                    103:  */
                    104: #define REMOTE_NOLOOKUP (2)
                    105: 
                    106: /* REMOTE_DOUBLE_REV will always force a DNS lookup, and also force
                    107:  * a double reverse lookup, regardless of the HostnameLookups
                    108:  * setting.  The result is the (double reverse checked) hostname,
                    109:  * or NULL if any of the lookups fail.
                    110:  */
                    111: #define REMOTE_DOUBLE_REV (3)
                    112: 
                    113: #define SATISFY_ALL 0
                    114: #define SATISFY_ANY 1
                    115: #define SATISFY_NOSPEC 2
                    116: 
                    117: API_EXPORT(int) ap_allow_options (request_rec *);
                    118: API_EXPORT(int) ap_allow_overrides (request_rec *);
                    119: API_EXPORT(const char *) ap_default_type (request_rec *);     
                    120: API_EXPORT(const char *) ap_document_root (request_rec *); /* Don't use this!  If your request went
                    121:                                      * through a Userdir, or something like
                    122:                                      * that, it'll screw you.  But it's
                    123:                                      * back-compatible...
                    124:                                      */
                    125: API_EXPORT(const char *) ap_get_remote_host(conn_rec *conn, void *dir_config, int type);
                    126: API_EXPORT(const char *) ap_get_remote_logname(request_rec *r);
                    127: 
                    128: /* Used for constructing self-referencing URLs, and things like SERVER_PORT,
                    129:  * and SERVER_NAME.
                    130:  */
                    131: API_EXPORT(char *) ap_construct_url(pool *p, const char *uri, request_rec *r);
                    132: API_EXPORT(const char *) ap_get_server_name(request_rec *r);
                    133: API_EXPORT(unsigned) ap_get_server_port(const request_rec *r);
                    134: API_EXPORT(unsigned long) ap_get_limit_req_body(const request_rec *r);
                    135: API_EXPORT(void) ap_custom_response(request_rec *r, int status, char *string);
                    136: API_EXPORT(int) ap_exists_config_define(char *name);
                    137: 
                    138: /* Authentication stuff.  This is one of the places where compatibility
                    139:  * with the old config files *really* hurts; they don't discriminate at
                    140:  * all between different authentication schemes, meaning that we need
                    141:  * to maintain common state for all of them in the core, and make it
                    142:  * available to the other modules through interfaces.
                    143:  */
                    144:     
                    145: typedef struct {
                    146:     int method_mask;
                    147:     char *requirement;
                    148: } require_line;
                    149:      
                    150: API_EXPORT(const char *) ap_auth_type (request_rec *);
                    151: API_EXPORT(const char *) ap_auth_name (request_rec *);     
                    152: API_EXPORT(int) ap_satisfies (request_rec *r);
                    153: API_EXPORT(const array_header *) ap_requires (request_rec *);    
                    154: 
                    155: #ifdef WIN32
                    156: /* 
                    157:  * CGI Script stuff for Win32...
                    158:  */
                    159: typedef enum { eFileTypeUNKNOWN, eFileTypeBIN, eFileTypeEXE16, eFileTypeEXE32, 
                    160:                eFileTypeSCRIPT } file_type_e;
                    161: typedef enum { INTERPRETER_SOURCE_UNSET, INTERPRETER_SOURCE_REGISTRY, 
                    162:                INTERPRETER_SOURCE_SHEBANG } interpreter_source_e;
                    163: API_EXPORT(file_type_e) ap_get_win32_interpreter(const request_rec *, char **);
                    164: #endif
                    165: 
                    166: #ifdef CORE_PRIVATE
                    167: 
                    168: /*
                    169:  * Core is also unlike other modules in being implemented in more than
                    170:  * one file... so, data structures are declared here, even though most of
                    171:  * the code that cares really is in http_core.c.  Also, another accessor.
                    172:  */
                    173: 
                    174: char *ap_response_code_string (request_rec *r, int error_index);
                    175: 
                    176: extern API_VAR_EXPORT module core_module;
                    177: 
                    178: /* Per-directory configuration */
                    179: 
                    180: typedef unsigned char allow_options_t;
                    181: typedef unsigned char overrides_t;
                    182: 
                    183: typedef struct {
                    184:     /* path of the directory/regex/etc.  see also d_is_fnmatch below */
                    185:     char *d;
                    186:     /* the number of slashes in d */
                    187:     unsigned d_components;
                    188: 
                    189:     /* If (opts & OPT_UNSET) then no absolute assignment to options has
                    190:      * been made.
                    191:      * invariant: (opts_add & opts_remove) == 0
                    192:      * Which said another way means that the last relative (options + or -)
                    193:      * assignment made to each bit is recorded in exactly one of opts_add
                    194:      * or opts_remove.
                    195:      */
                    196:     allow_options_t opts;
                    197:     allow_options_t opts_add;
                    198:     allow_options_t opts_remove;
                    199:     overrides_t override;
                    200:     
                    201:     /* MIME typing --- the core doesn't do anything at all with this,
                    202:      * but it does know what to slap on a request for a document which
                    203:      * goes untyped by other mechanisms before it slips out the door...
                    204:      */
                    205:     
                    206:     char *ap_default_type;
                    207:   
                    208:     /* Authentication stuff.  Groan... */
                    209:     
                    210:     int satisfy;
                    211:     char *ap_auth_type;
                    212:     char *ap_auth_name;
                    213:     array_header *ap_requires;
                    214: 
                    215:     /* Custom response config. These can contain text or a URL to redirect to.
                    216:      * if response_code_strings is NULL then there are none in the config,
                    217:      * if it's not null then it's allocated to sizeof(char*)*RESPONSE_CODES.
                    218:      * This lets us do quick merges in merge_core_dir_configs().
                    219:      */
                    220:   
                    221:     char **response_code_strings;
                    222: 
                    223:     /* Hostname resolution etc */
                    224: #define HOSTNAME_LOOKUP_OFF    0
                    225: #define HOSTNAME_LOOKUP_ON     1
                    226: #define HOSTNAME_LOOKUP_DOUBLE 2
                    227: #define HOSTNAME_LOOKUP_UNSET  3
                    228:     unsigned int hostname_lookups : 4;
                    229: 
                    230:     signed int do_rfc1413 : 2;   /* See if client is advertising a username? */
                    231: 
                    232:     signed int content_md5 : 2;  /* calculate Content-MD5? */
                    233: 
                    234: #define USE_CANONICAL_NAME_OFF   (0)
                    235: #define USE_CANONICAL_NAME_ON    (1)
                    236: #define USE_CANONICAL_NAME_DNS   (2)
                    237: #define USE_CANONICAL_NAME_UNSET (3)
                    238:     unsigned use_canonical_name : 2;
                    239: 
                    240:     /* since is_fnmatch(conf->d) was being called so frequently in
                    241:      * directory_walk() and its relatives, this field was created and
                    242:      * is set to the result of that call.
                    243:      */
                    244:     unsigned d_is_fnmatch : 1;
                    245: 
                    246:     /* should we force a charset on any outgoing parameterless content-type?
                    247:      * if so, which charset?
                    248:      */
                    249: #define ADD_DEFAULT_CHARSET_OFF   (0)
                    250: #define ADD_DEFAULT_CHARSET_ON    (1)
                    251: #define ADD_DEFAULT_CHARSET_UNSET (2)
                    252:     unsigned add_default_charset : 2;
                    253:     char *add_default_charset_name;
                    254: 
                    255:     /* System Resource Control */
                    256: #ifdef RLIMIT_CPU
                    257:     struct rlimit *limit_cpu;
                    258: #endif
                    259: #if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS)
                    260:     struct rlimit *limit_mem;
                    261: #endif
                    262: #ifdef RLIMIT_NPROC
                    263:     struct rlimit *limit_nproc;
                    264: #endif
                    265:     unsigned long limit_req_body;  /* limit on bytes in request msg body */
                    266: 
                    267:     /* logging options */
                    268:     enum { srv_sig_unset, srv_sig_off, srv_sig_on,
                    269:            srv_sig_withmail } server_signature;
                    270:     int loglevel;
                    271:     
                    272:     /* Access control */
                    273:     array_header *sec;
                    274:     regex_t *r;
                    275: 
                    276: #ifdef WIN32
                    277:     /* Where to find interpreter to run scripts */
                    278:     interpreter_source_e script_interpreter_source;
                    279: #endif    
                    280:     
                    281: } core_dir_config;
                    282: 
                    283: /* Per-server core configuration */
                    284: 
                    285: typedef struct {
                    286:   
                    287: #ifdef GPROF
                    288:     char *gprof_dir;
                    289: #endif
                    290: 
                    291:     /* Name translations --- we want the core to be able to do *something*
                    292:      * so it's at least a minimally functional web server on its own (and
                    293:      * can be tested that way).  But let's keep it to the bare minimum:
                    294:      */
                    295:     char *ap_document_root;
                    296:   
                    297:     /* Access control */
                    298: 
                    299:     char *access_name;
                    300:     array_header *sec;
                    301:     array_header *sec_url;
                    302: } core_server_config;
                    303: 
                    304: /* for http_config.c */
                    305: void ap_core_reorder_directories(pool *, server_rec *);
                    306: 
                    307: /* for mod_perl */
                    308: CORE_EXPORT(void) ap_add_per_dir_conf (server_rec *s, void *dir_config);
                    309: CORE_EXPORT(void) ap_add_per_url_conf (server_rec *s, void *url_config);
                    310: CORE_EXPORT(void) ap_add_file_conf(core_dir_config *conf, void *url_config);
                    311: CORE_EXPORT_NONSTD(const char *) ap_limit_section (cmd_parms *cmd, void *dummy, const char *arg);
                    312: 
                    313: #endif
                    314: 
                    315: #ifdef __cplusplus
                    316: }
                    317: #endif
                    318: 
                    319: #endif /* !APACHE_HTTP_CORE_H */

E-mail: