proxy_util.c revision f215b3408281917c9d2d76699209ac11481521ba
dad2046d5cccd18914c910a7c36362483d1f2ad8nd/* Copyright 1999-2004 The Apache Software Foundation
dad2046d5cccd18914c910a7c36362483d1f2ad8nd * Licensed under the Apache License, Version 2.0 (the "License");
5f5d1b4cc970b7f06ff8ef6526128e9a27303d88nd * you may not use this file except in compliance with the License.
6d9c7d0283713aa8ae15fef7e9bfe2c7bfa73872nd * 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.
031b91a62d25106ae69d4693475c79618dd5e884fielding * See the License for the specific language governing permissions and
6d9c7d0283713aa8ae15fef7e9bfe2c7bfa73872nd * limitations under the License.
6d9c7d0283713aa8ae15fef7e9bfe2c7bfa73872nd/* Utility routines for Apache proxy */
dad2046d5cccd18914c910a7c36362483d1f2ad8ndstatic int proxy_match_ipaddr(struct dirconn_entry *This, request_rec *r);
dad2046d5cccd18914c910a7c36362483d1f2ad8ndstatic int proxy_match_domainname(struct dirconn_entry *This, request_rec *r);
dad2046d5cccd18914c910a7c36362483d1f2ad8ndstatic int proxy_match_hostname(struct dirconn_entry *This, request_rec *r);
dad2046d5cccd18914c910a7c36362483d1f2ad8ndstatic int proxy_match_word(struct dirconn_entry *This, request_rec *r);
dad2046d5cccd18914c910a7c36362483d1f2ad8ndAPR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(proxy, PROXY, int, create_req,
dad2046d5cccd18914c910a7c36362483d1f2ad8nd/* already called in the knowledge that the characters are hex digits */
dad2046d5cccd18914c910a7c36362483d1f2ad8nd#else /*APR_CHARSET_EBCDIC*/
dad2046d5cccd18914c910a7c36362483d1f2ad8nd /* we assume that the hex value refers to an ASCII character
dad2046d5cccd18914c910a7c36362483d1f2ad8nd * so convert to EBCDIC so that it makes sense locally;
c6a5c10623a12ee4f8c6de4a3e4aaa717299fbe6humbedooh * client specifies %20 in URL to refer to a space char;
dad2046d5cccd18914c910a7c36362483d1f2ad8nd * at this point we're called with EBCDIC "20"; after turning
dad2046d5cccd18914c910a7c36362483d1f2ad8nd * EBCDIC "20" into binary 0x20, we then need to assume that 0x20
dad2046d5cccd18914c910a7c36362483d1f2ad8nd * represents an ASCII char and convert 0x20 to EBCDIC, yielding
b67d93b8af287632fcdb146d6bebac076622b350niq return buf[0];
#if !APR_CHARSET_EBCDIC
int isenc)
int i, j, ch;
if (t == enc_path)
else if (t == enc_search)
else if (t == enc_user)
else if (t == enc_fpath)
if (t == enc_path)
else if (t == enc_search)
for (i = 0, j = 0; i < len; i++, j++) {
ch = x[i];
y[j] = ch;
return NULL;
y[j] = ch;
PROXY_DECLARE(char *)
return NULL;
PROXY_DECLARE(const char *)
return rp;
int len, i;
if (p != NULL) {
i = p - list;
while (apr_isspace(*p));
list = p;
int len, i;
if (p != NULL) {
i = p - list;
while (apr_isspace(*p));
if (new)
list = p;
return new;
int i, ch;
ch = x[i];
int i, ch;
return statuscode;
return r->hostname;
return NULL;
url = apr_pstrdup(r->pool, &url[1]); /* make it point to "//", which is what proxy_canon_netloc expects */
int i, quads;
long bits;
char *tmp;
char *tmp;
++addr;
--quads;
/* "IP Address should be given in dotted-quad form, optionally followed by a netmask (e.g., 192.168.111.0/24)"; */
#if DEBUGGING
#if DEBUGGING
!= APR_SUCCESS) {
#if DEBUGGING
host);
while (reqaddr) {
#if DEBUGGING
#if DEBUGGING
--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)) {
return rv;
if (len > 0) {
return APR_SUCCESS;
if (!initial) {
count++;
const char *url)
return NULL;
return &balancers[i];
return NULL;
apr_pool_t *p,
const char *url)
int port;
if (q != NULL) {
#if APR_HAS_THREADS
return NULL;
const char *url)
return NULL;
return &workers[i];
return NULL;
#if APR_HAS_THREADS
int mpm_threads;
apr_pool_t *p,
const char *url)
int port;
if (q != NULL) {
return NULL;
PROXY_DECLARE(void)
const char *proxy_function,
const char *backend_name,
server_rec *s,
apr_pool_t *p)
int connected = 0;
int loglevel;