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

Modules

 AJP API functions
 
 Private
 

Data Structures

struct  proxy_hcmethods_t
 
struct  proxy_wstat_t
 
struct  proxy_remote
 
struct  proxy_alias
 
struct  dirconn_entry
 
struct  noproxy_entry
 
struct  proxy_server_conf
 
struct  proxy_dir_conf
 
struct  proxy_req_conf
 
struct  proxy_conn_rec
 
struct  proxy_completion
 
struct  proxy_conn_pool
 
struct  proxy_hashes
 
struct  proxy_worker_shared
 
struct  proxy_worker
 
struct  proxy_balancer_shared
 
struct  proxy_balancer
 
struct  proxy_balancer_method
 

Macros

#define APR_WANT_STRFUNC
 
#define BALANCER_PREFIX   "balancer://"
 
#define CRLF   "\015\012"
 
#define DEFAULT_MAX_FORWARDS   -1
 
#define PROXYPASS_NOCANON   0x01
 
#define PROXYPASS_INTERPOLATE   0x02
 
#define PROXYPASS_NOQUERY   0x04
 
#define PROXY_WORKER_INITIALIZED   0x0001
 
#define PROXY_WORKER_IGNORE_ERRORS   0x0002
 
#define PROXY_WORKER_DRAIN   0x0004
 
#define PROXY_WORKER_GENERIC   0x0008
 
#define PROXY_WORKER_IN_SHUTDOWN   0x0010
 
#define PROXY_WORKER_DISABLED   0x0020
 
#define PROXY_WORKER_STOPPED   0x0040
 
#define PROXY_WORKER_IN_ERROR   0x0080
 
#define PROXY_WORKER_HOT_STANDBY   0x0100
 
#define PROXY_WORKER_FREE   0x0200
 
#define PROXY_WORKER_HC_FAIL   0x0400
 
#define PROXY_WORKER_INITIALIZED_FLAG   'O'
 
#define PROXY_WORKER_IGNORE_ERRORS_FLAG   'I'
 
#define PROXY_WORKER_DRAIN_FLAG   'N'
 
#define PROXY_WORKER_GENERIC_FLAG   'G'
 
#define PROXY_WORKER_IN_SHUTDOWN_FLAG   'U'
 
#define PROXY_WORKER_DISABLED_FLAG   'D'
 
#define PROXY_WORKER_STOPPED_FLAG   'S'
 
#define PROXY_WORKER_IN_ERROR_FLAG   'E'
 
#define PROXY_WORKER_HOT_STANDBY_FLAG   'H'
 
#define PROXY_WORKER_FREE_FLAG   'F'
 
#define PROXY_WORKER_HC_FAIL_FLAG   'C'
 
#define PROXY_WORKER_NOT_USABLE_BITMAP
 
#define PROXY_WORKER_IS_INITIALIZED(f)   ( (f)->s->status & PROXY_WORKER_INITIALIZED )
 
#define PROXY_WORKER_IS_STANDBY(f)   ( (f)->s->status & PROXY_WORKER_HOT_STANDBY )
 
#define PROXY_WORKER_IS_USABLE(f)
 
#define PROXY_WORKER_IS_DRAINING(f)   ( (f)->s->status & PROXY_WORKER_DRAIN )
 
#define PROXY_WORKER_IS_GENERIC(f)   ( (f)->s->status & PROXY_WORKER_GENERIC )
 
#define PROXY_WORKER_IS_HCFAILED(f)   ( (f)->s->status & PROXY_WORKER_HC_FAIL )
 
#define PROXY_WORKER_IS(f, b)   ( (f)->s->status & (b) )
 
#define PROXY_WORKER_DEFAULT_RETRY   60
 
#define PROXY_WORKER_MAX_SCHEME_SIZE   16
 
#define PROXY_WORKER_MAX_ROUTE_SIZE   96
 
#define PROXY_BALANCER_MAX_ROUTE_SIZE   64
 
#define PROXY_WORKER_MAX_NAME_SIZE   256
 
#define PROXY_BALANCER_MAX_NAME_SIZE   64
 
#define PROXY_WORKER_MAX_HOSTNAME_SIZE   96
 
#define PROXY_BALANCER_MAX_HOSTNAME_SIZE   64
 
#define PROXY_BALANCER_MAX_STICKY_SIZE   64
 
#define PROXY_WORKER_MAX_SECRET_SIZE   64
 
#define PROXY_WORKER_RFC1035_NAME_SIZE   512
 
#define PROXY_MAX_PROVIDER_NAME_SIZE   16
 
#define PROXY_STRNCPY(dst, src)   ap_proxy_strncpy((dst), (src), (sizeof(dst)))
 
#define PROXY_COPY_CONF_PARAMS(w, c)
 
#define PROXY_DO_100_CONTINUE(w, r)
 
#define ALIGNED_PROXY_WORKER_SHARED_SIZE   (APR_ALIGN_DEFAULT(sizeof(proxy_worker_shared)))
 
#define HCHECK_WATHCHDOG_DEFAULT_INTERVAL   (30)
 
#define HCHECK_WATHCHDOG_INTERVAL   (2)
 
#define PROXY_FLUSH_WAIT   10000
 
#define ALIGNED_PROXY_BALANCER_SHARED_SIZE   (APR_ALIGN_DEFAULT(sizeof(proxy_balancer_shared)))
 
#define PROXY_THREAD_LOCK(x)   ( (x) && (x)->tmutex ? apr_thread_mutex_lock((x)->tmutex) : APR_SUCCESS)
 
#define PROXY_THREAD_UNLOCK(x)   ( (x) && (x)->tmutex ? apr_thread_mutex_unlock((x)->tmutex) : APR_SUCCESS)
 
#define PROXY_GLOBAL_LOCK(x)   ( (x) && (x)->gmutex ? apr_global_mutex_lock((x)->gmutex) : APR_SUCCESS)
 
#define PROXY_GLOBAL_UNLOCK(x)   ( (x) && (x)->gmutex ? apr_global_mutex_unlock((x)->gmutex) : APR_SUCCESS)
 
#define PROXY_DECLARE(type)   type
 
#define PROXY_DECLARE_NONSTD(type)   type
 
#define PROXY_DECLARE_DATA
 
#define PROXY_DECLARE_OPTIONAL_HOOK   APR_DECLARE_EXTERNAL_HOOK
 
#define PROXY_CHECK_CONN_EMPTY   (1 << 0)
 
#define PROXY_LBMETHOD   "proxylbmethod"
 
#define PROXY_DYNAMIC_BALANCER_LIMIT   16
 

Typedefs

typedef struct proxy_balancer proxy_balancer
 
typedef struct proxy_worker proxy_worker
 
typedef struct proxy_conn_pool proxy_conn_pool
 
typedef struct
proxy_balancer_method 
proxy_balancer_method
 
typedef const char *(* ap_proxy_header_reverse_map_fn )(request_rec *, proxy_dir_conf *, const char *)
 

Enumerations

enum  enctype {
  enc_path, enc_search, enc_user, enc_fpath,
  enc_parm
}
 
enum  hcmethod_t {
  NONE, TCP, OPTIONS, HEAD,
  GET, CPING, PROVIDER, EOT
}
 
enum  proxy_hash_t { PROXY_HASHFUNC_DEFAULT, PROXY_HASHFUNC_APR, PROXY_HASHFUNC_FNV }
 

Functions

void hc_show_exprs (request_rec *)
 
void hc_select_exprs (request_rec *, const char *)
 
int hc_valid_expr (request_rec *, const char *)
 
const char * set_worker_hc_param (apr_pool_t *, server_rec *, proxy_worker *, const char *, const char *, void *)
 
 PROXY_DECLARE_OPTIONAL_HOOK (proxy, PROXY, int, section_post_config,(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s, ap_conf_vector_t *section_config)) int proxy_hook_scheme_handler(request_rec *r
 
int proxy_hook_canon_handler (request_rec *r, char *url)
 
 PROXY_DECLARE_OPTIONAL_HOOK (proxy, PROXY, int, create_req,(request_rec *r, request_rec *pr)) PROXY_DECLARE_OPTIONAL_HOOK(proxy
 
request_rec proxy_conn_rec
*backend int 
proxy_hook_pre_request (proxy_worker **worker, proxy_balancer **balancer, request_rec *r, proxy_server_conf *conf, char **url)
 
int proxy_hook_post_request (proxy_worker *worker, proxy_balancer *balancer, request_rec *r, proxy_server_conf *conf)
 
 PROXY_DECLARE_OPTIONAL_HOOK (proxy, PROXY, int, request_status,(int *status, request_rec *r)) apr_status_t ap_proxy_strncpy(char *dst
 
int ap_proxy_hex2c (const char *x)
 
void ap_proxy_c2hex (int ch, char *x)
 
char * ap_proxy_canonenc (apr_pool_t *p, const char *x, int len, enum enctype t, int forcedec, int proxyreq)
 
char * ap_proxy_canon_netloc (apr_pool_t *p, char **const urlp, char **userp, char **passwordp, char **hostp, apr_port_t *port)
 
int ap_proxyerror (request_rec *r, int statuscode, const char *message)
 
int ap_proxy_checkproxyblock (request_rec *r, proxy_server_conf *conf, const char *hostname, apr_sockaddr_t *addr)
 
int ap_proxy_pre_http_request (conn_rec *c, request_rec *r)
 
int ap_proxy_connect_to_backend (apr_socket_t **, const char *, apr_sockaddr_t *, const char *, proxy_server_conf *, request_rec *)
 
apr_status_t ap_proxy_ssl_connection_cleanup (proxy_conn_rec *conn, request_rec *r)
 
int ap_proxy_ssl_enable (conn_rec *c)
 
int ap_proxy_ssl_disable (conn_rec *c)
 
int ap_proxy_ssl_engine (conn_rec *c, ap_conf_vector_t *per_dir_config, int enable)
 
int ap_proxy_conn_is_https (conn_rec *c)
 
const char * ap_proxy_ssl_val (apr_pool_t *p, server_rec *s, conn_rec *c, request_rec *r, const char *var)
 
const char * ap_proxy_location_reverse_map (request_rec *r, proxy_dir_conf *conf, const char *url)
 
const char * ap_proxy_cookie_reverse_map (request_rec *r, proxy_dir_conf *conf, const char *str)
 
char * ap_proxy_worker_name (apr_pool_t *p, proxy_worker *worker)
 
proxy_workerap_proxy_get_worker (apr_pool_t *p, proxy_balancer *balancer, proxy_server_conf *conf, const char *url)
 
char * ap_proxy_define_worker (apr_pool_t *p, proxy_worker **worker, proxy_balancer *balancer, proxy_server_conf *conf, const char *url, int do_malloc)
 
char * ap_proxy_define_match_worker (apr_pool_t *p, proxy_worker **worker, proxy_balancer *balancer, proxy_server_conf *conf, const char *url, int do_malloc)
 
apr_status_t ap_proxy_share_worker (proxy_worker *worker, proxy_worker_shared *shm, int i)
 
apr_status_t ap_proxy_initialize_worker (proxy_worker *worker, server_rec *s, apr_pool_t *p)
 
int ap_proxy_valid_balancer_name (char *name, int i)
 
proxy_balancerap_proxy_get_balancer (apr_pool_t *p, proxy_server_conf *conf, const char *url, int careactive)
 
char * ap_proxy_update_balancer (apr_pool_t *p, proxy_balancer *balancer, const char *url)
 
char * ap_proxy_define_balancer (apr_pool_t *p, proxy_balancer **balancer, proxy_server_conf *conf, const char *url, const char *alias, int do_malloc)
 
apr_status_t ap_proxy_share_balancer (proxy_balancer *balancer, proxy_balancer_shared *shm, int i)
 
apr_status_t ap_proxy_initialize_balancer (proxy_balancer *balancer, server_rec *s, apr_pool_t *p)
 
proxy_worker_sharedap_proxy_find_workershm (ap_slotmem_provider_t *storage, ap_slotmem_instance_t *slot, proxy_worker *worker, unsigned int *index)
 
proxy_balancer_sharedap_proxy_find_balancershm (ap_slotmem_provider_t *storage, ap_slotmem_instance_t *slot, proxy_balancer *balancer, unsigned int *index)
 
int ap_proxy_pre_request (proxy_worker **worker, proxy_balancer **balancer, request_rec *r, proxy_server_conf *conf, char **url)
 
int ap_proxy_post_request (proxy_worker *worker, proxy_balancer *balancer, request_rec *r, proxy_server_conf *conf)
 
int ap_proxy_determine_connection (apr_pool_t *p, request_rec *r, proxy_server_conf *conf, proxy_worker *worker, proxy_conn_rec *conn, apr_uri_t *uri, char **url, const char *proxyname, apr_port_t proxyport, char *server_portstr, int server_portstr_size)
 
int ap_proxy_retry_worker (const char *proxy_function, proxy_worker *worker, server_rec *s)
 
int ap_proxy_acquire_connection (const char *proxy_function, proxy_conn_rec **conn, proxy_worker *worker, server_rec *s)
 
int ap_proxy_release_connection (const char *proxy_function, proxy_conn_rec *conn, server_rec *s)
 
apr_status_t ap_proxy_check_connection (const char *scheme, proxy_conn_rec *conn, server_rec *server, unsigned max_blank_lines, int flags)
 
int ap_proxy_connect_backend (const char *proxy_function, proxy_conn_rec *conn, proxy_worker *worker, server_rec *s)
 
apr_status_t ap_proxy_connect_uds (apr_socket_t *sock, const char *uds_path, apr_pool_t *p)
 
int ap_proxy_connection_create (const char *proxy_function, proxy_conn_rec *conn, conn_rec *c, server_rec *s)
 
int ap_proxy_connection_create_ex (const char *proxy_function, proxy_conn_rec *conn, request_rec *r)
 
int ap_proxy_connection_reusable (proxy_conn_rec *conn)
 
void ap_proxy_backend_broke (request_rec *r, apr_bucket_brigade *brigade)
 
unsigned int ap_proxy_hashfunc (const char *str, proxy_hash_t method)
 
apr_status_t ap_proxy_set_wstatus (char c, int set, proxy_worker *w)
 
char * ap_proxy_parse_wstatus (apr_pool_t *p, proxy_worker *w)
 
apr_status_t ap_proxy_sync_balancer (proxy_balancer *b, server_rec *s, proxy_server_conf *conf)
 
int ap_proxy_trans_match (request_rec *r, struct proxy_alias *ent, proxy_dir_conf *dconf)
 
int ap_proxy_create_hdrbrgd (apr_pool_t *p, apr_bucket_brigade *header_brigade, request_rec *r, proxy_conn_rec *p_conn, proxy_worker *worker, proxy_server_conf *conf, apr_uri_t *uri, char *url, char *server_portstr, char **old_cl_val, char **old_te_val)
 
int ap_proxy_pass_brigade (apr_bucket_alloc_t *bucket_alloc, request_rec *r, proxy_conn_rec *p_conn, conn_rec *origin, apr_bucket_brigade *bb, int flush)
 
int ap_proxy_clear_connection (request_rec *r, apr_table_t *headers)
 
int ap_proxy_is_socket_connected (apr_socket_t *socket)
 
int ap_proxy_lb_workers (void)
 
apr_port_t ap_proxy_port_of_scheme (const char *scheme)
 
const char * ap_proxy_show_hcmethod (hcmethod_t method)
 
const char * ap_proxy_de_socketfy (apr_pool_t *p, const char *url)
 
apr_status_t ap_proxy_buckets_lifetime_transform (request_rec *r, apr_bucket_brigade *from, apr_bucket_brigade *to)
 
apr_status_t ap_proxy_transfer_between_connections (request_rec *r, conn_rec *c_i, conn_rec *c_o, apr_bucket_brigade *bb_i, apr_bucket_brigade *bb_o, const char *name, int *sent, apr_off_t bsize, int after)
 

Variables

PROXY_DECLARE_DATA
proxy_hcmethods_t 
proxy_hcmethods []
 
PROXY_DECLARE_DATA proxy_wstat_t proxy_wstat_tbl []
 
proxy_workerworker
 
proxy_worker proxy_server_confconf
 
proxy_worker proxy_server_conf
char * 
url
 
proxy_worker proxy_server_conf
char const char * 
proxyhost
 
proxy_worker proxy_server_conf
char const char apr_port_t 
proxyport
 
 PROXY
 
 int
 
 detach_backend
 
request_recr
 
const char * src
 
const char apr_size_t dlen
 
module PROXY_DECLARE_DATA proxy_module
 

Detailed Description

Macro Definition Documentation

#define ALIGNED_PROXY_BALANCER_SHARED_SIZE   (APR_ALIGN_DEFAULT(sizeof(proxy_balancer_shared)))
#define ALIGNED_PROXY_WORKER_SHARED_SIZE   (APR_ALIGN_DEFAULT(sizeof(proxy_worker_shared)))
#define APR_WANT_STRFUNC
#define BALANCER_PREFIX   "balancer://"
#define CRLF   "\015\012"
#define DEFAULT_MAX_FORWARDS   -1
#define HCHECK_WATHCHDOG_DEFAULT_INTERVAL   (30)
#define HCHECK_WATHCHDOG_INTERVAL   (2)
#define PROXY_BALANCER_MAX_HOSTNAME_SIZE   64
#define PROXY_BALANCER_MAX_NAME_SIZE   64
#define PROXY_BALANCER_MAX_ROUTE_SIZE   64
#define PROXY_BALANCER_MAX_STICKY_SIZE   64
#define PROXY_CHECK_CONN_EMPTY   (1 << 0)
#define PROXY_COPY_CONF_PARAMS (   w,
 
)
Value:
do { \
(w)->s->timeout = (c)->timeout; \
(w)->s->timeout_set = (c)->timeout_set; \
(w)->s->recv_buffer_size = (c)->recv_buffer_size; \
(w)->s->recv_buffer_size_set = (c)->recv_buffer_size_set; \
(w)->s->io_buffer_size = (c)->io_buffer_size; \
(w)->s->io_buffer_size_set = (c)->io_buffer_size_set; \
} while (0)
#define PROXY_DECLARE (   type)    type
#define PROXY_DECLARE_DATA
#define PROXY_DECLARE_NONSTD (   type)    type
#define PROXY_DECLARE_OPTIONAL_HOOK   APR_DECLARE_EXTERNAL_HOOK
#define PROXY_DO_100_CONTINUE (   w,
  r 
)
Value:
((w)->s->ping_timeout_set \
&& (PROXYREQ_REVERSE == (r)->proxyreq) \
&& !(apr_table_get((r)->subprocess_env, "force-proxy-request-1.0")) \
request_rec * r
Definition: mod_proxy.h:617
const char * apr_table_get(const apr_table_t *t, const char *key)
#define PROXYREQ_REVERSE
Definition: httpd.h:1093
int ap_request_has_body(request_rec *r)
#define PROXY_DYNAMIC_BALANCER_LIMIT   16
#define PROXY_FLUSH_WAIT   10000
#define PROXY_GLOBAL_LOCK (   x)    ( (x) && (x)->gmutex ? apr_global_mutex_lock((x)->gmutex) : APR_SUCCESS)
#define PROXY_GLOBAL_UNLOCK (   x)    ( (x) && (x)->gmutex ? apr_global_mutex_unlock((x)->gmutex) : APR_SUCCESS)
#define PROXY_LBMETHOD   "proxylbmethod"
#define PROXY_MAX_PROVIDER_NAME_SIZE   16
#define PROXY_STRNCPY (   dst,
  src 
)    ap_proxy_strncpy((dst), (src), (sizeof(dst)))
#define PROXY_THREAD_LOCK (   x)    ( (x) && (x)->tmutex ? apr_thread_mutex_lock((x)->tmutex) : APR_SUCCESS)
#define PROXY_THREAD_UNLOCK (   x)    ( (x) && (x)->tmutex ? apr_thread_mutex_unlock((x)->tmutex) : APR_SUCCESS)
#define PROXY_WORKER_DEFAULT_RETRY   60
#define PROXY_WORKER_DISABLED   0x0020
#define PROXY_WORKER_DISABLED_FLAG   'D'
#define PROXY_WORKER_DRAIN   0x0004
#define PROXY_WORKER_DRAIN_FLAG   'N'
#define PROXY_WORKER_FREE   0x0200
#define PROXY_WORKER_FREE_FLAG   'F'
#define PROXY_WORKER_GENERIC   0x0008
#define PROXY_WORKER_GENERIC_FLAG   'G'
#define PROXY_WORKER_HC_FAIL   0x0400
#define PROXY_WORKER_HC_FAIL_FLAG   'C'
#define PROXY_WORKER_HOT_STANDBY   0x0100
#define PROXY_WORKER_HOT_STANDBY_FLAG   'H'
#define PROXY_WORKER_IGNORE_ERRORS   0x0002
#define PROXY_WORKER_IGNORE_ERRORS_FLAG   'I'
#define PROXY_WORKER_IN_ERROR   0x0080
#define PROXY_WORKER_IN_ERROR_FLAG   'E'
#define PROXY_WORKER_IN_SHUTDOWN   0x0010
#define PROXY_WORKER_IN_SHUTDOWN_FLAG   'U'
#define PROXY_WORKER_INITIALIZED   0x0001
#define PROXY_WORKER_INITIALIZED_FLAG   'O'
#define PROXY_WORKER_IS (   f,
 
)    ( (f)->s->status & (b) )
#define PROXY_WORKER_IS_DRAINING (   f)    ( (f)->s->status & PROXY_WORKER_DRAIN )
#define PROXY_WORKER_IS_GENERIC (   f)    ( (f)->s->status & PROXY_WORKER_GENERIC )
#define PROXY_WORKER_IS_HCFAILED (   f)    ( (f)->s->status & PROXY_WORKER_HC_FAIL )
#define PROXY_WORKER_IS_INITIALIZED (   f)    ( (f)->s->status & PROXY_WORKER_INITIALIZED )
#define PROXY_WORKER_IS_STANDBY (   f)    ( (f)->s->status & PROXY_WORKER_HOT_STANDBY )
#define PROXY_WORKER_IS_USABLE (   f)
Value:
( ( !( (f)->s->status & PROXY_WORKER_NOT_USABLE_BITMAP) ) && \
#define PROXY_WORKER_NOT_USABLE_BITMAP
Definition: mod_proxy.h:323
#define PROXY_WORKER_IS_INITIALIZED(f)
Definition: mod_proxy.h:328
#define PROXY_WORKER_MAX_HOSTNAME_SIZE   96
#define PROXY_WORKER_MAX_NAME_SIZE   256
#define PROXY_WORKER_MAX_ROUTE_SIZE   96
#define PROXY_WORKER_MAX_SCHEME_SIZE   16
#define PROXY_WORKER_MAX_SECRET_SIZE   64
#define PROXY_WORKER_NOT_USABLE_BITMAP
Value:
#define PROXY_WORKER_IN_ERROR
Definition: mod_proxy.h:305
#define PROXY_WORKER_DISABLED
Definition: mod_proxy.h:303
#define PROXY_WORKER_IN_SHUTDOWN
Definition: mod_proxy.h:302
#define PROXY_WORKER_HC_FAIL
Definition: mod_proxy.h:308
#define PROXY_WORKER_STOPPED
Definition: mod_proxy.h:304
#define PROXY_WORKER_RFC1035_NAME_SIZE   512
#define PROXY_WORKER_STOPPED   0x0040
#define PROXY_WORKER_STOPPED_FLAG   'S'
#define PROXYPASS_INTERPOLATE   0x02
#define PROXYPASS_NOCANON   0x01
#define PROXYPASS_NOQUERY   0x04

Typedef Documentation

typedef const char*(* ap_proxy_header_reverse_map_fn)(request_rec *, proxy_dir_conf *, const char *)
typedef struct proxy_worker proxy_worker

Enumeration Type Documentation

enum enctype
Enumerator
enc_path 
enc_search 
enc_user 
enc_fpath 
enc_parm 
enum hcmethod_t
Enumerator
NONE 
TCP 
OPTIONS 
HEAD 
GET 
CPING 
PROVIDER 
EOT 

Return a hash based on the passed string

Parameters
strstring to produce hash from
methodhashing method to use
Returns
hash as unsigned int
Enumerator
PROXY_HASHFUNC_DEFAULT 
PROXY_HASHFUNC_APR 
PROXY_HASHFUNC_FNV 

Function Documentation

int ap_proxy_acquire_connection ( const char *  proxy_function,
proxy_conn_rec **  conn,
proxy_worker worker,
server_rec s 
)

Acquire a connection from worker connection pool

Parameters
proxy_functioncalling proxy scheme (http, ajp, ...)
connacquired connection
workerworker used for obtaining connection
scurrent server record
Returns
OK or HTTP_XXX error
Note
If the connection limit has been reached, the function will block until a connection becomes available or the timeout has elapsed.
void ap_proxy_backend_broke ( request_rec r,
apr_bucket_brigade brigade 
)

Signal the upstream chain that the connection to the backend broke in the middle of the response. This is done by sending an error bucket with status HTTP_BAD_GATEWAY and an EOS bucket up the filter chain.

Parameters
rcurrent request record of client request
brigadeThe brigade that is sent through the output filter chain
Deprecated:
To be removed in v2.6.
apr_status_t ap_proxy_buckets_lifetime_transform ( request_rec r,
apr_bucket_brigade from,
apr_bucket_brigade to 
)
void ap_proxy_c2hex ( int  ch,
char *  x 
)
char* ap_proxy_canon_netloc ( apr_pool_t p,
char **const  urlp,
char **  userp,
char **  passwordp,
char **  hostp,
apr_port_t port 
)
char* ap_proxy_canonenc ( apr_pool_t p,
const char *  x,
int  len,
enum enctype  t,
int  forcedec,
int  proxyreq 
)
apr_status_t ap_proxy_check_connection ( const char *  scheme,
proxy_conn_rec conn,
server_rec server,
unsigned  max_blank_lines,
int  flags 
)

Check a connection to the backend

Parameters
schemecalling proxy scheme (http, ajp, ...)
connacquired connection
servercurrent server record
max_blank_lineshow many blank lines to consume, or zero for none (considered data)
flagsPROXY_CHECK_* bitmask
Returns
APR_SUCCESS: connection established, APR_ENOTEMPTY: connection established with data, APR_ENOSOCKET: not connected, APR_EINVAL: worker in error state (unusable), other: connection closed/aborted (remotely)
int ap_proxy_checkproxyblock ( request_rec r,
proxy_server_conf conf,
const char *  hostname,
apr_sockaddr_t addr 
)

Test whether the hostname/address of the request are blocked by the ProxyBlock configuration.

Parameters
rrequest
confserver configuration
hostnamehostname from request URI
addrresolved address of hostname, or NULL if not known
Returns
OK on success, or else an errro
int ap_proxy_clear_connection ( request_rec r,
apr_table_t headers 
)

Clear the headers referenced by the Connection header from the given table, and remove the Connection header.

Parameters
rrequest
headerstable of headers to clear
Returns
1 if "close" was present, 0 otherwise.
int ap_proxy_conn_is_https ( conn_rec c)
int ap_proxy_connect_backend ( const char *  proxy_function,
proxy_conn_rec conn,
proxy_worker worker,
server_rec s 
)

Make a connection to the backend

Parameters
proxy_functioncalling proxy scheme (http, ajp, ...)
connacquired connection
workerconnection worker
scurrent server record
Returns
OK or HTTP_XXX error
Note
In case the socket already exists for conn, just check the link status.
int ap_proxy_connect_to_backend ( apr_socket_t **  ,
const char *  ,
apr_sockaddr_t ,
const char *  ,
proxy_server_conf ,
request_rec  
)
apr_status_t ap_proxy_connect_uds ( apr_socket_t sock,
const char *  uds_path,
apr_pool_t p 
)

Make a connection to a Unix Domain Socket (UDS) path

Parameters
sockUDS to connect
uds_pathUDS path to connect to
ppool to make the sock addr
Returns
APR_SUCCESS or error status
int ap_proxy_connection_create ( const char *  proxy_function,
proxy_conn_rec conn,
conn_rec c,
server_rec s 
)

Make a connection record for backend connection

Parameters
proxy_functioncalling proxy scheme (http, ajp, ...)
connacquired connection
cclient connection record (unused, deprecated)
scurrent server record
Returns
OK or HTTP_XXX error
Note
The function will return immediately if conn->connection is already set,
int ap_proxy_connection_create_ex ( const char *  proxy_function,
proxy_conn_rec conn,
request_rec r 
)

Make a connection record for backend connection, using request dir config

Parameters
proxy_functioncalling proxy scheme (http, ajp, ...)
connacquired connection
rcurrent request record
Returns
OK or HTTP_XXX error
Note
The function will return immediately if conn->connection is already set,
int ap_proxy_connection_reusable ( proxy_conn_rec conn)

Determine if proxy connection can potentially be reused at the end of this request.

Parameters
connproxy connection
Returns
non-zero if reusable, 0 otherwise
Note
Even if this function returns non-zero, the connection may be subsequently marked for closure.
const char* ap_proxy_cookie_reverse_map ( request_rec r,
proxy_dir_conf conf,
const char *  str 
)
int ap_proxy_create_hdrbrgd ( apr_pool_t p,
apr_bucket_brigade header_brigade,
request_rec r,
proxy_conn_rec p_conn,
proxy_worker worker,
proxy_server_conf conf,
apr_uri_t uri,
char *  url,
char *  server_portstr,
char **  old_cl_val,
char **  old_te_val 
)

Create a HTTP request header brigade, old_cl_val and old_te_val as required.

Parameters
ppool
header_brigadeheader brigade to use/fill
rrequest
p_connproxy connection rec
workerselected worker
confper-server proxy config
uriuri
urlurl
server_portstrport as string
old_cl_valstored old content-len val
old_te_valstored old TE val
Returns
OK or HTTP_EXPECTATION_FAILED
const char* ap_proxy_de_socketfy ( apr_pool_t p,
const char *  url 
)

Strip a unix domain socket (UDS) prefix from the input URL

Parameters
ppool to allocate result from
urla URL potentially prefixed with a UDS path
Returns
URL with the UDS prefix removed
char* ap_proxy_define_balancer ( apr_pool_t p,
proxy_balancer **  balancer,
proxy_server_conf conf,
const char *  url,
const char *  alias,
int  do_malloc 
)

Define and Allocate space for the balancer to proxy configuration

Parameters
pmemory pool to allocate balancer from
balancerthe new balancer
confcurrent proxy server configuration
urlurl containing balancer name
aliasalias/fake-path to this balancer
do_malloctrue if shared struct should be malloced
Returns
error message or NULL if successful
char* ap_proxy_define_match_worker ( apr_pool_t p,
proxy_worker **  worker,
proxy_balancer balancer,
proxy_server_conf conf,
const char *  url,
int  do_malloc 
)

Define and Allocate space for the ap_strcmp_match()able worker to proxy configuration.

Parameters
pmemory pool to allocate worker from
workerthe new worker
balancerthe balancer that the worker belongs to
confcurrent proxy server configuration
urlurl containing worker name (produces match pattern)
do_malloctrue if shared struct should be malloced
Returns
error message or NULL if successful (*worker is new worker)
char* ap_proxy_define_worker ( apr_pool_t p,
proxy_worker **  worker,
proxy_balancer balancer,
proxy_server_conf conf,
const char *  url,
int  do_malloc 
)

Define and Allocate space for the worker to proxy configuration

Parameters
pmemory pool to allocate worker from
workerthe new worker
balancerthe balancer that the worker belongs to
confcurrent proxy server configuration
urlurl containing worker name
do_malloctrue if shared struct should be malloced
Returns
error message or NULL if successful (*worker is new worker)
int ap_proxy_determine_connection ( apr_pool_t p,
request_rec r,
proxy_server_conf conf,
proxy_worker worker,
proxy_conn_rec conn,
apr_uri_t uri,
char **  url,
const char *  proxyname,
apr_port_t  proxyport,
char *  server_portstr,
int  server_portstr_size 
)

Determine backend hostname and port

Parameters
pmemory pool used for processing
rcurrent request
confcurrent proxy server configuration
workerworker used for processing request
connproxy connection struct
uriprocessed uri
urlrequest url
proxynameare we connecting directly or via a proxy
proxyportproxy host port
server_portstrVia headers server port, must be non-NULL
server_portstr_sizesize of the server_portstr buffer; must be at least one, even if the protocol doesn't use this
Returns
OK or HTTP_XXX error
proxy_balancer_shared* ap_proxy_find_balancershm ( ap_slotmem_provider_t storage,
ap_slotmem_instance_t slot,
proxy_balancer balancer,
unsigned int index 
)

Find the shm of the balancer as needed

Parameters
storageslotmem provider
slotslotmem instance
balancerbalancer of shm to find
indexpointer to index within slotmem of balancer
Returns
pointer to shm of balancer, or NULL
proxy_worker_shared* ap_proxy_find_workershm ( ap_slotmem_provider_t storage,
ap_slotmem_instance_t slot,
proxy_worker worker,
unsigned int index 
)

Find the shm of the worker as needed

Parameters
storageslotmem provider
slotslotmem instance
workerworker to find
indexpointer to index within slotmem of worker
Returns
pointer to shm of worker, or NULL
proxy_balancer* ap_proxy_get_balancer ( apr_pool_t p,
proxy_server_conf conf,
const char *  url,
int  careactive 
)

Get the balancer from proxy configuration

Parameters
pmemory pool used for temporary storage while finding balancer
confcurrent proxy server configuration
urlurl to find the worker from; must have balancer:// prefix
careactivetrue if we care if the balancer is active or not
Returns
proxy_balancer or NULL if not found
proxy_worker* ap_proxy_get_worker ( apr_pool_t p,
proxy_balancer balancer,
proxy_server_conf conf,
const char *  url 
)

Get the worker from proxy configuration

Parameters
pmemory pool used for finding worker
balancerthe balancer that the worker belongs to
confcurrent proxy server configuration
urlurl to find the worker from
Returns
proxy_worker or NULL if not found
unsigned int ap_proxy_hashfunc ( const char *  str,
proxy_hash_t  method 
)
int ap_proxy_hex2c ( const char *  x)
apr_status_t ap_proxy_initialize_balancer ( proxy_balancer balancer,
server_rec s,
apr_pool_t p 
)

Initialize the balancer as needed

Parameters
balancerbalancer to initialize
scurrent server record
pmemory pool used for mutex and connection pool
Returns
APR_SUCCESS or error code
apr_status_t ap_proxy_initialize_worker ( proxy_worker worker,
server_rec s,
apr_pool_t p 
)

Initialize the worker by setting up worker connection pool and mutex

Parameters
workerworker to initialize
scurrent server record
pmemory pool used for mutex and connection pool
Returns
APR_SUCCESS or error code
int ap_proxy_is_socket_connected ( apr_socket_t socket)
Parameters
socketsocket to test
Returns
TRUE if socket is connected/active
int ap_proxy_lb_workers ( void  )

Calculate maximum number of workers in scoreboard.

Returns
number of workers to allocate in the scoreboard
const char* ap_proxy_location_reverse_map ( request_rec r,
proxy_dir_conf conf,
const char *  url 
)
char* ap_proxy_parse_wstatus ( apr_pool_t p,
proxy_worker w 
)

Create readable representation of worker status bitfield

Parameters
ppool
wworker to use
Returns
string representation of status
int ap_proxy_pass_brigade ( apr_bucket_alloc_t bucket_alloc,
request_rec r,
proxy_conn_rec p_conn,
conn_rec origin,
apr_bucket_brigade bb,
int  flush 
)
Parameters
bucket_allocbucket allocator
rrequest
p_connproxy connection
originconnection rec of origin
bbbrigade to send to origin
flushflush
Returns
status (OK)
apr_port_t ap_proxy_port_of_scheme ( const char *  scheme)

Return the port number of a known scheme (eg: http -> 80).

Parameters
schemescheme to test
Returns
port number or 0 if unknown
int ap_proxy_post_request ( proxy_worker worker,
proxy_balancer balancer,
request_rec r,
proxy_server_conf conf 
)

Post request worker and balancer cleanup

Parameters
workerworker used for processing request
balancerbalancer used for processing request
rcurrent request
confcurrent proxy server configuration
Returns
OK or HTTP_XXX error
Note
Whenever the pre_request is called, the post_request has to be called too.
int ap_proxy_pre_http_request ( conn_rec c,
request_rec r 
)
int ap_proxy_pre_request ( proxy_worker **  worker,
proxy_balancer **  balancer,
request_rec r,
proxy_server_conf conf,
char **  url 
)

Get the most suitable worker and/or balancer for the request

Parameters
workerworker used for processing request
balancerbalancer used for processing request
rcurrent request
confcurrent proxy server configuration
urlrequest url that balancer can rewrite.
Returns
OK or HTTP_XXX error
Note
It calls balancer pre_request hook if the url starts with balancer:// The balancer then rewrites the url to particular worker, like http://host:port
int ap_proxy_release_connection ( const char *  proxy_function,
proxy_conn_rec conn,
server_rec s 
)

Release a connection back to worker connection pool

Parameters
proxy_functioncalling proxy scheme (http, ajp, ...)
connacquired connection
scurrent server record
Returns
OK or HTTP_XXX error
Note
The connection will be closed if conn->close_on_release is set
int ap_proxy_retry_worker ( const char *  proxy_function,
proxy_worker worker,
server_rec s 
)

Mark a worker for retry

Parameters
proxy_functioncalling proxy scheme (http, ajp, ...)
workerworker used for retrying
scurrent server record
Returns
OK if marked for retry, DECLINED otherwise
Note
The error status of the worker will cleared if the retry interval has elapsed since the last error.
apr_status_t ap_proxy_set_wstatus ( char  c,
int  set,
proxy_worker w 
)

Set/unset the worker status bitfield depending on flag

Parameters
cflag
setset or unset bit
wworker to use
Returns
APR_SUCCESS if valid flag
apr_status_t ap_proxy_share_balancer ( proxy_balancer balancer,
proxy_balancer_shared shm,
int  i 
)

Share a defined proxy balancer via shm

Parameters
balancerbalancer to be shared
shmlocation of shared info
iindex into shm
Returns
APR_SUCCESS or error code
apr_status_t ap_proxy_share_worker ( proxy_worker worker,
proxy_worker_shared shm,
int  i 
)

Share a defined proxy worker via shm

Parameters
workerworker to be shared
shmlocation of shared info
iindex into shm
Returns
APR_SUCCESS or error code
const char* ap_proxy_show_hcmethod ( hcmethod_t  method)

Return the name of the health check method (eg: "OPTIONS").

Parameters
methodmethod enum
Returns
name of method
apr_status_t ap_proxy_ssl_connection_cleanup ( proxy_conn_rec conn,
request_rec r 
)
int ap_proxy_ssl_disable ( conn_rec c)
int ap_proxy_ssl_enable ( conn_rec c)
int ap_proxy_ssl_engine ( conn_rec c,
ap_conf_vector_t per_dir_config,
int  enable 
)
const char* ap_proxy_ssl_val ( apr_pool_t p,
server_rec s,
conn_rec c,
request_rec r,
const char *  var 
)
apr_status_t ap_proxy_sync_balancer ( proxy_balancer b,
server_rec s,
proxy_server_conf conf 
)

Sync balancer and workers based on any updates w/i shm

Parameters
bbalancer to check/update member list of
sserver rec
confconfig
Returns
APR_SUCCESS if all goes well
int ap_proxy_trans_match ( request_rec r,
struct proxy_alias ent,
proxy_dir_conf dconf 
)

Find the matched alias for this request and setup for proxy handler

Parameters
rrequest
entproxy_alias record
dconfper-dir config or NULL
Returns
DECLINED, DONE or OK if matched
apr_status_t ap_proxy_transfer_between_connections ( request_rec r,
conn_rec c_i,
conn_rec c_o,
apr_bucket_brigade bb_i,
apr_bucket_brigade bb_o,
const char *  name,
int sent,
apr_off_t  bsize,
int  after 
)
char* ap_proxy_update_balancer ( apr_pool_t p,
proxy_balancer balancer,
const char *  url 
)

Update the balancer's vhost related fields

Parameters
pmemory pool used for temporary storage while finding balancer
balancerbalancer to be updated
urlurl to find vhost info
Returns
error string or NULL if OK
int ap_proxy_valid_balancer_name ( char *  name,
int  i 
)

Verifies valid balancer name (eg: balancer://foo)

Parameters
namename to test
inumber of chars to test; 0 for all.
Returns
true/false
char* ap_proxy_worker_name ( apr_pool_t p,
proxy_worker worker 
)

Return the user-land, UDS aware worker name

Parameters
pmemory pool used for displaying worker name
workerthe worker
Returns
name
int ap_proxyerror ( request_rec r,
int  statuscode,
const char *  message 
)
void hc_select_exprs ( request_rec ,
const char *   
)
void hc_show_exprs ( request_rec )
int hc_valid_expr ( request_rec ,
const char *   
)
PROXY_DECLARE_OPTIONAL_HOOK ( proxy  ,
PROXY  ,
int  ,
section_post_config  ,
(apr_pool_t *p, apr_pool_t *plog,apr_pool_t *ptemp, server_rec *s,ap_conf_vector_t *section_config)   
)
PROXY_DECLARE_OPTIONAL_HOOK ( proxy  ,
PROXY  ,
int  ,
create_req  ,
(request_rec *r, request_rec *pr)   
)

Let modules perform processing when the connection to the origin is being detached from the request.

Parameters
rThe client request
backendThe proxy representation of the backend connection
PROXY_DECLARE_OPTIONAL_HOOK ( proxy  ,
PROXY  ,
int  ,
request_status  ,
(int *status, request_rec *r  
)

request status hook It is called after all proxy processing has been done. This gives other modules a chance to create default content on failure, for example

int proxy_hook_canon_handler ( request_rec r,
char *  url 
)
int proxy_hook_post_request ( proxy_worker worker,
proxy_balancer balancer,
request_rec r,
proxy_server_conf conf 
)

post request hook. It is called after request for updating runtime balancer status.

request_rec proxy_conn_rec* backend int proxy_hook_pre_request ( proxy_worker **  worker,
proxy_balancer **  balancer,
request_rec r,
proxy_server_conf conf,
char **  url 
)

pre request hook. It will return the most suitable worker at the moment and corresponding balancer. The url is rewritten from balancer://cluster/uri to scheme://host:port/uri and then the scheme_handler is called.

const char* set_worker_hc_param ( apr_pool_t ,
server_rec ,
proxy_worker ,
const char *  ,
const char *  ,
void  
)

Variable Documentation

detach_backend
const char apr_size_t dlen
int
PROXY
module PROXY_DECLARE_DATA proxy_module
PROXY_DECLARE_DATA proxy_wstat_t proxy_wstat_tbl[]
proxy_worker proxy_server_conf char const char* proxyhost
proxy_worker proxy_server_conf char const char apr_port_t proxyport
const char* src
proxy_worker* worker