HTTP

xiaoxiao2021-04-03  211

#ifndef apache_http_core_h # define apache_http_core_h

#ifdef __cplusplusextern "c" {#ENDIF

/ ************************************************** *************** * * THE MOST Basic Server Code Is Encapsulated In a Single Module * KNown As The Core, Which IS Just * Barely * Functional Enough To * Serve Documents, Though NOT terribly well. * * Largely for NCSA back-compatibility reasons, the core needs to * make pieces of its config structures available to other modules. * The accessors are declared here, along with the interpretation * of one of them (allow_options). * /

#define OPT_NONE 0 # define OPT_INDEXES 1 # define OPT_INCLUDES 2 # define OPT_SYM_LINKS 4 # define OPT_EXECCGI 8 # define OPT_UNSET 16 # define OPT_INCNOEXEC 32 # define OPT_SYM_OWNER 64 # define OPT_MULTI 128 # define OPT_ALL (OPT_INDEXES | OPT_INCLUDES | OPT_SYM_LINKS | OPT_EXECCGI)

/ * Options for get_remote_host () * // * REMOTE_HOST returns the hostname, or NULL if the hostname * lookup fails. It will force a DNS lookup according to the * HostnameLookups setting. * / # Define REMOTE_HOST (0)

/ * Remote_name returns the hostname, or the dotted quad iF the * hostname lookup fails. It will forward a dns look accounting * to the hostnamelookups setting. * / # Define remote_name (1)

/ * Remote_nolookup is like remote_name except this a dns look is * never forced. * / # Define remote_nolookup (2)

/ * REMOTE_DOUBLE_REV will always force a DNS lookup, and also force * a double reverse lookup, regardless of the HostnameLookups * setting. The result is the (double reverse checked) hostname, * or NULL if any of the lookups fail. * / # Define Remote_Double_rev (3)

#define satisfy_all 0 # Define Satisfy_Any 1 # define Satisfy_nospec 2

API_EXPORT (int) ap_allow_options (request_rec *); API_EXPORT (int) ap_allow_overrides (request_rec *); API_EXPORT (const char *) ap_default_type (request_rec *); API_EXPORT (const char *) ap_document_root (request_rec *); / * Do not use this! If your request went * through a Userdir, or something like * that, it'll screw you. But it's * back-compatible ... * / API_EXPORT (const char *) ap_get_remote_host (conn_rec * conn, void * dir_config, int type); API_EXPORT (const char *) ap_get_remote_logname (request_rec * r);. / * Used for constructing self-referencing URLs, and things like SERVER_PORT, * and SERVER_NAME * / API_EXPORT (char *) ap_construct_url (pool * p, const char * uri, const request_rec * r); API_EXPORT (const char *) ap_get_server_name (const request_rec * r); API_EXPORT (unsigned) ap_get_server_port (const request_rec * r); API_EXPORT (unsigned long) ap_get_limit_req_body (const request_rec * r); API_EXPORT (void) AP_CUSTOM_RESPONSE (Request_Rec * R, Int Status, Char * Stri Ng);

. / * Authentication stuff This is one of the places where compatibility * with the old config files * really * hurts; they do not discriminate at * all between different authentication schemes, meaning that we need * to maintain common state for all of them in the core, and make it * available to the other modules through interfaces * / typedef struct. {int method_mask; char * requirement;} require_line; API_EXPORT (const char *) ap_auth_type (request_rec *); API_EXPORT (const char *) ap_auth_name (Request_rec *); API_EXPORT (INT) AP_SATISFIES (Request_Rec * R); API_EXPORT (const array_header *) ap_requires (Request_rec *);

#ifdef core_private

/ * * Core is also unlike other modules in being implemented in more than * one file ... so, data structures are declared here, even though most of * the code that cares really is in http_core.c. Also, anothre accessor. * / char * AP_RESPONSE_CODE_STRING (Request_Rec * R, INT Error_index);

EXTERN API_VAR_EXPORT MODULE CORE_MODULE

/ * Per-directory configuration * /

Typedef unsigned char allow_options_t; typedef unsigned char overrides_t;

Typedef struct {/ * path of the directory / regex / etc. See Also D_IS_FNMATCH BEE ALSO D_IS_FNMATCH BELOW * / CHAR * D; / * The Number of Slashes In D * / Unsigned D_Components

. / * If (opts & OPT_UNSET) then no absolute assignment to options has * been made * invariant: (opts_add & opts_remove) == 0 * Which said another way means that the last relative (options or -) * assignment made to each bit is recorded in exactly one of opts_add * or opts_remove * / allow_options_t opts;. allow_options_t opts_add; allow_options_t opts_remove; overrides_t override; / * MIME typing --- the core does not do anything at all with this, * but it does know what to slap on a request for a document which * goes untyped by other mechanisms before it slips out the door ... * / char * ap_default_type;. / * Authentication stuff Groan ... * / int satisfy; char * ap_auth_type; Char * AP_AUTH_NAME; array_header * ap_requires;

/ * Custom response config. These can contain text or a URL to redirect to. * If response_code_strings is NULL then there are none in the config, * if it's not null then it's allocated to sizeof (char *) * RESPONSE_CODES. * This lets . us do quick merges in merge_core_dir_configs () * / char ** response_code_strings; / * Hostname resolution etc * / # define HOSTNAME_LOOKUP_OFF ​​0 # define HOSTNAME_LOOKUP_ON 1 # define HOSTNAME_LOOKUP_DOUBLE 2 # define HOSTNAME_LOOKUP_UNSET 3 unsigned int hostname_lookups: 4;

Signed Int do_rfc1413: 2; / * See if client is advertising a username? * /

Signed Int Content_md5: 2; / * Calculate Content-MD5? * /

Unsigned use_canonical_name: 2; / * bit 0 = ON / OFF, BIT 1 = unset / set * /

/ * Since is_fnmatch (conf-> d) WAS Being Called SO FREQUENTLY IN * DIRECTORY_WALK () And ITS Relatives, this field Was create and * is set to the result of what call. * / unsigned d_is_fnmatch: 1;

/ * System Resource Control * / # ifdef RLIMIT_CPU struct rlimit * limit_cpu; # endif # if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined (RLIMIT_AS) struct rlimit * limit_mem; # endif # ifdef RLIMIT_NPROC struct rlimit * limit_nproc; #ENDIF unsigned long limit_req_body; / * Limit on bytes in request msg body * /

/ * logging options * / enum {srv_sig_off, srv_sig_on, srv_sig_withmail} server_signature; int loglevel; / * access control * / array_header * sec; regex_t * r;

} Core_Dir_config;

/ * Per-Server Core Configuration * /

Typedef struct {#ifdef gprof char * gprof_dir; #ENDIF

/ * Name translations --- We want the core to beable to do * something * * SO it's at Least a minimally functional web server on its ing (and * can be tsted ". But let's keep it to the Bare Minimum : * / Char * ap_document_root; / * Access control * / char * access_name; array_header * sec_url;} core_server_config;

/ * for http_config.c * / void ap_core_reorder_directories (pool *, server_rec *);

/ * For mod_perl * / CORE_EXPORT (void) ap_add_per_dir_conf (server_rec * s, void * dir_config); CORE_EXPORT (void) ap_add_per_url_conf (server_rec * s, void * url_config); CORE_EXPORT_NONSTD (const char *) ap_limit_section (cmd_parms * cmd, void * Dummy, Const Char * arg;

#ENDIF

#ifdef __cplusplus} #ENDIF

#ENDIF / *! Apache_http_core_h * /

This file defines the data structure and interface functions of the core module.

转载请注明原文地址:https://www.9cbs.com/read-131473.html

New Post(0)