HTTP

xiaoxiao2021-04-03  252

#ifndef apache_http_config_h # define apache_http_config_h

#ifdef __cplusplusextern "c" {#ENDIF

/ * * The Central Data Structures Around Here ... * /

/ * Command Dispatch Structure ... * /

/ * Note that for all of these except RAW_ARGS, the config routine is * passed a freshly allocated string which can be modified or stored * or whatever ... it's only necessary to do pstrdup () stuff with * RAW_ARGS. * / Enum cmd_how {RAW_ARGS, / * cmd_func parses command line itself * / TAKE1, / * one argument only * / TAKE2, / * two arguments only * / ITERATE, / * one argument, occuring multiple times * (eg, IndexIgnore) * / ITERATE2, / * Two Arguments, 2nd Occurs Multiple Times * (EG, Addicon) * / Flag, / * One of 'OR' Off '* / NO_ARGS, / * NO ARGS AT All, EG * / Take12, / * one or two arguments * / TAKE3, / * three arguments only * / TAKE23, / * two or three arguments * / TAKE123, / * one, two or three arguments * / TAKE13 / * one or three arguments * /};

typedef struct command_struct {const char * name; / * Name of this command * / const char * (* func) (); / * Function invoked * / void * cmd_data; / * Extra data, for functions which * implement multiple commands. .. * / Int REQ_OVERRIDE; / * What OVERRIDES NEED TO BE ALLOWED to * Enable this command. * / Enum cmd_how args_how; / * what the command expects as arguments * /

Const char * errmsg; / * 'usage' message, in case of syntax error;

/ * The allowed locations for a configuration directive are the union of * those indicated by each set bit in the req_override mask. * * (Req_override & RSRC_CONF) => * .conf outside or * (req_override & ACCESS_CONF ) => * .conf inside or * (req_override & OR_AUTHCFG) => * .conf inside or * and .htaccess when AllowOverride AuthConfig * (req_override & OR_LIMIT) => *. conf inside or * and .htaccess when AllowOverride Limit * (req_override & OR_OPTIONS) => * .conf anywhere * and .htaccess when AllowOverride Options * (req_override & OR_FILEINFO) => * .conf anywhere * and. HTACCESS WHEN ALOWOVERRIDE FILEINFO * (Req_Override & OR_INDEXES) => * .conf Anywhere * and .htaccess when allowoverride indexes * / # define or_none 0 # define or_limit 1 # defi ne OR_OPTIONS 2 # define OR_FILEINFO 4 # define OR_AUTHCFG 8 # define OR_INDEXES 16 # define OR_UNSET 32 # define ACCESS_CONF 64 # define RSRC_CONF 128 # define OR_ALL (OR_LIMIT | OR_OPTIONS | OR_FILEINFO | OR_AUTHCFG | OR_INDEXES) / * This can be returned by a function IF the don't wish to handle * a command. make it it something not likely someone will actually us * as an error code. * /

#define decline_cmd "/ a / b"

/ * * This structure is passed to a command which is being invoked, * to carry a lada which is all of * use to * somebody * ... * /

typedef struct {void * info; / * Argument to command from cmd_table * / int override; / * Which allow-override bits are set * / int limited; / * Which methods are ed * / configfile_t * config_file; / * Config file structure from pcfg_openfile () * /

ap_pool * pool; / * Pool to allocate new storage in * / struct pool * temp_pool; / * Pool for scratch memory; persists during * configuration, but wiped before the first * request is served ... * / server_rec * server; / * Server_rec being configured for * / char * path; / * If configuring for a directory, * pathname of that directory * NOPE that's what it meant previous to the * existance of , and regex * matching.!. Now the only usefulness thing can @ be deived from this field is WHETHER A Command * Is Being Called in a server context (path == null) * or being called in a dir context (path! = Null). * / Const command_rec * CMD; / * configuration command * / const char * end_token; / * end token required to end a nested section * /} cmd_parms;

/ * This structure records the each ofistence of handlers in a module ... * /

Typedef struct {const char * content_type; / * must be all limited (request_rec *);} Handler_Rec;

/ * Module Structures. Just About Everything is Dispatch THROUGH * THESE, DIRECTLY ORECTLY (THROUGH TABMAND AND HANDAL * TABLES). * /

typedef struct module_struct {int version; / * API version, * not * module version;. * check that module is compatible with this * version of the server * / int minor_version;. / * API minor version Provides API feature * milestones Not. Checked during module init * / int module_index; / * index to this modules structures in * config vectors. * / const char * name;

Void * Dynamic_Load_Handle;

Struct Module_struct * next;

/ * Init () occurs after config parsing, but before any children are * forked * Modules should not rely on the order in which create_server_config * and create_dir_config are called * / # ifdef ULTRIX_BRAIN_DEATH void (* init) ();.. Void * (* CREATE_DIR_CONFIG) (); void * (* merge_dir_config) (); void * (* crete_server_config) (); void * (* merge_server_config) (); # else void (* init) (server_rec *, pool *); void * (* create_dir_config) (pool * p, char * DIR); void * (* merge_dir_config) (pool * p, void * base_conf, void * new_conf); void * (* create_server_config) (pool * p, server_rec * s) ; Void * (* merge_server_config) (pool * p, void * base_conf, void * new_conf); # ENDIF

Const command_rec * cmds; const handler_rec * handlers;

/ * Hooks for getting into the middle of server OPS ...

* Translate_handler --- translate URI to filename * access_checker --- check access by host address, etc. All of these * run;. If all decline, that's still OK * check_user_id --- get and validate user id from the HTTP request * auth_checker --- see if the user (from check_user_id) is OK * here *. * If all of * these * decline, the request is rejected * (as a SERVER_ERROR, since the module which was * supposed to handle this was configured . wrong) * type_checker --- Determine MIME type of the requested entity;.. * sets content_type, _encoding and _language fields * logger --- log a transaction * post_read_request --- run right after read_request or internal_redirect, * and not run DURING Any SubRequests. * / INT_REC *) (Request_Rec *) (Request_Rec *); int (* auth_checker) (Request_Rec *); in t (* access_checker) (request_rec *); int (* type_checker) (request_rec *); int (* fixer_upper) (request_rec *); int (* logger) (request_rec *); int (* header_parser) (request_rec *);

/ * Regardless of the model the server uses for managing "units of * execution", ie multi-process, multi-threaded, hybrids of those, * there is the concept of a "heavy weight process". That is, a * process with its own memory space, file spaces, etc. This method, * child_init, is called once for each heavy-weight process before * any requests are served. Note that no provision is made yet for * initialization per light-weight process (ie . thread) The * parameters passed here are the same as those passed to the global * init method above * / # ifdef ULTRIX_BRAIN_DEATH void (* child_init) ();. void (* child_exit) (); # else void (* child_init) (server_rec *, pool *); void (* child_exit) (server_rec *, pool *); # endif int (* post_read_request) (request_rec *);} module; / * Initializer for the first few module slots, which are only * Really set Up ONCE We Start Running. Note That The First Two Slots * Provide a Version Check; this Should Allow us to deal with changes to * the API. The major number should reflect changes to the API handler table * itself or removal of functionality. The minor number should reflect * additions of functionality to the existing API. (the server can detect * an old -Format Module, And Either Handle It Back-Compatibly, or at Least * Signal An Error). See src / include / ap_mmn.h for mmn version history. * /

#DEFINE STANDARD_MODULE_STUFF MODULE_MAGIC_NUMBER_MAJOR, / MODULE_MAGIC_NUMBER_MINOR, / -1, / __FILE___ / / NULL, / NULL

/ * Generic Accessors for other modules to get at their own module-specific * data * /

API_EXPORT (void *) ap_get_module_config (void * conf_vector, module * m); API_EXPORT (void) ap_set_module_config (void * conf_vector, module * m, void * val); # define ap_get_module_config (v, m) / (((void ** ) (v)) [(m) -> MODULE_INDEX] # define ap_set_module_config (v, m, val) / (((((void **) (V)) [(m) -> MODULE_INDEX]) = (VAL) )

/ * Generic command handling function ... * /

API_EXPORT_NONSTD (const char *) ap_set_string_slot (cmd_parms *, char *, char *); API_EXPORT_NONSTD (const char *) ap_set_string_slot_lower (cmd_parms *, char *, char *); API_EXPORT_NONSTD (const char *) ap_set_flag_slot (cmd_parms *, char *, INT); API_EXPORT_NONSTD (const char *) ap_set_file_slot (cmd_parms *, char *, char *);

/ * For Modules Which Need To Read Config Files, Open Logs, etc. ... * this return the fname argument if it begins with '/'; Otherwise * it relative, ket server_root. * /

API_EXPORT (CHAR *) AP_SERVER_ROOT_RELATIVE (Pool * P, Char * FNAME);

/ * Finally, The Hook for Dynamically Loading Modules In ... * /

API_EXPORT (void) ap_add_module (module * m); API_EXPORT (void) ap_remove_module (module * m); API_EXPORT (void) ap_add_loaded_module (module * mod); API_EXPORT (void) ap_remove_loaded_module (module * mod); API_EXPORT (int) ap_add_named_module ( const char * name); API_EXPORT (void) ap_clear_module_list (void); API_EXPORT (const char *) ap_find_module_name (module * m); API_EXPORT (module *) ap_find_linked_module (const char * name);

/ * for importing subconfigs and customized config files * / api_export (const char *) ap_srm_command_loop (cmd_parms * parms, void * config);

#ifdef core_private

EXTERN API_VAR_EXPORT MODULE * TOP_MODULE

Extern module * ap_prelinked_modules []; exTern module * ap_preloaded_modules []; extern api_var_export module ** ap_loaded_modules

/ * For http_main.c ... * / server_rec * ap_read_config (pool * conf_pool, pool * temp_pool, char * config_name); void ap_init_modules (pool * p, server_rec * s); void ap_child_init_modules (pool * p, server_rec * s ); void AP_CHILD_EXIT_MODULES (pool * p, server_rec * s); void ap_setup_prelinked_modules; void ap_show_directives (void); void ap_show_modules (void);

/ * For http_request.c ... * /

Void * ap_create_request_config (pool * p); core_export (void *) ap_create_per_dir_config (pool * p); void * ap_merge_per_dir_configs (pool * p, void * base, void * new);

/ * For http_core.c ... ( Command and Virtual Hosts) * /

INT AP_PARSE_HTACCESS (Void ** Result, Request_Rec * R, Int Override, const char * path, const char * access_name);

CORE_EXPORT (const char *) ap_init_virtual_host (pool * p, const char * hostname, server_rec * main_server, server_rec **); void ap_process_resource_config (server_rec * s, char * fname, pool * p, pool * ptemp);

/ * check_cmd_context () definitions: * / api_export (const char *) ap_check_cmd_context (cmd_parms * cmd, unsigned forbidden);

/ * Check_cmd_context (): Forbidden in: * / # define NOT_IN_VIRTUALHOST 0x01 / * * / # define NOT_IN_LIMIT 0x02 / * * / # define NOT_IN_DIRECTORY 0x04 / * * / # define NOT_IN_LOCATION 0x08 / * * / # define NOT_IN_FILES 0x10 / * * / # define NOT_IN_DIR_LOC_FILE (NOT_IN_DIRECTORY | NOT_IN_LOCATION | NOT_IN_FILES) / * / / * / # define GLOBAL_ONLY (NOT_IN_VIRTUALHOST | NOT_IN_LIMIT | NOT_IN_DIR_LOC_FILE )

/ * Module-Method Dispatcher, Also for http_request.c * /

int ap_translate_name (request_rec *); int ap_check_access (request_rec *); / * check access on non-auth basis * / int ap_check_user_id (request_rec *); / * obtain valid username from client auth * / int ap_check_auth (request_rec *); / * check (validated) user is authorized here * / int ap_find_types (request_rec *); / * identify MIME type * / int ap_run_fixups (request_rec *); / * poke around for other metainfo, etc .... * / int ap_invoke_handler ( Request_rec *); int AP_LOG_TRANSACTION (Request_Rec * R); int AP_HEADER_PARS (Request_Rec *); int AP_RUN_POST_READ_REQUEST (Request_Rec *); / * for mod_perl * /

CORE_EXPORT (const command_rec *) ap_find_command (const char * name, const command_rec * cmds); CORE_EXPORT (const command_rec *) ap_find_command_in_modules (const char * cmd_name, module ** mod); CORE_EXPORT (const char *) ap_handle_command (cmd_parms * parms, Void * config, const char * L);

#ENDIF

#ifdef __cplusplus} #ENDIF

This file is the core structure definition file of Apache.

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

New Post(0)