Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Core HTTP Daemon
Collaboration diagram for Core HTTP Daemon:

Modules

 Acessors
 File/Directory Accessor directives.
 
 Remote Host Resolution
 

Data Structures

struct  require_line
 A structure to keep track of authorization requirements. More...
 
struct  core_request_config
 Per-request configuration. More...
 
struct  core_dir_config
 Per-directory configuration. More...
 
struct  core_server_config
 
struct  core_net_rec
 
union  ap_mgmt_value
 
struct  ap_mgmt_item_t
 
struct  ap_errorlog_info
 
struct  ap_errorlog_provider
 
struct  ap_errorlog_handler
 
struct  ap_errorlog_format_item
 

Macros

#define SATISFY_ALL   0
 
#define SATISFY_ANY   1
 
#define SATISFY_NOSPEC   2
 
#define AP_MIN_BYTES_TO_WRITE   8000
 
#define AP_DEFAULT_MAX_INTERNAL_REDIRECTS   10
 
#define AP_DEFAULT_MAX_SUBREQ_DEPTH   10
 
#define AP_CORE_MODULE_INDEX   0
 
#define ap_get_core_module_config(v)   (((void **)(v))[AP_CORE_MODULE_INDEX])
 
#define ap_set_core_module_config(v, val)   ((((void **)(v))[AP_CORE_MODULE_INDEX]) = (val))
 
#define AP_NOTE_DIRECTORY_WALK   0
 
#define AP_NOTE_LOCATION_WALK   1
 
#define AP_NOTE_FILE_WALK   2
 
#define AP_NOTE_IF_WALK   3
 
#define AP_NUM_STD_NOTES   4
 
#define ETAG_UNSET   0
 
#define ETAG_NONE   (1 << 0)
 
#define ETAG_MTIME   (1 << 1)
 
#define ETAG_INODE   (1 << 2)
 
#define ETAG_SIZE   (1 << 3)
 
#define ETAG_ALL   (ETAG_MTIME | ETAG_INODE | ETAG_SIZE)
 
#define ETAG_BACKWARD   (ETAG_MTIME | ETAG_SIZE)
 
#define AP_CORE_CONFIG_OFF   (0)
 
#define AP_CORE_CONFIG_ON   (1)
 
#define AP_CORE_CONFIG_UNSET   (2)
 
#define AP_CORE_MERGE_FLAG(field, to, base, over)
 
#define AP_SENDFILE_ENABLED(x)   ((x) == ENABLE_SENDFILE_ON ? APR_SENDFILE_ENABLED : 0)
 
#define AP_ERRORLOG_PROVIDER_GROUP   "error_log_writer"
 
#define AP_ERRORLOG_PROVIDER_VERSION   "0"
 
#define AP_ERRORLOG_DEFAULT_PROVIDER   "file"
 
#define AP_ERRORLOG_PROVIDER_ADD_EOL_STR   1
 
#define AP_ERRORLOG_FLAG_FIELD_SEP   1
 
#define AP_ERRORLOG_FLAG_MESSAGE   2
 
#define AP_ERRORLOG_FLAG_REQUIRED   4
 
#define AP_ERRORLOG_FLAG_NULL_AS_HYPHEN   8
 
#define AP_SQ_MAIN_STATE   0
 
#define AP_SQ_RUN_MODE   1
 
#define AP_SQ_CONFIG_GEN   2
 
#define AP_SQ_NOT_SUPPORTED   -1
 
#define AP_SQ_MS_INITIAL_STARTUP   1
 
#define AP_SQ_MS_CREATE_PRE_CONFIG   2
 
#define AP_SQ_MS_DESTROY_CONFIG   3
 
#define AP_SQ_MS_CREATE_CONFIG   4
 
#define AP_SQ_MS_RUN_MPM   5
 
#define AP_SQ_MS_EXITING   6
 
#define AP_SQ_RM_UNKNOWN   1
 
#define AP_SQ_RM_NORMAL   2
 
#define AP_SQ_RM_CONFIG_TEST   3
 
#define AP_SQ_RM_CONFIG_DUMP   4
 
#define AP_CORE_DEFAULT(X, Y, Z)   (X ? X->Y : Z)
 

Typedefs

typedef struct require_line require_line
 
typedef unsigned char allow_options_t
 
typedef unsigned int overrides_t
 
typedef unsigned long etag_components_t
 
typedef struct
core_output_filter_ctx 
core_output_filter_ctx_t
 
typedef struct core_filter_ctx core_ctx_t
 
typedef struct core_net_rec core_net_rec
 
typedef struct ap_errorlog_info ap_errorlog_info
 
typedef struct ap_errorlog_provider ap_errorlog_provider
 
typedef int ap_errorlog_handler_fn_t (const ap_errorlog_info *info, const char *arg, char *buf, int buflen)
 
typedef struct ap_errorlog_handler ap_errorlog_handler
 

Enumerations

enum  server_signature_e { srv_sig_unset, srv_sig_off, srv_sig_on, srv_sig_withmail }
 Server Signature Enumeration. More...
 
enum  ap_mgmt_type_e { ap_mgmt_type_string, ap_mgmt_type_long, ap_mgmt_type_hash }
 

Functions

int ap_allow_options (request_rec *r)
 
int ap_allow_overrides (request_rec *r)
 
const char * ap_document_root (request_rec *r)
 
const char * ap_get_remote_logname (request_rec *r)
 
char * ap_construct_url (apr_pool_t *p, const char *uri, request_rec *r)
 
const char * ap_get_server_name (request_rec *r)
 
const char * ap_get_server_name_for_url (request_rec *r)
 
apr_port_t ap_get_server_port (const request_rec *r)
 
apr_size_t ap_get_read_buf_size (const request_rec *r)
 
apr_off_t ap_get_limit_req_body (const request_rec *r)
 
apr_size_t ap_get_limit_xml_body (const request_rec *r)
 
void ap_custom_response (request_rec *r, int status, const char *string)
 
int ap_is_recursion_limit_exceeded (const request_rec *r)
 
int ap_exists_config_define (const char *name)
 
int ap_core_translate (request_rec *r)
 
const char * ap_auth_type (request_rec *r)
 
const char * ap_auth_name (request_rec *r)
 
int ap_satisfies (request_rec *r)
 
voidap_get_core_module_config (const ap_conf_vector_t *cv)
 
void ap_set_core_module_config (ap_conf_vector_t *cv, void *val)
 
apr_socket_tap_get_conn_socket (conn_rec *c)
 
apr_size_t ap_register_request_note (void)
 
void ** ap_get_request_note (request_rec *r, apr_size_t note_num)
 
void ap_add_output_filters_by_type (request_rec *r)
 
void ap_core_reorder_directories (apr_pool_t *, server_rec *)
 
void ap_add_per_dir_conf (server_rec *s, void *dir_config)
 
void ap_add_per_url_conf (server_rec *s, void *url_config)
 
void ap_add_file_conf (apr_pool_t *p, core_dir_config *conf, void *url_config)
 
const char * ap_add_if_conf (apr_pool_t *p, core_dir_config *conf, void *url_config)
 
const char * ap_limit_section (cmd_parms *cmd, void *dummy, const char *arg)
 
apr_status_t ap_core_input_filter (ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode, apr_read_type_e block, apr_off_t readbytes)
 
apr_status_t ap_core_output_filter (ap_filter_t *f, apr_bucket_brigade *b)
 
const char * ap_get_server_protocol (server_rec *s)
 
void ap_set_server_protocol (server_rec *s, const char *proto)
 
apr_status_t insert_network_bucket (conn_rec *c, apr_bucket_brigade *bb, apr_socket_t *socket)
 
void ap_logio_add_bytes_out (conn_rec *c, apr_off_t bytes)
 
void ap_logio_add_bytes_in (conn_rec *c, apr_off_t bytes)
 
apr_off_t ap_logio_get_last_bytes (conn_rec *c)
 
void ap_register_errorlog_handler (apr_pool_t *p, char *tag, ap_errorlog_handler_fn_t *handler, int flags)
 
void ap_register_log_hooks (apr_pool_t *p)
 
void ap_register_config_hooks (apr_pool_t *p)
 
const char * ap_ident_lookup (request_rec *r)
 
int authz_some_auth_required (request_rec *r)
 
const char * authn_ap_auth_type (request_rec *r)
 
const char * authn_ap_auth_name (request_rec *r)
 
int access_compat_ap_satisfies (request_rec *r)
 
int ap_state_query (int query_code)
 
conn_recap_create_slave_connection (conn_rec *c)
 

Variables

AP_DECLARE_DATA module core_module
 
AP_DECLARE_DATA ap_filter_rec_tap_subreq_core_filter_handle
 
AP_DECLARE_DATA ap_filter_rec_tap_core_output_filter_handle
 
AP_DECLARE_DATA ap_filter_rec_tap_content_length_filter_handle
 
AP_DECLARE_DATA ap_filter_rec_tap_core_input_filter_handle
 
AP_DECLARE_DATA ap_filter_rec_tap_request_core_filter_handle
 

Detailed Description

Macro Definition Documentation

#define AP_CORE_CONFIG_OFF   (0)
#define AP_CORE_CONFIG_ON   (1)
#define AP_CORE_CONFIG_UNSET   (2)
#define AP_CORE_DEFAULT (   X,
  Y,
 
)    (X ? X->Y : Z)

Macro to provide a default value if the pointer is not yet initialised

#define AP_CORE_MERGE_FLAG (   field,
  to,
  base,
  over 
)
Value:
to->field = \
over->field != AP_CORE_CONFIG_UNSET \
? over->field \
: base->field
#define AP_CORE_CONFIG_UNSET
Definition: http_core.h:504
#define AP_CORE_MODULE_INDEX   0
#define AP_DEFAULT_MAX_INTERNAL_REDIRECTS   10

default maximum of internal redirects

#define AP_DEFAULT_MAX_SUBREQ_DEPTH   10

default maximum subrequest nesting level

#define AP_ERRORLOG_DEFAULT_PROVIDER   "file"
#define AP_ERRORLOG_FLAG_FIELD_SEP   1

item starts a new field

#define AP_ERRORLOG_FLAG_MESSAGE   2

item is the actual error message

#define AP_ERRORLOG_FLAG_NULL_AS_HYPHEN   8

log zero-length item as '-'

#define AP_ERRORLOG_FLAG_REQUIRED   4

skip whole line if item is zero-length

#define AP_ERRORLOG_PROVIDER_ADD_EOL_STR   1

add APR_EOL_STR to the end of log message

#define AP_ERRORLOG_PROVIDER_GROUP   "error_log_writer"
#define AP_ERRORLOG_PROVIDER_VERSION   "0"
#define ap_get_core_module_config (   v)    (((void **)(v))[AP_CORE_MODULE_INDEX])
#define AP_MIN_BYTES_TO_WRITE   8000

Make sure we don't write less than 8000 bytes at any one time.

#define AP_NOTE_DIRECTORY_WALK   0
#define AP_NOTE_FILE_WALK   2
#define AP_NOTE_IF_WALK   3
#define AP_NOTE_LOCATION_WALK   1
#define AP_NUM_STD_NOTES   4
#define AP_SENDFILE_ENABLED (   x)    ((x) == ENABLE_SENDFILE_ON ? APR_SENDFILE_ENABLED : 0)
#define ap_set_core_module_config (   v,
  val 
)    ((((void **)(v))[AP_CORE_MODULE_INDEX]) = (val))
#define AP_SQ_CONFIG_GEN   2

generation of the top-level apache parent

#define AP_SQ_MAIN_STATE   0

current status of the server

#define AP_SQ_MS_CREATE_CONFIG   4

normal configuration run

#define AP_SQ_MS_CREATE_PRE_CONFIG   2

initial configuration run for setting up log config, etc.

#define AP_SQ_MS_DESTROY_CONFIG   3

tearing down configuration

#define AP_SQ_MS_EXITING   6

cleaning up for exit

#define AP_SQ_MS_INITIAL_STARTUP   1

before the config preflight

#define AP_SQ_MS_RUN_MPM   5

running the MPM

#define AP_SQ_NOT_SUPPORTED   -1

return value for unknown query_code

#define AP_SQ_RM_CONFIG_DUMP   4

only dump some parts of the config

#define AP_SQ_RM_CONFIG_TEST   3

config test only

#define AP_SQ_RM_NORMAL   2

normal operation (server requests or signal server)

#define AP_SQ_RM_UNKNOWN   1

command line not yet parsed

#define AP_SQ_RUN_MODE   1

are we going to serve requests or are we just testing/dumping config

#define ETAG_ALL   (ETAG_MTIME | ETAG_INODE | ETAG_SIZE)
#define ETAG_BACKWARD   (ETAG_MTIME | ETAG_SIZE)
#define ETAG_INODE   (1 << 2)
#define ETAG_MTIME   (1 << 1)
#define ETAG_NONE   (1 << 0)
#define ETAG_SIZE   (1 << 3)
#define ETAG_UNSET   0
#define SATISFY_ALL   0

all of the requirements must be met

#define SATISFY_ANY   1

any of the requirements must be met

#define SATISFY_NOSPEC   2

There are no applicable satisfy lines

Typedef Documentation

typedef unsigned char allow_options_t
typedef int ap_errorlog_handler_fn_t(const ap_errorlog_info *info, const char *arg, char *buf, int buflen)

callback function prototype for a external errorlog handler

Note
To avoid unbounded memory usage, these functions must not allocate memory from the server, connection, or request pools. If an errorlog handler absolutely needs a pool to pass to other functions, it must create and destroy a sub-pool.

The info structure passed to callback functions of errorlog handlers. Not all information is available in all contexts. In particular, all pointers may be NULL.

typedef struct core_filter_ctx core_ctx_t
typedef struct core_net_rec core_net_rec
typedef struct core_output_filter_ctx core_output_filter_ctx_t
typedef unsigned long etag_components_t
typedef unsigned int overrides_t
typedef struct require_line require_line
See Also
require_line

Enumeration Type Documentation

Enumerator
ap_mgmt_type_string 
ap_mgmt_type_long 
ap_mgmt_type_hash 

Server Signature Enumeration.

Enumerator
srv_sig_unset 
srv_sig_off 
srv_sig_on 
srv_sig_withmail 

Function Documentation

int access_compat_ap_satisfies ( request_rec r)
void ap_add_file_conf ( apr_pool_t p,
core_dir_config conf,
void url_config 
)
const char* ap_add_if_conf ( apr_pool_t p,
core_dir_config conf,
void url_config 
)
void ap_add_output_filters_by_type ( request_rec r)
void ap_add_per_dir_conf ( server_rec s,
void dir_config 
)
void ap_add_per_url_conf ( server_rec s,
void url_config 
)
int ap_allow_options ( request_rec r)

Retrieve the value of Options for this request

Parameters
rThe current request
Returns
the Options bitmask
int ap_allow_overrides ( request_rec r)

Retrieve the value of the AllowOverride for this request

Parameters
rThe current request
Returns
the overrides bitmask
const char* ap_auth_name ( request_rec r)

Return the current Authorization realm

Parameters
rThe current request
Returns
The current authorization realm
const char* ap_auth_type ( request_rec r)

Return the type of authorization required for this request

Parameters
rThe current request
Returns
The authorization required
char* ap_construct_url ( apr_pool_t p,
const char *  uri,
request_rec r 
)

build a fully qualified URL from the uri and information in the request rec

Parameters
pThe pool to allocate the URL from
uriThe path to the requested file
rThe current request
Returns
A fully qualified URL
apr_status_t ap_core_input_filter ( ap_filter_t f,
apr_bucket_brigade b,
ap_input_mode_t  mode,
apr_read_type_e  block,
apr_off_t  readbytes 
)
apr_status_t ap_core_output_filter ( ap_filter_t f,
apr_bucket_brigade b 
)
void ap_core_reorder_directories ( apr_pool_t ,
server_rec  
)
int ap_core_translate ( request_rec r)
conn_rec* ap_create_slave_connection ( conn_rec c)

Create a slave connection

Parameters
cThe connection to create the slave connection from/for
Returns
The slave connection
void ap_custom_response ( request_rec r,
int  status,
const char *  string 
)

Install a custom response handler for a given status

Parameters
rThe current request
statusThe status for which the custom response should be used
stringThe custom response. This can be a static string, a file or a URL
const char* ap_document_root ( request_rec r)

Retrieve the document root for this server

Parameters
rThe current request
Warning
Don't use this! If your request went through a Userdir, or something like that, it'll screw you. But it's back-compatible...
Returns
The document root
int ap_exists_config_define ( const char *  name)

Check for a definition from the server command line

Parameters
nameThe define to check for
Returns
1 if defined, 0 otherwise
apr_socket_t* ap_get_conn_socket ( conn_rec c)

Get the socket from the core network filter. This should be used instead of accessing the core connection config directly.

Parameters
cThe connection record
Returns
The socket
void* ap_get_core_module_config ( const ap_conf_vector_t cv)

Accessor for core_module's specific data. Equivalent to ap_get_module_config(cv, &core_module) but more efficient.

Parameters
cvThe vector in which the modules configuration is stored. usually r->per_dir_config or s->module_config
Returns
The module-specific data
apr_off_t ap_get_limit_req_body ( const request_rec r)

Return the limit on bytes in request msg body

Parameters
rThe current request
Returns
the maximum number of bytes in the request msg body
apr_size_t ap_get_limit_xml_body ( const request_rec r)

Return the limit on bytes in XML request msg body

Parameters
rThe current request
Returns
the maximum number of bytes in XML request msg body
apr_size_t ap_get_read_buf_size ( const request_rec r)

Get the size of read buffers

Parameters
rThe current request
Returns
The read buffers size
const char* ap_get_remote_logname ( request_rec r)

Retrieve the login name of the remote user. Undef if it could not be determined

Parameters
rThe current request
Returns
The user logged in to the client machine
void** ap_get_request_note ( request_rec r,
apr_size_t  note_num 
)

Retrieve a pointer to an element in the core_request_config->notes array

Parameters
rThe request
note_numA key for the element: either a value obtained from ap_register_request_note() or one of the predefined AP_NOTE_* values.
Returns
NULL if the note_num is invalid, otherwise a pointer to the requested note element.
Remarks
At the start of a request, each note element is NULL. The handle provided by ap_get_request_note() is a pointer-to-pointer so that the caller can point the element to some app-specific data structure. The caller should guarantee that any such structure will last as long as the request itself.
const char* ap_get_server_name ( request_rec r)

Get the current server name from the request

Parameters
rThe current request
Returns
the server name
const char* ap_get_server_name_for_url ( request_rec r)

Get the current server name from the request for the purposes of using in a URL. If the server name is an IPv6 literal address, it will be returned in URL format (e.g., "[fe80::1]").

Parameters
rThe current request
Returns
the server name
apr_port_t ap_get_server_port ( const request_rec r)

Get the current server port

Parameters
rThe current request
Returns
The server's port
const char* ap_get_server_protocol ( server_rec s)
const char* ap_ident_lookup ( request_rec r)
int ap_is_recursion_limit_exceeded ( const request_rec r)

Check if the current request is beyond the configured max. number of redirects or subrequests

Parameters
rThe current request
Returns
true (is exceeded) or false
const char* ap_limit_section ( cmd_parms cmd,
void dummy,
const char *  arg 
)
void ap_logio_add_bytes_in ( conn_rec c,
apr_off_t  bytes 
)
void ap_logio_add_bytes_out ( conn_rec c,
apr_off_t  bytes 
)
apr_off_t ap_logio_get_last_bytes ( conn_rec c)
void ap_register_config_hooks ( apr_pool_t p)
void ap_register_errorlog_handler ( apr_pool_t p,
char *  tag,
ap_errorlog_handler_fn_t handler,
int  flags 
)

Register external errorlog handler

Parameters
pconfig pool to use
tagthe new format specifier (i.e. the letter after the %)
handlerthe handler function
flagsflags (reserved, set to 0)
void ap_register_log_hooks ( apr_pool_t p)
apr_size_t ap_register_request_note ( void  )

Reserve an element in the core_request_config->notes array for some application-specific data

Returns
An integer key that can be passed to ap_get_request_note() during request processing to access this element for the current request.
int ap_satisfies ( request_rec r)

How the requires lines must be met.

Parameters
rThe current request
Returns
How the requirements must be met. One of:
     SATISFY_ANY    – any of the requirements must be met.
     SATISFY_ALL    – all of the requirements must be met.
     SATISFY_NOSPEC – There are no applicable satisfy lines
void ap_set_core_module_config ( ap_conf_vector_t cv,
void val 
)

Accessor to set core_module's specific data. Equivalent to ap_set_module_config(cv, &core_module, val) but more efficient.

Parameters
cvThe vector in which the modules configuration is stored. usually r->per_dir_config or s->module_config
valThe module-specific data to set
void ap_set_server_protocol ( server_rec s,
const char *  proto 
)
int ap_state_query ( int  query_code)

Query the server for some state information

Parameters
query_codeWhich information is requested
Returns
the requested state information
const char* authn_ap_auth_name ( request_rec r)
const char* authn_ap_auth_type ( request_rec r)
int authz_some_auth_required ( request_rec r)
apr_status_t insert_network_bucket ( conn_rec c,
apr_bucket_brigade bb,
apr_socket_t socket 
)

Insert the network bucket into the core input filter's input brigade. This hook is intended for MPMs or protocol modules that need to do special socket setup.

Parameters
cThe connection
bbThe brigade to insert the bucket into
socketThe socket to put into a bucket
Returns
AP_DECLINED if the current function does not handle this connection, APR_SUCCESS or an error otherwise.

Variable Documentation

AP_DECLARE_DATA ap_filter_rec_t* ap_content_length_filter_handle
AP_DECLARE_DATA ap_filter_rec_t* ap_core_input_filter_handle
AP_DECLARE_DATA ap_filter_rec_t* ap_core_output_filter_handle
AP_DECLARE_DATA ap_filter_rec_t* ap_request_core_filter_handle
AP_DECLARE_DATA ap_filter_rec_t* ap_subreq_core_filter_handle
AP_DECLARE_DATA module core_module

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, another accessor.