mod_proxy.h revision 8598609b666f19b7948b3f1ef24fe9ddc504ce72
0f99afe251428a5600a8919dd42b26bdf8359172nd/* Licensed to the Apache Software Foundation (ASF) under one or more
0f99afe251428a5600a8919dd42b26bdf8359172nd * contributor license agreements. See the NOTICE file distributed with
0f99afe251428a5600a8919dd42b26bdf8359172nd * this work for additional information regarding copyright ownership.
a99c5d4cc3cab6a62b04d52000dbc22ce1fa2d94coar * The ASF licenses this file to You under the Apache License, Version 2.0
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd * (the "License"); you may not use this file except in compliance with
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd * the License. You may obtain a copy of the License at
031b91a62d25106ae69d4693475c79618dd5e884fielding * Unless required by applicable law or agreed to in writing, software
031b91a62d25106ae69d4693475c79618dd5e884fielding * distributed under the License is distributed on an "AS IS" BASIS,
031b91a62d25106ae69d4693475c79618dd5e884fielding * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd * See the License for the specific language governing permissions and
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd * limitations under the License.
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd * @brief Proxy Extension Module for Apache
0f99afe251428a5600a8919dd42b26bdf8359172nd * @defgroup MOD_PROXY mod_proxy
0f99afe251428a5600a8919dd42b26bdf8359172nd * @ingroup APACHE_MODS
0f99afe251428a5600a8919dd42b26bdf8359172nd/* for proxy_canonenc() */
0f99afe251428a5600a8919dd42b26bdf8359172nd#else /*APR_CHARSET_EBCDIC*/
0f99afe251428a5600a8919dd42b26bdf8359172nd#endif /*APR_CHARSET_EBCDIC*/
0f99afe251428a5600a8919dd42b26bdf8359172nd/* default Max-Forwards header setting */
0f99afe251428a5600a8919dd42b26bdf8359172nd/* Set this to -1, which complies with RFC2616 by not setting
0f99afe251428a5600a8919dd42b26bdf8359172nd * max-forwards if the client didn't send it to us.
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniaktypedef struct proxy_balancer_method proxy_balancer_method;
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak/* static information about a remote proxy */
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak const char *scheme; /* the schemes handled by this proxy, or '*' */
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak const char *protocol; /* the scheme used to talk to this proxy */
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak const char *hostname; /* the hostname of this proxy */
6aadbc6fd703e73d1d419e9f06b84a4338c898f1maczniak ap_regex_t *regexp; /* compiled regex (if any) for the remote */
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak int use_regex; /* simple boolean. True if we have a regex pattern */
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak const char *real;
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak const char *fake;
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak unsigned int flags;
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak proxy_balancer *balancer; /* only valid for reverse-proxys */
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak int (*matcher) (struct dirconn_entry * This, request_rec *r);
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak const char *name;
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniaktypedef struct {
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak apr_array_header_t *workers; /* non-balancer workers, eg ProxyPass http://example.com */
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak apr_array_header_t *balancers; /* list of balancers @ config time */
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak proxy_worker *reverse; /* reverse "module-driven" proxy worker */
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak const char *domain; /* domain name to use in absence of a domain name in the request */
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak const char *id;
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak apr_pool_t *pool; /* Pool used for allocating this struct's elements */
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak int max_balancers; /* maximum number of allowed balancers */
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak int bgrowth; /* number of post-config balancers can added */
signed char interpolate_env;
const char *hostname;
struct proxy_conn_pool {
/* Keep below in sync with proxy_util.c! */
#define PROXY_COPY_CONF_PARAMS(w, c) \
unsigned int def;
unsigned int fnv;
} proxy_hashes ;
apr_interval_time_t acquire; /* acquire timeout when the maximum number of connections is exceeded */
struct proxy_worker {
struct proxy_balancer {
struct proxy_balancer_method {
request_rec *r);
#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)
#if !defined(WIN32)
#define PROXY_DECLARE_DATA
#define PROXY_DECLARE_DATA
char *url))
request_rec *r,
/* proxy_util.c */
PROXY_DECLARE(int) ap_proxy_connect_to_backend(apr_socket_t **, const char *, apr_sockaddr_t *, const char *, proxy_server_conf *, request_rec *);
request_rec *r);
PROXY_DECLARE(const char *) ap_proxy_ssl_val(apr_pool_t *p, server_rec *s, conn_rec *c, request_rec *r, const char *var);
PROXY_DECLARE(const char *) ap_proxy_location_reverse_map(request_rec *r, proxy_dir_conf *conf, const char *url);
PROXY_DECLARE(const char *) ap_proxy_cookie_reverse_map(request_rec *r, proxy_dir_conf *conf, const char *str);
#if !defined(WIN32)
proxy_dir_conf *, const char *);
proxy_dir_conf *, const char *);
proxy_dir_conf *, const char *);
proxy_dir_conf *, const char *);
const char *url);
const char *url,
int do_malloc);
const char *url,
int do_malloc);
server_rec *s,
apr_pool_t *p);
const char *url,
int careactive);
const char *url);
const char *url,
const char *alias,
int do_malloc);
server_rec *s,
apr_pool_t *p);
unsigned int *index);
unsigned int *index);
* The balancer then rewrites the url to particular worker, like http://host:port
request_rec *r,
char **url);
request_rec *r,
char **url,
const char *proxyname,
char *server_portstr,
int server_portstr_size);
server_rec *s);
server_rec *s);
server_rec *s);
const char *uds_path,
apr_pool_t *p);
server_rec *s,
request_rec *r,
char **old_cl_val,
char **old_te_val);
int flush);
int ap_proxy_lb_workers(void);