proxy_util.c revision 908ecf69cda35db1070860f5921bb73a5a571751
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/* Licensed to the Apache Software Foundation (ASF) under one or more
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * contributor license agreements. See the NOTICE file distributed with
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * this work for additional information regarding copyright ownership.
b99dbaab171d91e1b664397cc40e039d0c087c65fielding * The ASF licenses this file to You under the Apache License, Version 2.0
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * (the "License"); you may not use this file except in compliance with
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * the License. You may obtain a copy of the License at
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * Unless required by applicable law or agreed to in writing, software
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * distributed under the License is distributed on an "AS IS" BASIS,
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * See the License for the specific language governing permissions and
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * limitations under the License.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/* Utility routines for Apache proxy */
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * Opaque structure containing target server info when
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * using a forward proxy.
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * Up to now only used in combination with HTTP CONNECT.
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fieldingtypedef struct {
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding int use_http_connect; /* Use SSL Tunneling via HTTP CONNECT */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/* Keep synced with mod_proxy.h! */
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic struct wstat {
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding unsigned int bit;
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding const char *name;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding {PROXY_WORKER_INITIALIZED, PROXY_WORKER_INITIALIZED_FLAG, "Init "},
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding {PROXY_WORKER_IGNORE_ERRORS, PROXY_WORKER_IGNORE_ERRORS_FLAG, "Ign "},
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding {PROXY_WORKER_DRAIN, PROXY_WORKER_DRAIN_FLAG, "Drn "},
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding {PROXY_WORKER_IN_SHUTDOWN, PROXY_WORKER_IN_SHUTDOWN_FLAG, "Shut "},
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding {PROXY_WORKER_DISABLED, PROXY_WORKER_DISABLED_FLAG, "Dis "},
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding {PROXY_WORKER_STOPPED, PROXY_WORKER_STOPPED_FLAG, "Stop "},
3568de757bac0b47256647504c186d17ca272f85rbb {PROXY_WORKER_IN_ERROR, PROXY_WORKER_IN_ERROR_FLAG, "Err "},
3568de757bac0b47256647504c186d17ca272f85rbb {PROXY_WORKER_HOT_STANDBY, PROXY_WORKER_HOT_STANDBY_FLAG, "Stby "},
3568de757bac0b47256647504c186d17ca272f85rbb/* Global balancer counter */
3568de757bac0b47256647504c186d17ca272f85rbbstatic int lb_workers_limit = 0;
3568de757bac0b47256647504c186d17ca272f85rbbstatic int proxy_match_ipaddr(struct dirconn_entry *This, request_rec *r);
3568de757bac0b47256647504c186d17ca272f85rbbstatic int proxy_match_domainname(struct dirconn_entry *This, request_rec *r);
3568de757bac0b47256647504c186d17ca272f85rbbstatic int proxy_match_hostname(struct dirconn_entry *This, request_rec *r);
3568de757bac0b47256647504c186d17ca272f85rbbstatic int proxy_match_word(struct dirconn_entry *This, request_rec *r);
3568de757bac0b47256647504c186d17ca272f85rbbAPR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(proxy, PROXY, int, create_req,
3568de757bac0b47256647504c186d17ca272f85rbb/* already called in the knowledge that the characters are hex digits */
3568de757bac0b47256647504c186d17ca272f85rbb int ch = x[0];
3568de757bac0b47256647504c186d17ca272f85rbb#else /*APR_CHARSET_EBCDIC*/
db12cd62083041bf90945eeb90cc40fbd2340797trawick * we assume that the hex value refers to an ASCII character
db12cd62083041bf90945eeb90cc40fbd2340797trawick * so convert to EBCDIC so that it makes sense locally;
3568de757bac0b47256647504c186d17ca272f85rbb * client specifies %20 in URL to refer to a space char;
3568de757bac0b47256647504c186d17ca272f85rbb * at this point we're called with EBCDIC "20"; after turning
3568de757bac0b47256647504c186d17ca272f85rbb * EBCDIC "20" into binary 0x20, we then need to assume that 0x20
3568de757bac0b47256647504c186d17ca272f85rbb * represents an ASCII char and convert 0x20 to EBCDIC, yielding
3568de757bac0b47256647504c186d17ca272f85rbb return buf[0];
3568de757bac0b47256647504c186d17ca272f85rbb#endif /*APR_CHARSET_EBCDIC*/
3d96ee83babeec32482c9082c9426340cee8c44dwrowe x[0] = '%';
3568de757bac0b47256647504c186d17ca272f85rbb if (i >= 10) {
3568de757bac0b47256647504c186d17ca272f85rbb if (i >= 10) {
3568de757bac0b47256647504c186d17ca272f85rbb#else /*APR_CHARSET_EBCDIC*/
3568de757bac0b47256647504c186d17ca272f85rbb x[0] = '%';
3568de757bac0b47256647504c186d17ca272f85rbb#endif /*APR_CHARSET_EBCDIC*/
3568de757bac0b47256647504c186d17ca272f85rbb * canonicalise a URL-encoded string
3568de757bac0b47256647504c186d17ca272f85rbb * Convert a URL-encoded string to canonical form.
3568de757bac0b47256647504c186d17ca272f85rbb * It decodes characters which need not be encoded,
3568de757bac0b47256647504c186d17ca272f85rbb * and encodes those which must be encoded, and does not touch
3568de757bac0b47256647504c186d17ca272f85rbb * those which must not be touched.
3568de757bac0b47256647504c186d17ca272f85rbbPROXY_DECLARE(char *)ap_proxy_canonenc(apr_pool_t *p, const char *x, int len,
78ae889ffe0fdfab72f56c6993b0f302cb48da55rbb int i, j, ch;
fc1efab92032301e317f07e1b3a00082d9d71f3frbb char *allowed; /* characters which should not be encoded */
0375f54d32af9c27de0006956d9f85d01b020351stoddard char *reserved; /* characters which much not be en/de-coded */
24b534291150023e6b68eca89ddd33e475ccddc0wrowe * N.B. in addition to :@&=, this allows ';' in an http path
3568de757bac0b47256647504c186d17ca272f85rbb * and '?' in an ftp path -- this may be revised
24b534291150023e6b68eca89ddd33e475ccddc0wrowe * Also, it makes a '+' character in a search string reserved, as
3568de757bac0b47256647504c186d17ca272f85rbb * it may be form-encoded. (Although RFC 1738 doesn't allow this -
fc1efab92032301e317f07e1b3a00082d9d71f3frbb * it only permits ; / ? : @ = & as reserved chars.)
fc1efab92032301e317f07e1b3a00082d9d71f3frbb if (t == enc_path) {
3568de757bac0b47256647504c186d17ca272f85rbb else if (t == enc_search) {
3568de757bac0b47256647504c186d17ca272f85rbb else if (t == enc_user) {
3568de757bac0b47256647504c186d17ca272f85rbb else if (t == enc_fpath) {
3568de757bac0b47256647504c186d17ca272f85rbb else { /* if (t == enc_parm) */
3568de757bac0b47256647504c186d17ca272f85rbb if (t == enc_path) {
3568de757bac0b47256647504c186d17ca272f85rbb else if (t == enc_search) {
3568de757bac0b47256647504c186d17ca272f85rbb for (i = 0, j = 0; i < len; i++, j++) {
3568de757bac0b47256647504c186d17ca272f85rbb/* always handle '/' first */
78ae889ffe0fdfab72f56c6993b0f302cb48da55rbb * decode it if not already done. do not decode reverse proxied URLs
3568de757bac0b47256647504c186d17ca272f85rbb * unless specifically forced
3568de757bac0b47256647504c186d17ca272f85rbb if ((forcedec || (proxyreq && proxyreq != PROXYREQ_REVERSE)) && ch == '%') {
3568de757bac0b47256647504c186d17ca272f85rbb if (!apr_isxdigit(x[i + 1]) || !apr_isxdigit(x[i + 2])) {
ad83978f20c7d1a4323059d9af122e56fcd353bdstoddard if (ch != 0 && strchr(reserved, ch)) { /* keep it encoded */
3568de757bac0b47256647504c186d17ca272f85rbb/* recode it, if necessary */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding y[j] = '\0';
239f998fbee5ac5b114b965bb76e217cce0003edstoddard * Parses network-location.
3568de757bac0b47256647504c186d17ca272f85rbb * urlp on input the URL; on output the path, after the leading /
3568de757bac0b47256647504c186d17ca272f85rbb * user NULL if no user/password permitted
3568de757bac0b47256647504c186d17ca272f85rbb * password holder for password
3568de757bac0b47256647504c186d17ca272f85rbb * host holder for host
3568de757bac0b47256647504c186d17ca272f85rbb * port port number; only set if one is supplied.
3568de757bac0b47256647504c186d17ca272f85rbb * Returns an error string.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding ap_proxy_canon_netloc(apr_pool_t *p, char **const urlp, char **userp,
3568de757bac0b47256647504c186d17ca272f85rbb return "Malformed URL";
3568de757bac0b47256647504c186d17ca272f85rbb /* find _last_ '@' since it might occur in user/password part */
3568de757bac0b47256647504c186d17ca272f85rbb/* find password */
3568de757bac0b47256647504c186d17ca272f85rbb password = ap_proxy_canonenc(p, strp + 1, strlen(strp + 1), enc_user, 1, 0);
3568de757bac0b47256647504c186d17ca272f85rbb return "Bad %-escape in URL (password)";
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding user = ap_proxy_canonenc(p, user, strlen(user), enc_user, 1, 0);
5a58a10705b7b154b53294e0c0283d64eabdcb7fstoddard return "Bad %-escape in URL (username)";
f8b7801ea5717ef22cc0d02bffacfd5f9e48f898gregames * Parse the host string to separate host portion from optional port.
5a0f707b48da7703cbe6bc087f13a6735b1c742dgregames * Perform range checking on port.
5a0f707b48da7703cbe6bc087f13a6735b1c742dgregames rv = apr_parse_addr_port(&addr, &scope_id, &tmp_port, host, p);
5a0f707b48da7703cbe6bc087f13a6735b1c742dgregames if (rv != APR_SUCCESS || addr == NULL || scope_id != NULL) {
5a0f707b48da7703cbe6bc087f13a6735b1c742dgregames return "Invalid host/port";
5a0f707b48da7703cbe6bc087f13a6735b1c742dgregames if (tmp_port != 0) { /* only update caller's port if port was specified */
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj ap_str_tolower(addr); /* DNS names are case-insensitive */
3568de757bac0b47256647504c186d17ca272f85rbb * If the date is a valid RFC 850 date or asctime() date, then it
3568de757bac0b47256647504c186d17ca272f85rbb * is converted to the RFC 1123 format.
3568de757bac0b47256647504c186d17ca272f85rbbPROXY_DECLARE(const char *)
1ec8bd0373f11c07688ec9afbbf778cf78a0bc52wrowePROXY_DECLARE(request_rec *)ap_proxy_make_fake_req(conn_rec *c, request_rec *r)
3568de757bac0b47256647504c186d17ca272f85rbb * list is a comma-separated list of case-insensitive tokens, with
3568de757bac0b47256647504c186d17ca272f85rbb * optional whitespace around the tokens.
3568de757bac0b47256647504c186d17ca272f85rbb * The return returns 1 if the token val is found in the list, or 0
1ec8bd0373f11c07688ec9afbbf778cf78a0bc52wrowe * otherwise.
1ec8bd0373f11c07688ec9afbbf778cf78a0bc52wrowePROXY_DECLARE(int) ap_proxy_liststr(const char *list, const char *val)
3568de757bac0b47256647504c186d17ca272f85rbb const char *p;
3568de757bac0b47256647504c186d17ca272f85rbb if (p != NULL) {
1ec8bd0373f11c07688ec9afbbf778cf78a0bc52wrowe } while (apr_isspace(*p));
3568de757bac0b47256647504c186d17ca272f85rbb * list is a comma-separated list of case-insensitive tokens, with
3568de757bac0b47256647504c186d17ca272f85rbb * optional whitespace around the tokens.
5a0f707b48da7703cbe6bc087f13a6735b1c742dgregames * if val appears on the list of tokens, it is removed from the list,
3568de757bac0b47256647504c186d17ca272f85rbb * and the new list is returned.
5a0f707b48da7703cbe6bc087f13a6735b1c742dgregamesPROXY_DECLARE(char *)ap_proxy_removestr(apr_pool_t *pool, const char *list, const char *val)
3568de757bac0b47256647504c186d17ca272f85rbb const char *p;
3568de757bac0b47256647504c186d17ca272f85rbb if (p != NULL) {
3568de757bac0b47256647504c186d17ca272f85rbb } while (apr_isspace(*p));
1ec8bd0373f11c07688ec9afbbf778cf78a0bc52wrowe /* do nothing */
1ec8bd0373f11c07688ec9afbbf778cf78a0bc52wrowe new = apr_pstrcat(pool, new, ",", apr_pstrndup(pool, list, i), NULL);
3568de757bac0b47256647504c186d17ca272f85rbb * Converts 8 hex digits to a time integer
0f113d7123e8bd3e3e2e9b6373461a1a773bfccatrawick unsigned int j;
0f113d7123e8bd3e3e2e9b6373461a1a773bfccatrawick for (i = 0, j = 0; i < 8; i++) {
3568de757bac0b47256647504c186d17ca272f85rbb if (j == 0xffffffff) {
3568de757bac0b47256647504c186d17ca272f85rbb * Converts a time integer to 8 hex digits
3568de757bac0b47256647504c186d17ca272f85rbb unsigned int j = t;
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj for (i = 7; i >= 0; i--) {
3568de757bac0b47256647504c186d17ca272f85rbbPROXY_DECLARE(int) ap_proxyerror(request_rec *r, int statuscode, const char *message)
ad83978f20c7d1a4323059d9af122e56fcd353bdstoddard "The proxy server could not handle the request "
3568de757bac0b47256647504c186d17ca272f85rbb "Reason: <strong>",
3568de757bac0b47256647504c186d17ca272f85rbb /* Allow "error-notes" string to be printed by ap_send_error_response() */
3568de757bac0b47256647504c186d17ca272f85rbb apr_table_setn(r->notes, "verbose-error-to", apr_pstrdup(r->pool, "*"));
3568de757bac0b47256647504c186d17ca272f85rbb r->status_line = apr_psprintf(r->pool, "%3.3u Proxy Error", statuscode);
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpjstatic const char *
3568de757bac0b47256647504c186d17ca272f85rbb /* Set url to the first char after "scheme://" */
3568de757bac0b47256647504c186d17ca272f85rbb if ((url = strchr(r->uri, ':')) == NULL || url[1] != '/' || url[2] != '/') {
0f113d7123e8bd3e3e2e9b6373461a1a773bfccatrawick url = apr_pstrdup(r->pool, &url[1]); /* make it point to "//", which is what proxy_canon_netloc expects */
3568de757bac0b47256647504c186d17ca272f85rbb err = ap_proxy_canon_netloc(r->pool, &url, &user, &password, &host, &port);
3568de757bac0b47256647504c186d17ca272f85rbb/* Return TRUE if addr represents an IP address (or an IP network address) */
3568de757bac0b47256647504c186d17ca272f85rbbPROXY_DECLARE(int) ap_proxy_is_ipaddr(struct dirconn_entry *This, apr_pool_t *p)
3568de757bac0b47256647504c186d17ca272f85rbb * if the address is given with an explicit netmask, use that
3568de757bac0b47256647504c186d17ca272f85rbb * Due to a deficiency in apr_inet_addr(), it is impossible to parse
3568de757bac0b47256647504c186d17ca272f85rbb * "partial" addresses (with less than 4 quads) correctly, i.e.
ec020ca384efb30d501a5af796ddc3bb237d7b8fgregames * 192.168.123 is parsed as 192.168.0.123, which is not what I want.
ec020ca384efb30d501a5af796ddc3bb237d7b8fgregames * I therefore have to parse the IP address manually:
ec020ca384efb30d501a5af796ddc3bb237d7b8fgregames * if (proxy_readmask(This->name, &This->addr.s_addr, &This->mask.s_addr) == 0)
3568de757bac0b47256647504c186d17ca272f85rbb * addr and mask were set by proxy_readmask()
3568de757bac0b47256647504c186d17ca272f85rbb * return 1;
3568de757bac0b47256647504c186d17ca272f85rbb * Parse IP addr manually, optionally allowing
5f4e89b7e376d596fbf5167314a3781fd0889064trawick * abbreviated net addresses like 192.168.
3568de757bac0b47256647504c186d17ca272f85rbb /* Iterate over up to 4 (dotted) quads. */
ad83978f20c7d1a4323059d9af122e56fcd353bdstoddard if (*addr == '/' && quads > 0) { /* netmask starts here. */
0f113d7123e8bd3e3e2e9b6373461a1a773bfccatrawick return 0; /* no digit at start of quad */
3568de757bac0b47256647504c186d17ca272f85rbb if (tmp == addr) { /* expected a digit, found something else */
3568de757bac0b47256647504c186d17ca272f85rbb /* invalid octet */
3568de757bac0b47256647504c186d17ca272f85rbb ++addr; /* after the 4th quad, a dot would be illegal */
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj for (This->addr.s_addr = 0, i = 0; i < quads; ++i) {
3568de757bac0b47256647504c186d17ca272f85rbb if (addr[0] == '/' && apr_isdigit(addr[1])) { /* net mask follows: */
3568de757bac0b47256647504c186d17ca272f85rbb if (tmp == addr) { /* expected a digit, found something else */
3568de757bac0b47256647504c186d17ca272f85rbb if (bits < 0 || bits > 32) { /* netmask must be between 0 and 32 */
1ec8bd0373f11c07688ec9afbbf778cf78a0bc52wrowe * Determine (i.e., "guess") netmask by counting the
3568de757bac0b47256647504c186d17ca272f85rbb * number of trailing .0's; reduce #quads appropriately
3568de757bac0b47256647504c186d17ca272f85rbb * (so that 192.168.0.0 is equivalent to 192.168.)
3568de757bac0b47256647504c186d17ca272f85rbb /* "IP Address should be given in dotted-quad form, optionally followed by a netmask (e.g., 192.168.111.0/24)"; */
ec020ca384efb30d501a5af796ddc3bb237d7b8fgregames /* every zero-byte counts as 8 zero-bits */
3568de757bac0b47256647504c186d17ca272f85rbb if (bits != 32) { /* no warning for fully qualified IP address */
1ec8bd0373f11c07688ec9afbbf778cf78a0bc52wrowe "Warning: NetMask not supplied with IP-Addr; guessing: %s/%ld",
3568de757bac0b47256647504c186d17ca272f85rbb This->mask.s_addr = htonl(APR_INADDR_NONE << (32 - bits));
3568de757bac0b47256647504c186d17ca272f85rbb if (*addr == '\0' && (This->addr.s_addr & ~This->mask.s_addr) != 0) {
ad83978f20c7d1a4323059d9af122e56fcd353bdstoddard "Warning: NetMask and IP-Addr disagree in %s/%ld",
1ec8bd0373f11c07688ec9afbbf778cf78a0bc52wrowe return (*addr == '\0'); /* okay iff we've parsed the whole string */
3568de757bac0b47256647504c186d17ca272f85rbb/* Return TRUE if addr represents an IP address (or an IP network address) */
1ec8bd0373f11c07688ec9afbbf778cf78a0bc52wrowestatic int proxy_match_ipaddr(struct dirconn_entry *This, request_rec *r)
3568de757bac0b47256647504c186d17ca272f85rbb if (4 == sscanf(host, "%d.%d.%d.%d", &ip_addr[0], &ip_addr[1], &ip_addr[2], &ip_addr[3])) {
ad83978f20c7d1a4323059d9af122e56fcd353bdstoddard /* ap_proxy_is_ipaddr() already confirmed that we have
3568de757bac0b47256647504c186d17ca272f85rbb * a valid octet in ip_addr[i]
1ec8bd0373f11c07688ec9afbbf778cf78a0bc52wrowe if (This->addr.s_addr == (addr.s_addr & This->mask.s_addr)) {
3568de757bac0b47256647504c186d17ca272f85rbb if (apr_sockaddr_info_get(&reqaddr, host, APR_UNSPEC, 0, 0, r->pool)
1ec8bd0373f11c07688ec9afbbf778cf78a0bc52wrowe "2)IP-NoMatch: hostname=%s msg=Host not found", host);
3568de757bac0b47256647504c186d17ca272f85rbb /* Try to deal with multiple IP addr's for a host */
3568de757bac0b47256647504c186d17ca272f85rbb /* FIXME: This needs to be able to deal with IPv6 */
3568de757bac0b47256647504c186d17ca272f85rbb if (This->addr.s_addr == (ip->s_addr & This->mask.s_addr)) {
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/* Return TRUE if addr represents a domain name */
302dc1f7b3feee23a91ad8f3cf3cb2edd95a557bmanojPROXY_DECLARE(int) ap_proxy_is_domainname(struct dirconn_entry *This, apr_pool_t *p)
3568de757bac0b47256647504c186d17ca272f85rbb /* Domain name must start with a '.' */
--d_len;
--h_len;
int h2_len;
int h1_len;
while (addr) {
--h2_len;
--h1_len;
return HTTP_FORBIDDEN;
while (conf_addr) {
while (uri_addr) {
char *conf_ip;
char *uri_ip;
return HTTP_FORBIDDEN;
return OK;
return OK;
* ap_rgetline() in protocol.c. Deprecate this function and use ap_rgetline()
apr_bucket *e;
char *response;
int found = 0;
buff[0] = 0;
*eos = 0;
while (!found) {
return rv;
while (!found) {
return APR_ECONNABORTED;
if (APR_BUCKET_IS_EOS(e)) {
(const char **)&response,
&len,
APR_BLOCK_READ))) {
return rv;
if (len > 0) {
return APR_SUCCESS;
if (!initial) {
count++;
return url;
int n, l3 = 0;
if (urlpart) {
* BalancerMember balancer://alias http://example.com/foo
* translate url http://example.com/foo/bar/that to /bash/that
if (urlpart) {
--l2;
NULL);
worker++;
if (part) {
if (part) {
return url;
&proxy_module);
const char *pathp;
const char *domainp;
int ddiff = 0;
int pdiff = 0;
char *ret;
return str;
if (newpath) {
if (newdomain) {
if (newdomain) {
return ret;
const char *url)
return NULL;
return balancer;
balancer++;
return NULL;
const char *url,
int do_malloc)
if (!lbmethod) {
if (do_malloc)
return NULL;
return APR_EINVAL;
return APR_SUCCESS;
PROXY_DECLARE(apr_status_t) ap_proxy_initialize_balancer(proxy_balancer *balancer, server_rec *s, apr_pool_t *p)
return rv;
return APR_SUCCESS;
return APR_SUCCESS;
if (conn->r) {
return APR_SUCCESS;
apr_pool_clear(p);
return APR_SUCCESS;
request_rec *r)
return APR_SUCCESS;
return APR_SUCCESS;
return APR_SUCCESS;
const char *url)
int max_match = 0;
int url_length;
int min_match;
int worker_name_length;
char *url_copy;
return NULL;
char *pathstart;
if (balancer) {
return max_worker;
const char *url,
int do_malloc)
int rv;
* ProxyPass / http://www.example.com
if (balancer) {
} else if (conf) {
if (do_malloc)
return NULL;
return APR_EINVAL;
return APR_SUCCESS;
PROXY_DECLARE(apr_status_t) ap_proxy_initialize_worker(proxy_worker *worker, server_rec *s, apr_pool_t *p)
int mpm_threads;
return APR_EGENERAL;
return rv;
void *conn;
return rv;
server_rec *s)
return OK;
return DECLINED;
return OK;
request_rec *r,
int access_status;
if (*worker) {
*url);
*url);
*url);
return access_status;
request_rec *r,
if (balancer) {
return access_status;
const char *proxy_function,
const char *backend_name,
request_rec *r)
int connected = 0;
int loglevel;
server_rec *s)
return HTTP_SERVICE_UNAVAILABLE;
return HTTP_SERVICE_UNAVAILABLE;
return OK;
server_rec *s)
return OK;
PROXY_DECLARE(int)
char **url,
const char *proxyname,
char *server_portstr,
int server_portstr_size)
int server_port;
NULL));
if (!proxyname) {
if (proxyname) {
const char *proxy_auth;
return HTTP_INTERNAL_SERVER_ERROR;
return OK;
server_rec *s)
int status;
int complete = 0;
int len = 0;
if (!complete) {
buffer);
code_str);
return(status);
server_rec *s)
int connected = 0;
int loglevel;
conn_rec *c,
server_rec *s)
int rc;
return OK;
0, NULL,
return HTTP_INTERNAL_SERVER_ERROR;
return HTTP_INTERNAL_SERVER_ERROR;
return rc;
return OK;
int ap_proxy_lb_workers(void)
if (!lb_workers_limit)
return lb_workers_limit;
apr_bucket *e;
if (r->main)
c->bucket_alloc);
apr_bucket *e;
const char *data;
e = APR_BUCKET_NEXT(e)) {
if (!APR_BUCKET_IS_METADATA(e)) {
else if (APR_BUCKET_IS_FLUSH(e)) {
else if (APR_BUCKET_IS_EOS(e)) {
return rv;
PROXY_DECLARE(unsigned int)
unsigned int hash;
return hash;
unsigned int hash;
return hash;
if (set)
return APR_SUCCESS;
pwt++;
return APR_EINVAL;
pwt++;
if (PROXY_WORKER_IS_USABLE(w))
return ret;