proxy_util.c revision bb859fec493f440dde2259c20b002428fd0b8b55
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher/* Copyright 1999-2004 The Apache Software Foundation
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher * Licensed under the Apache License, Version 2.0 (the "License");
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher * you may not use this file except in compliance with the License.
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher * You may obtain a copy of the License at
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher * http://www.apache.org/licenses/LICENSE-2.0
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher * Unless required by applicable law or agreed to in writing, software
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher * distributed under the License is distributed on an "AS IS" BASIS,
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher * See the License for the specific language governing permissions and
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher * limitations under the License.
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher/* Utility routines for Apache proxy */
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher#define apr_socket_create apr_socket_create_ex
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagherstatic int proxy_match_ipaddr(struct dirconn_entry *This, request_rec *r);
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagherstatic int proxy_match_domainname(struct dirconn_entry *This, request_rec *r);
291a6c8af9759e41cec6f332cb72606ca90768c3Pavel Březinastatic int proxy_match_hostname(struct dirconn_entry *This, request_rec *r);
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagherstatic int proxy_match_word(struct dirconn_entry *This, request_rec *r);
int i, ch;
#if !APR_CHARSET_EBCDIC
ch = x[0];
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 balancer;
balancer++;
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 worker;
worker++;
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)
request_rec *r,
int access_status;
if (*worker) {
return access_status;
request_rec *r,
int access_status;
if (balancer)
return access_status;
const char *proxy_function,
const char *backend_name,
server_rec *s,
apr_pool_t *p)
int connected = 0;
int loglevel;
return APR_SUCCESS;
return APR_SUCCESS;
if (s != NULL)
return APR_SUCCESS;
return rv;
#if APR_HAS_THREADS
return rv;
#if APR_HAS_THREADS
return rv;
#if APR_HAS_THREADS
#if (APR_MAJOR_VERSION > 0)
return rv;
char **url,
const char *proxyname,
char *server_portstr,
int server_portstr_size)
int server_port;
NULL));
if (proxyname) {
return OK;
server_rec *s)
int connected = 0;
int loglevel;