Apache HTTPD
Macros | Functions | Variables
Connection Library

Macros

#define AP_BUCKET_IS_EOC(e)   (e->type == &ap_bucket_type_eoc)
 

Functions

 AP_CORE_DECLARE (void) ap_process_connection(conn_rec *c
 
 AP_CORE_DECLARE (apr_status_t) ap_shutdown_conn(conn_rec *c
 
 AP_DECLARE (void) ap_lingering_close(conn_rec *c)
 
 AP_DECLARE (int) ap_prep_lingering_close(conn_rec *c)
 
 AP_DECLARE_HOOK (conn_rec *, create_connection,(apr_pool_t *p, server_rec *server, apr_socket_t *csd, long conn_id, void *sbh, apr_bucket_alloc_t *alloc)) AP_DECLARE(int) ap_pre_connection(conn_rec *c
 
 AP_DECLARE (apr_bucket *) ap_bucket_eoc_make(apr_bucket *b)
 

Variables

void * csd
 
int flush
 
AP_DECLARE_DATA const apr_bucket_type_t ap_bucket_type_eoc
 

Detailed Description

Macro Definition Documentation

◆ AP_BUCKET_IS_EOC

#define AP_BUCKET_IS_EOC (   e)    (e->type == &ap_bucket_type_eoc)

Determine if a bucket is an End Of Connection (EOC) bucket

Parameters
eThe bucket to inspect
Returns
true or false

Definition at line 161 of file http_connection.h.

Function Documentation

◆ AP_CORE_DECLARE() [1/2]

AP_CORE_DECLARE ( apr_status_t  )

Shutdown the connection for writing.

Parameters
cThe connection to shutdown
flushWhether or not to flush pending data before
Returns
APR_SUCCESS or the underlying error

◆ AP_CORE_DECLARE() [2/2]

AP_CORE_DECLARE ( void  )

This is the protocol module driver. This calls all of the pre-connection and connection hooks for all protocol modules.

Parameters
cThe connection on which the request is read
csdThe mechanism on which this connection is to be read. Most times this will be a socket, but it is up to the module that accepts the request to determine the exact type.

Flushes all remain data in the client send buffer

Parameters
cThe connection to flush
Remarks
calls ap_shutdown_conn(c, 1)

◆ AP_DECLARE() [1/3]

AP_DECLARE ( apr_bucket )

Make the bucket passed in an End Of Connection (EOC) bucket

Parameters
bThe bucket to make into an EOC bucket
Returns
The new bucket, or NULL if allocation failed

Create a bucket referring to an End Of Connection (EOC). This indicates that the connection will be closed.

Parameters
listThe freelist from which this bucket should be allocated
Returns
The new bucket, or NULL if allocation failed

◆ AP_DECLARE() [2/3]

AP_DECLARE ( int  )

Get default compile flags

Returns
Bitwise OR of AP_REG_* flags

Get the AP_REG_* corresponding to the string.

Parameters
nameThe name (i.e. AP_REG_<name>)
Returns
The AP_REG_*, or zero if the string is unknown

Compile a regular expression.

Parameters
pregReturned compiled regex
regexThe regular expression string
cflagsBitwise OR of AP_REG_* flags (ICASE and NEWLINE supported, other flags are ignored)
Returns
Zero on success or non-zero on error

Match a NUL-terminated string against a pre-compiled regex.

Parameters
pregThe pre-compiled regex
stringThe string to match
nmatchProvide information regarding the location of any matches
pmatchProvide information regarding the location of any matches
eflagsBitwise OR of AP_REG_* flags (NOTBOL and NOTEOL supported, other flags are ignored)
Returns
0 for successful match, AP_REG_NOMATCH otherwise

Match a string with given length against a pre-compiled regex. The string does not need to be NUL-terminated.

Parameters
pregThe pre-compiled regex
buffThe string to match
lenLength of the string to match
nmatchProvide information regarding the location of any matches
pmatchProvide information regarding the location of any matches
eflagsBitwise OR of AP_REG_* flags (NOTBOL and NOTEOL supported, other flags are ignored)
Returns
0 for successful match, AP_REG_NOMATCH otherwise

Return an array of named regex backreferences

Parameters
pregThe precompiled regex
namesThe array to which the names will be added
prefixAn optional prefix to add to the returned names. AP_REG_MATCH is the recommended prefix.
upperIf non zero, uppercase the names

Apply a regexp operation to a string.

Parameters
poolPool to allocate from
rxThe regex match to apply
patternThe string to apply it to NOTE: This MUST be kept in scope to use regexp memory
newpatternThe modified string (ignored if the operation doesn't modify the string)
Returns
Number of times a match happens. Normally 0 (no match) or 1 (match found), but may be greater if a transforming pattern is applied with the 'g' flag.

For every virtual host on this connection, call func_cb.

Parameters
connThe current connection
func_cbFunction called for every Name Based Virtual Host for this connection.
batonOpaque object passed to func_cb.
Returns
The return value from func_cb.
Note
If func_cb returns non-zero, the function will return at this point, and not continue iterating the virtual hosts.

Updates r->server with the best name-based virtual host match, within the chain of matching virtual hosts selected by ap_update_vhost_given_ip.

Parameters
rThe current request
require_match1 to return an HTTP error if the requested hostname is not explicitly matched to a VirtualHost.
Returns
return HTTP_OK unless require_match was specified and the requested hostname did not match any ServerName, ServerAlias, or VirtualHost address-spec.

Match the host in the header with the hostname of the server for this request.

Parameters
rThe current request
hostThe hostname in the headers
portThe port from the headers
Returns
return 1 if the host:port matches any of the aliases of r->server, return 0 otherwise

◆ AP_DECLARE() [3/3]

AP_DECLARE ( void  )

This function is responsible for the following cases:

we now proceed to read from the client until we get EOF, or until
MAX_SECS_TO_LINGER has passed.  The reasons for doing this are
documented in a draft:

http://tools.ietf.org/html/draft-ietf-http-connection-00.txt

in a nutshell -- if we don't make this effort we risk causing
TCP RST packets to be sent which can tear down a connection before
all the response data has been sent to the client.
Parameters
cThe connection we are closing

Set default compile flags

Parameters
cflagsBitwise OR of AP_REG_* flags

Destroy a pre-compiled regex.

Parameters
pregThe pre-compiled regex to free.

Get a pointer to a match from regex memory NOTE: this relies on the match pattern from the last call to ap_rxplus_exec still being valid (i.e. not freed or out-of-scope)

Parameters
rxThe regexp
nThe match number to retrieve (must be between 0 and nmatch)
lenReturns the length of the match.
matchReturns the match pattern

called before any config is read

Parameters
pPool to allocate out of

called after the config has been read to compile the tables needed to do the run-time vhost lookups

Parameters
pThe pool to allocate out of
main_serverThe start of the virtual host list

given an ip address only, give our best guess as to what vhost it is

Parameters
connThe current connection

ap_update_vhost_given_ip is never enough, and this is always called after the headers have been read. It may change r->server.

Parameters
rThe current request

◆ AP_DECLARE_HOOK()

AP_DECLARE_HOOK ( conn_rec ,
create_connection  ,
(apr_pool_t *p, server_rec *server, apr_socket_t *csd, long conn_id, void *sbh, apr_bucket_alloc_t *alloc)   
)

create_connection is a RUN_FIRST hook which allows modules to create connections. In general, you should not install filters with the create_connection hook. If you require vhost configuration information to make filter installation decisions, you must use the pre_connection or install_network_transport hook. This hook should close the connection if it encounters a fatal error condition.

Parameters
pThe pool from which to allocate the connection record
serverThe server record to create the connection too.
csdThe socket that has been accepted
conn_idA unique identifier for this connection. The ID only needs to be unique at that time, not forever.
sbhA handle to scoreboard information for this connection.
allocThe bucket allocator to use for all bucket/brigade creations
Returns
An allocated connection record or NULL. This hook gives protocol modules an opportunity to set everything up before calling the protocol handler. All pre-connection hooks are run until one returns something other than ok or decline
Parameters
cThe connection on which the request has been received.
csdThe mechanism on which this connection is to be read. Most times this will be a socket, but it is up to the module that accepts the request to determine the exact type.
Returns
OK or DECLINED This hook implements different protocols. After a connection has been established, the protocol module must read and serve the request. This function does that for each protocol module. The first protocol module to handle the request is the last module run.
Parameters
cThe connection on which the request has been received.
Returns
OK or DECLINED This hook implements different protocols. Before a connection is closed, protocols might have to perform some housekeeping actions, such as sending one last goodbye packet. The connection is, unless some other error already happened before, still open and operational. All pre-close-connection hooks are run until one returns something other than ok or decline
Parameters
cThe connection on which the request has been received.
Returns
OK or DECLINED This is a wrapper around ap_run_pre_connection. In case that ap_run_pre_connection returns an error it marks the connection as aborted and ensures that the basic connection setup normally done by the core module is done in case it was not done so far.
Parameters
cThe connection on which the request has been received. Same as for the pre_connection hook.
csdThe mechanism on which this connection is to be read. Most times this will be a socket, but it is up to the module that accepts the request to determine the exact type. Same as for the pre_connection hook.
Returns
The result of ap_run_pre_connection

Variable Documentation

◆ ap_bucket_type_eoc

AP_DECLARE_DATA const apr_bucket_type_t ap_bucket_type_eoc
extern

End Of Connection (EOC) bucket

Definition at line 48 of file eoc_bucket.c.

◆ csd

void * csd

Definition at line 44 of file http_connection.h.

◆ flush

int flush

Definition at line 52 of file http_connection.h.