Main Page | Modules | Namespace List | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages | Examples

vhost.c File Reference

#include "apr.h"
#include "apr_strings.h"
#include "apr_lib.h"
#include "apr_want.h"
#include "ap_config.h"
#include "httpd.h"
#include "http_config.h"
#include "http_log.h"
#include "http_vhost.h"
#include "http_protocol.h"
#include "http_core.h"

Include dependency graph for vhost.c:

Go to the source code of this file.

Defines

#define APR_WANT_STRFUNC
#define CORE_PRIVATE
#define IPHASH_TABLE_SIZE   256

Typedefs

typedef name_chain name_chain
typedef ipaddr_chain ipaddr_chain

Functions

 AP_DECLARE (void)
static const char * get_addresses (apr_pool_t *p, const char *w_, server_addr_rec ***paddr, apr_port_t default_port)
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)
static APR_INLINE unsigned hash_inaddr (unsigned key)
static APR_INLINE unsigned hash_addr (struct apr_sockaddr_t *sa)
static ipaddr_chainnew_ipaddr_chain (apr_pool_t *p, server_rec *s, server_addr_rec *sar)
static name_chainnew_name_chain (apr_pool_t *p, server_rec *s, server_addr_rec *sar)
static APR_INLINE ipaddr_chainfind_ipaddr (apr_sockaddr_t *sa)
static ipaddr_chainfind_default_server (apr_port_t port)
static void dump_a_vhost (apr_file_t *f, ipaddr_chain *ic)
static void dump_vhost_config (apr_file_t *f)
static int add_name_vhost_config (apr_pool_t *p, server_rec *main_s, server_rec *s, server_addr_rec *sar, ipaddr_chain *ic)
static void remove_unused_name_vhosts (server_rec *main_s, ipaddr_chain **pic)
static void fix_hostname (request_rec *r)
static int matches_aliases (server_rec *s, const char *host)
 AP_DECLARE (int)
static void check_hostalias (request_rec *r)
static void check_serverpath (request_rec *r)

Variables

static ipaddr_chainiphash_table [IPHASH_TABLE_SIZE]
static ipaddr_chaindefault_list
static server_addr_recname_vhost_list
static server_addr_rec ** name_vhost_list_tail


Define Documentation

#define APR_WANT_STRFUNC
 

Definition at line 26 of file vhost.c.

#define CORE_PRIVATE
 

Definition at line 29 of file vhost.c.

#define IPHASH_TABLE_SIZE   256
 

Definition at line 76 of file vhost.c.

Referenced by dump_vhost_config(), and hash_inaddr().


Typedef Documentation

typedef struct ipaddr_chain ipaddr_chain
 

Definition at line 61 of file vhost.c.

typedef struct name_chain name_chain
 

Definition at line 50 of file vhost.c.


Function Documentation

static int add_name_vhost_config apr_pool_t p,
server_rec main_s,
server_rec s,
server_addr_rec sar,
ipaddr_chain ic
[static]
 

Definition at line 466 of file vhost.c.

References APLOG_ERR, APLOG_MARK, server_addr_rec::host_port, ipaddr_chain::names, new_name_chain(), name_chain::next, NULL, ipaddr_chain::sar, ipaddr_chain::server, and server_addr_rec::virthost.

Here is the call graph for this function:

AP_DECLARE int   ) 
 

Get XML post data and parse it

Parameters:
r The current request
pdoc The XML post data
Returns:
HTTP status code int ap_xml_parse_input(request_rec *r, apr_xml_doc **pdoc)

Definition at line 813 of file vhost.c.

References server_rec::addrs, AP_DECLARE, server_addr_rec::host_port, matches_aliases(), server_addr_rec::next, server_rec::port, request_rec::server, strcasecmp(), and server_addr_rec::virthost.

Here is the call graph for this function:

AP_DECLARE void   ) 
 

Generic accessors for other modules to set at their own module-specific data

Parameters:
conf_vector The vector in which the modules configuration is stored. usually r->per_dir_config or s->module_config
m The module to set the data for.
val The module-specific data to set void ap_set_module_config(ap_conf_vector_t *cv, const module *m, void *val)

Definition at line 122 of file vhost.c.

References AP_DECLARE, and NULL.

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

handle addresses in <virtualhost> statement

Parameters:
p The pool to allocate out of
hostname The hostname in the VirtualHost statement
s The list of Virtual Hosts.

Definition at line 218 of file vhost.c.

References server_rec::addrs, err, get_addresses(), server_addr_rec::host_port, NULL, and server_rec::port.

Referenced by AP_CORE_DECLARE().

Here is the call graph for this function:

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

Definition at line 246 of file vhost.c.

References get_addresses().

Here is the call graph for this function:

static void check_hostalias request_rec r  )  [static]
 

Definition at line 854 of file vhost.c.

References request_rec::connection, host, server_addr_rec::host_port, request_rec::hostname, conn_rec::local_addr, matches_aliases(), name_chain::next, NULL, port, name_chain::sar, request_rec::server, name_chain::server, strcasecmp(), conn_rec::vhost_lookup_data, and server_addr_rec::virthost.

Here is the call graph for this function:

static void check_serverpath request_rec r  )  [static]
 

Definition at line 926 of file vhost.c.

References server_addr_rec::host_port, name_chain::next, NULL, server_rec::path, server_rec::pathlen, port, name_chain::sar, and name_chain::server.

static void dump_a_vhost apr_file_t f,
ipaddr_chain ic
[static]
 

Definition at line 398 of file vhost.c.

References APR_INET, DEFAULT_VHOST_ADDR, server_rec::defn_line_number, server_rec::defn_name, apr_sockaddr_t::family, ha, server_addr_rec::host_addr, server_addr_rec::host_port, len, MAX_STRING_LEN, ipaddr_chain::names, name_chain::next, NULL, apr_sockaddr_t::sa, name_chain::sar, ipaddr_chain::sar, name_chain::server, ipaddr_chain::server, and server_rec::server_hostname.

Referenced by dump_vhost_config().

static void dump_vhost_config apr_file_t f  )  [static]
 

Definition at line 444 of file vhost.c.

References dump_a_vhost(), IPHASH_TABLE_SIZE, and ipaddr_chain::next.

Here is the call graph for this function:

static ipaddr_chain* find_default_server apr_port_t  port  )  [static]
 

Definition at line 383 of file vhost.c.

References server_addr_rec::host_port, ipaddr_chain::next, NULL, and ipaddr_chain::sar.

static APR_INLINE ipaddr_chain* find_ipaddr apr_sockaddr_t sa  )  [static]
 

Definition at line 363 of file vhost.c.

References bucket, cur, hash_addr(), server_addr_rec::host_addr, ipaddr_chain::next, NULL, apr_sockaddr_t::port, and ipaddr_chain::sar.

Here is the call graph for this function:

static void fix_hostname request_rec r  )  [static]
 

Definition at line 702 of file vhost.c.

References APLOG_ERR, APLOG_MARK, apr_islower, apr_isupper, APR_SUCCESS, apr_tolower, bad, host, request_rec::hostname, HTTP_BAD_REQUEST, request_rec::parsed_uri, request_rec::pool, apr_uri_t::port, port, apr_uri_t::port_str, scope_id, and request_rec::status.

static const char* get_addresses apr_pool_t p,
const char *  w_,
server_addr_rec ***  paddr,
apr_port_t  default_port
[static]
 

Definition at line 138 of file vhost.c.

References ap_assert, APLOG_ERR, APLOG_MARK, APR_INET, apr_pcalloc, APR_SUCCESS, APR_UNSPEC, host, server_addr_rec::host_addr, server_addr_rec::host_port, apr_sockaddr_t::next, server_addr_rec::next, NULL, port, scope_id, strcasecmp(), and server_addr_rec::virthost.

Referenced by ap_parse_vhost_addrs(), and ap_set_name_virtual_host().

Here is the call graph for this function:

static APR_INLINE unsigned hash_addr struct apr_sockaddr_t sa  )  [static]
 

Definition at line 324 of file vhost.c.

References hash_inaddr(), and key.

Referenced by find_ipaddr().

Here is the call graph for this function:

static APR_INLINE unsigned hash_inaddr unsigned  key  )  [static]
 

Definition at line 318 of file vhost.c.

References IPHASH_TABLE_SIZE.

Referenced by hash_addr().

static int matches_aliases server_rec s,
const char *  host
[static]
 

Definition at line 773 of file vhost.c.

References apr_array_header_t::elts, name, server_rec::names, nelts, server_rec::server_hostname, strcasecmp(), and server_rec::wild_names.

Referenced by AP_DECLARE(), and check_hostalias().

Here is the call graph for this function:

static ipaddr_chain* new_ipaddr_chain apr_pool_t p,
server_rec s,
server_addr_rec sar
[static]
 

Definition at line 336 of file vhost.c.

References server_addr_rec::next, and NULL.

static name_chain* new_name_chain apr_pool_t p,
server_rec s,
server_addr_rec sar
[static]
 

Definition at line 350 of file vhost.c.

References server_addr_rec::next, and NULL.

Referenced by add_name_vhost_config().

static void remove_unused_name_vhosts server_rec main_s,
ipaddr_chain **  pic
[static]
 

Definition at line 496 of file vhost.c.

References APLOG_MARK, APLOG_WARNING, server_addr_rec::host_port, ipaddr_chain::names, ipaddr_chain::next, NULL, ipaddr_chain::sar, ipaddr_chain::server, and server_addr_rec::virthost.


Variable Documentation

ipaddr_chain* default_list [static]
 

Definition at line 92 of file vhost.c.

ipaddr_chain* iphash_table[IPHASH_TABLE_SIZE] [static]
 

Definition at line 86 of file vhost.c.

server_addr_rec* name_vhost_list [static]
 

Definition at line 95 of file vhost.c.

server_addr_rec** name_vhost_list_tail [static]
 

Definition at line 96 of file vhost.c.