Apache2
Virtual Host Package
Collaboration diagram for Virtual Host Package:

Typedefs

typedef int(* ap_vhost_iterate_conn_cb) (void *baton, conn_rec *conn, server_rec *s)
 

Functions

void ap_init_vhost_config (apr_pool_t *p)
 
void ap_fini_vhost_config (apr_pool_t *p, server_rec *main_server)
 
const char * ap_parse_vhost_addrs (apr_pool_t *p, const char *hostname, server_rec *s)
 
const char * ap_set_name_virtual_host (cmd_parms *cmd, void *dummy, const char *arg)
 
int ap_vhost_iterate_given_conn (conn_rec *conn, ap_vhost_iterate_conn_cb func_cb, void *baton)
 
void ap_update_vhost_given_ip (conn_rec *conn)
 
void ap_update_vhost_from_headers (request_rec *r)
 
int ap_update_vhost_from_headers_ex (request_rec *r, int require_match)
 
int ap_matches_request_vhost (request_rec *r, const char *host, apr_port_t port)
 

Detailed Description

Typedef Documentation

◆ ap_vhost_iterate_conn_cb

typedef int(* ap_vhost_iterate_conn_cb) (void *baton, conn_rec *conn, server_rec *s)

Callback function for every Name Based Virtual Host.

Parameters
batonOpaque user object
connThe current Connection
sThe current Server
See also
ap_vhost_iterate_given_conn
Returns
0 on success, any non-zero return will stop the iteration.

Function Documentation

◆ ap_fini_vhost_config()

void ap_fini_vhost_config ( apr_pool_t p,
server_rec main_server 
)

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

◆ ap_init_vhost_config()

void ap_init_vhost_config ( apr_pool_t p)

called before any config is read

Parameters
pPool to allocate out of

◆ ap_matches_request_vhost()

int ap_matches_request_vhost ( request_rec r,
const char *  host,
apr_port_t  port 
)

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_parse_vhost_addrs()

const char* ap_parse_vhost_addrs ( apr_pool_t p,
const char *  hostname,
server_rec s 
)

handle addresses in "<VirtualHost>" statement

Parameters
pThe pool to allocate out of
hostnameThe hostname in the VirtualHost statement
sThe list of Virtual Hosts.

◆ ap_set_name_virtual_host()

const char* ap_set_name_virtual_host ( cmd_parms cmd,
void *  dummy,
const char *  arg 
)

handle NameVirtualHost directive

Parameters
cmdCommand Parameters structure
dummyNOT USED
arga host of the form "<address>[:port]"

◆ ap_update_vhost_from_headers()

void ap_update_vhost_from_headers ( request_rec r)

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_update_vhost_from_headers_ex()

int ap_update_vhost_from_headers_ex ( request_rec r,
int  require_match 
)

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.

◆ ap_update_vhost_given_ip()

void ap_update_vhost_given_ip ( conn_rec conn)

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

Parameters
connThe current connection

◆ ap_vhost_iterate_given_conn()

int ap_vhost_iterate_given_conn ( conn_rec conn,
ap_vhost_iterate_conn_cb  func_cb,
void *  baton 
)

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.