* 20111201.0 (2.5.0-dev) Add invalidate_entity() to the cache provider.
* 20111202.0 (2.5.0-dev) Use apr_status_t across mod_session API.
* 20111202.1 (2.5.0-dev) add APLOGNO()
+ * 20111303.0 (2.5.0-dev) Optional ap_proxy_retry_worker(), remove
+ * ap_proxy_string_read(), ap_cache_liststr(),
+ * ap_proxy_buckets_lifetime_transform(),
+ * ap_proxy_date_canon(), ap_proxy_is_ipaddr(),
+ * ap_proxy_is_domainname(), ap_proxy_is_hostname(),
+ * ap_proxy_is_word(), ap_proxy_hex2sec(),
+ * ap_proxy_sec2hex(), ap_proxy_make_fake_req(),
+ * ap_proxy_strmatch_path, ap_proxy_strmatch_domain,
+ * ap_proxy_table_unmerge().
*/
#define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
#ifndef MODULE_MAGIC_NUMBER_MAJOR
-#define MODULE_MAGIC_NUMBER_MAJOR 20111202
+#define MODULE_MAGIC_NUMBER_MAJOR 20111203
#endif
-#define MODULE_MAGIC_NUMBER_MINOR 1 /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 0 /* 0...n */
/**
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a
}
-/*
- * list is a comma-separated list of case-insensitive tokens, with
- * optional whitespace around the tokens.
- * The return returns 1 if the token val is found in the list, or 0
- * otherwise.
- */
-CACHE_DECLARE(int) ap_cache_liststr(apr_pool_t *p, const char *list,
- const char *key, char **val)
-{
- apr_size_t key_len;
- const char *next;
-
- if (!list) {
- return 0;
- }
-
- key_len = strlen(key);
- next = list;
-
- for (;;) {
-
- /* skip whitespace and commas to find the start of the next key */
- while (*next && (apr_isspace(*next) || (*next == ','))) {
- next++;
- }
-
- if (!*next) {
- return 0;
- }
-
- if (!strncasecmp(next, key, key_len)) {
- /* this field matches the key (though it might just be
- * a prefix match, so make sure the match is followed
- * by either a space or an equals sign)
- */
- next += key_len;
- if (!*next || (*next == '=') || apr_isspace(*next) ||
- (*next == ',')) {
- /* valid match */
- if (val) {
- while (*next && (*next != '=') && (*next != ',')) {
- next++;
- }
- if (*next == '=') {
- next++;
- while (*next && apr_isspace(*next )) {
- next++;
- }
- if (!*next) {
- *val = NULL;
- }
- else {
- const char *val_start = next;
- while (*next && !apr_isspace(*next) &&
- (*next != ',')) {
- /* EAT QUOTED STRING */
- if (*next == '"' || *next == '\'') {
- char delim = *next;
- while (*++next != delim) {
- if (!*next) {
- return 0;
- }
- else if (*next == '\\') {
- ++next;
- }
- }
- }
- next++;
- }
- *val = apr_pstrmemdup(p, val_start,
- next - val_start);
- }
- }
- else {
- *val = NULL;
- }
- }
- return 1;
- }
- }
-
- /* skip to the next field */
- do {
- /* EAT QUOTED STRING */
- if (*next == '"' || *next == '\'') {
- char delim = *next;
- while (*++next != delim) {
- if (!*next) {
- return 0;
- }
- else if (*next == '\\') {
- ++next;
- }
- }
- }
- next++;
- if (!*next) {
- return 0;
- }
- } while (*next != ',');
- }
-}
-
/* return each comma separated token, one at a time */
CACHE_DECLARE(const char *)ap_cache_tokstr(apr_pool_t *p, const char *list,
const char **str)
*/
reason = "Authorization required";
}
- else if (ap_cache_liststr(NULL,
- apr_table_get(r->headers_out, "Vary"),
- "*", NULL)) {
+ else if (ap_find_token(NULL, apr_table_get(r->headers_out, "Vary"), "*")) {
reason = "Vary header contains '*'";
}
else if (apr_table_get(r->subprocess_env, "no-cache") != NULL) {
CACHE_DECLARE(char *) ap_cache_generate_name(apr_pool_t *p, int dirlevels,
int dirlength,
const char *name);
-CACHE_DECLARE(int) ap_cache_liststr(apr_pool_t *p, const char *list,
- const char *key, char **val);
CACHE_DECLARE(const char *)ap_cache_tokstr(apr_pool_t *p, const char *list, const char **str);
/* Create a new table consisting of those elements from an
#define PROXY_DECLARE_DATA __declspec(dllimport)
#endif
-/**
- * Hook an optional proxy hook. Unlike static hooks, this uses a macro
- * instead of a function.
- */
-#define PROXY_OPTIONAL_HOOK(name,fn,pre,succ,order) \
- APR_OPTIONAL_HOOK(proxy,name,fn,pre,succ,order)
-
APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, scheme_handler, (request_rec *r,
proxy_worker *worker, proxy_server_conf *conf, char *url,
const char *proxyhost, apr_port_t proxyport))
/* proxy_util.c */
PROXY_DECLARE(apr_status_t) ap_proxy_strncpy(char *dst, const char *src, size_t dlen);
-PROXY_DECLARE(request_rec *) ap_proxy_make_fake_req(conn_rec *c, request_rec *r);
PROXY_DECLARE(int) ap_proxy_hex2c(const char *x);
PROXY_DECLARE(void) ap_proxy_c2hex(int ch, char *x);
PROXY_DECLARE(char *)ap_proxy_canonenc(apr_pool_t *p, const char *x, int len, enum enctype t,
int forcedec, int proxyreq);
PROXY_DECLARE(char *)ap_proxy_canon_netloc(apr_pool_t *p, char **const urlp, char **userp,
char **passwordp, char **hostp, apr_port_t *port);
-PROXY_DECLARE(const char *)ap_proxy_date_canon(apr_pool_t *p, const char *x);
-PROXY_DECLARE(int) ap_proxy_liststr(const char *list, const char *val);
-PROXY_DECLARE(int) ap_proxy_hex2sec(const char *x);
-PROXY_DECLARE(void) ap_proxy_sec2hex(int t, char *y);
PROXY_DECLARE(int) ap_proxyerror(request_rec *r, int statuscode, const char *message);
-PROXY_DECLARE(int) ap_proxy_is_ipaddr(struct dirconn_entry *This, apr_pool_t *p);
-PROXY_DECLARE(int) ap_proxy_is_domainname(struct dirconn_entry *This, apr_pool_t *p);
-PROXY_DECLARE(int) ap_proxy_is_hostname(struct dirconn_entry *This, apr_pool_t *p);
-PROXY_DECLARE(int) ap_proxy_is_word(struct dirconn_entry *This, apr_pool_t *p);
PROXY_DECLARE(int) ap_proxy_checkproxyblock(request_rec *r, proxy_server_conf *conf, apr_sockaddr_t *uri_addr);
PROXY_DECLARE(int) ap_proxy_pre_http_request(conn_rec *c, request_rec *r);
-PROXY_DECLARE(apr_status_t) ap_proxy_string_read(conn_rec *c, apr_bucket_brigade *bb, char *buff, size_t bufflen, int *eos);
-PROXY_DECLARE(void) ap_proxy_table_unmerge(apr_pool_t *p, apr_table_t *t, char *key);
/* DEPRECATED (will be replaced with ap_proxy_connect_backend */
PROXY_DECLARE(int) ap_proxy_connect_to_backend(apr_socket_t **, const char *, apr_sockaddr_t *, const char *, proxy_server_conf *, request_rec *);
PROXY_DECLARE(apr_status_t) ap_proxy_ssl_connection_cleanup(proxy_conn_rec *conn,
PROXY_DECLARE(void) ap_proxy_backend_broke(request_rec *r,
apr_bucket_brigade *brigade);
-/**
- * Transform buckets from one bucket allocator to another one by creating a
- * transient bucket for each data bucket and let it use the data read from
- * the old bucket. Metabuckets are transformed by just recreating them.
- * Attention: Currently only the following bucket types are handled:
- *
- * All data buckets
- * FLUSH
- * EOS
- *
- * If an other bucket type is found its type is logged as a debug message
- * and APR_EGENERAL is returned.
- * @param r current request record of client request. Only used for logging
- * purposes
- * @param from the brigade that contains the buckets to transform
- * @param to the brigade that will receive the transformed buckets
- * @return APR_SUCCESS if all buckets could be transformed APR_EGENERAL
- * otherwise
- */
-PROXY_DECLARE(apr_status_t) ap_proxy_buckets_lifetime_transform(request_rec *r,
- apr_bucket_brigade *from,
- apr_bucket_brigade *to);
/**
* Return a hash based on the passed string
* @param str string to produce hash from
*/
int ap_proxy_lb_workers(void);
-/* For proxy_util */
extern module PROXY_DECLARE_DATA proxy_module;
-extern int PROXY_DECLARE_DATA proxy_lb_workers;
-extern const apr_strmatch_pattern PROXY_DECLARE_DATA *ap_proxy_strmatch_path;
-extern const apr_strmatch_pattern PROXY_DECLARE_DATA *ap_proxy_strmatch_domain;
-
#endif /*MOD_PROXY_H*/
/** @} */
return 1;
}
+/*
+ * converts a series of buckets into a string
+ * XXX: BillS says this function performs essentially the same function as
+ * ap_rgetline() in protocol.c. Deprecate this function and use ap_rgetline()
+ * instead? I think ftp_string_read() will not work properly on non ASCII
+ * (EBCDIC) machines either.
+ */
+static apr_status_t ftp_string_read(conn_rec *c, apr_bucket_brigade *bb,
+ char *buff, apr_size_t bufflen, int *eos)
+{
+ apr_bucket *e;
+ apr_status_t rv;
+ char *pos = buff;
+ char *response;
+ int found = 0;
+ apr_size_t len;
+
+ /* start with an empty string */
+ buff[0] = 0;
+ *eos = 0;
+
+ /* loop through each brigade */
+ while (!found) {
+ /* get brigade from network one line at a time */
+ if (APR_SUCCESS != (rv = ap_get_brigade(c->input_filters, bb,
+ AP_MODE_GETLINE,
+ APR_BLOCK_READ,
+ 0))) {
+ return rv;
+ }
+ /* loop through each bucket */
+ while (!found) {
+ if (*eos || APR_BRIGADE_EMPTY(bb)) {
+ /* The connection aborted or timed out */
+ return APR_ECONNABORTED;
+ }
+ e = APR_BRIGADE_FIRST(bb);
+ if (APR_BUCKET_IS_EOS(e)) {
+ *eos = 1;
+ }
+ else {
+ if (APR_SUCCESS != (rv = apr_bucket_read(e,
+ (const char **)&response,
+ &len,
+ APR_BLOCK_READ))) {
+ return rv;
+ }
+ /*
+ * is string LF terminated?
+ * XXX: This check can be made more efficient by simply checking
+ * if the last character in the 'response' buffer is an ASCII_LF.
+ * See ap_rgetline() for an example.
+ */
+ if (memchr(response, APR_ASCII_LF, len)) {
+ found = 1;
+ }
+ /* concat strings until buff is full - then throw the data away */
+ if (len > ((bufflen-1)-(pos-buff))) {
+ len = (bufflen-1)-(pos-buff);
+ }
+ if (len > 0) {
+ memcpy(pos, response, len);
+ pos += len;
+ }
+ }
+ APR_BUCKET_REMOVE(e);
+ apr_bucket_destroy(e);
+ }
+ *pos = '\0';
+ }
+
+ return APR_SUCCESS;
+}
+
/*
* Canonicalise ftp URLs.
*/
apr_status_t rv;
int eos;
- if (APR_SUCCESS != (rv = ap_proxy_string_read(ftp_ctrl, bb, response, sizeof(response), &eos))) {
+ if (APR_SUCCESS != (rv = ftp_string_read(ftp_ctrl, bb, response, sizeof(response), &eos))) {
return -1;
}
/*
memcpy(buff, response, 3);
buff[3] = ' ';
do {
- if (APR_SUCCESS != (rv = ap_proxy_string_read(ftp_ctrl, bb, response, sizeof(response), &eos))) {
+ if (APR_SUCCESS != (rv = ftp_string_read(ftp_ctrl, bb, response, sizeof(response), &eos))) {
return -1;
}
mb = apr_cpystrn(mb, response + (' ' == response[0] ? 1 : 4), me - mb);
return(pass_brigade(bucket_alloc, r, p_conn, origin, header_brigade, 1));
}
+/*
+ * Transform buckets from one bucket allocator to another one by creating a
+ * transient bucket for each data bucket and let it use the data read from
+ * the old bucket. Metabuckets are transformed by just recreating them.
+ * Attention: Currently only the following bucket types are handled:
+ *
+ * All data buckets
+ * FLUSH
+ * EOS
+ *
+ * If an other bucket type is found its type is logged as a debug message
+ * and APR_EGENERAL is returned.
+ */
+static apr_status_t proxy_buckets_lifetime_transform(request_rec *r,
+ apr_bucket_brigade *from, apr_bucket_brigade *to)
+{
+ apr_bucket *e;
+ apr_bucket *new;
+ const char *data;
+ apr_size_t bytes;
+ apr_status_t rv = APR_SUCCESS;
+
+ apr_brigade_cleanup(to);
+ for (e = APR_BRIGADE_FIRST(from);
+ e != APR_BRIGADE_SENTINEL(from);
+ e = APR_BUCKET_NEXT(e)) {
+ if (!APR_BUCKET_IS_METADATA(e)) {
+ apr_bucket_read(e, &data, &bytes, APR_BLOCK_READ);
+ new = apr_bucket_transient_create(data, bytes, r->connection->bucket_alloc);
+ APR_BRIGADE_INSERT_TAIL(to, new);
+ }
+ else if (APR_BUCKET_IS_FLUSH(e)) {
+ new = apr_bucket_flush_create(r->connection->bucket_alloc);
+ APR_BRIGADE_INSERT_TAIL(to, new);
+ }
+ else if (APR_BUCKET_IS_EOS(e)) {
+ new = apr_bucket_eos_create(r->connection->bucket_alloc);
+ APR_BRIGADE_INSERT_TAIL(to, new);
+ }
+ else {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00964)
+ "Unhandled bucket type of type %s in"
+ " proxy_buckets_lifetime_transform", e->type->name);
+ apr_bucket_delete(e);
+ rv = APR_EGENERAL;
+ }
+ }
+ return rv;
+}
+
static
int ap_proxy_http_request(apr_pool_t *p, request_rec *r,
proxy_conn_rec *p_conn, proxy_worker *worker,
return OK;
}
+/*
+ * If the date is a valid RFC 850 date or asctime() date, then it
+ * is converted to the RFC 1123 format.
+ */
+static const char *date_canon(apr_pool_t *p, const char *date)
+{
+ apr_status_t rv;
+ char* ndate;
+
+ apr_time_t time = apr_date_parse_http(date);
+ if (!time) {
+ return date;
+ }
+
+ ndate = apr_palloc(p, APR_RFC822_DATE_LEN);
+ rv = apr_rfc822_date(ndate, time);
+ if (rv != APR_SUCCESS) {
+ return date;
+ }
+
+ return ndate;
+}
+
+static request_rec *make_fake_req(conn_rec *c, request_rec *r)
+{
+ apr_pool_t *pool;
+ request_rec *rp;
+
+ apr_pool_create(&pool, c->pool);
+
+ rp = apr_pcalloc(pool, sizeof(*r));
+
+ rp->pool = pool;
+ rp->status = HTTP_OK;
+
+ rp->headers_in = apr_table_make(pool, 50);
+ rp->subprocess_env = apr_table_make(pool, 50);
+ rp->headers_out = apr_table_make(pool, 12);
+ rp->err_headers_out = apr_table_make(pool, 5);
+ rp->notes = apr_table_make(pool, 5);
+
+ rp->server = r->server;
+ rp->log = r->log;
+ rp->proxyreq = r->proxyreq;
+ rp->request_time = r->request_time;
+ rp->connection = c;
+ rp->output_filters = c->output_filters;
+ rp->input_filters = c->input_filters;
+ rp->proto_output_filters = c->output_filters;
+ rp->proto_input_filters = c->input_filters;
+ rp->client_ip = c->peer_ip;
+ rp->client_addr = c->peer_addr;
+
+ rp->request_config = ap_create_request_config(pool);
+ proxy_run_create_req(r, rp);
+
+ return rp;
+}
+
static void process_proxy_header(request_rec *r, proxy_dir_conf *c,
const char *key, const char *value)
{
for (i = 0; date_hdrs[i]; ++i) {
if (!strcasecmp(date_hdrs[i], key)) {
apr_table_add(r->headers_out, key,
- ap_proxy_date_canon(r->pool, value));
+ date_canon(r->pool, value));
return;
}
}
* filter chain
*/
- backend->r = ap_proxy_make_fake_req(origin, r);
+ backend->r = make_fake_req(origin, r);
/* In case anyone needs to know, this is a fake request that is really a
* response.
*/
*/
te = apr_table_get(r->headers_out, "Transfer-Encoding");
/* strip connection listed hop-by-hop headers from response */
- backend->close += ap_proxy_liststr(apr_table_get(r->headers_out,
- "Connection"),
- "close");
+ backend->close += ap_find_token(p,
+ apr_table_get(r->headers_out, "Connection"), "close");
ap_proxy_clear_connection(p, r->headers_out);
if ((buf = apr_table_get(r->headers_out, "Content-Type"))) {
ap_set_content_type(r, apr_pstrdup(p, buf));
}
/* Switch the allocator lifetime of the buckets */
- ap_proxy_buckets_lifetime_transform(r, bb, pass_bb);
+ proxy_buckets_lifetime_transform(r, bb, pass_bb);
/* found the last brigade? */
if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(pass_bb))) {
return NULL;
}
-/*
- * If the date is a valid RFC 850 date or asctime() date, then it
- * is converted to the RFC 1123 format.
- */
-PROXY_DECLARE(const char *)
- ap_proxy_date_canon(apr_pool_t *p, const char *date)
-{
- apr_status_t rv;
- char* ndate;
-
- apr_time_t time = apr_date_parse_http(date);
- if (!time) {
- return date;
- }
-
- ndate = apr_palloc(p, APR_RFC822_DATE_LEN);
- rv = apr_rfc822_date(ndate, time);
- if (rv != APR_SUCCESS) {
- return date;
- }
-
- return ndate;
-}
-
-PROXY_DECLARE(request_rec *)ap_proxy_make_fake_req(conn_rec *c, request_rec *r)
-{
- apr_pool_t *pool;
- request_rec *rp;
-
- apr_pool_create(&pool, c->pool);
-
- rp = apr_pcalloc(pool, sizeof(*r));
-
- rp->pool = pool;
- rp->status = HTTP_OK;
-
- rp->headers_in = apr_table_make(pool, 50);
- rp->subprocess_env = apr_table_make(pool, 50);
- rp->headers_out = apr_table_make(pool, 12);
- rp->err_headers_out = apr_table_make(pool, 5);
- rp->notes = apr_table_make(pool, 5);
-
- rp->server = r->server;
- rp->log = r->log;
- rp->proxyreq = r->proxyreq;
- rp->request_time = r->request_time;
- rp->connection = c;
- rp->output_filters = c->output_filters;
- rp->input_filters = c->input_filters;
- rp->proto_output_filters = c->output_filters;
- rp->proto_input_filters = c->input_filters;
-
- rp->request_config = ap_create_request_config(pool);
- proxy_run_create_req(r, rp);
-
- return rp;
-}
-
-
-/*
- * list is a comma-separated list of case-insensitive tokens, with
- * optional whitespace around the tokens.
- * The return returns 1 if the token val is found in the list, or 0
- * otherwise.
- */
-PROXY_DECLARE(int) ap_proxy_liststr(const char *list, const char *val)
-{
- int len, i;
- const char *p;
-
- len = strlen(val);
-
- while (list != NULL) {
- p = ap_strchr_c(list, ',');
- if (p != NULL) {
- i = p - list;
- do {
- p++;
- } while (apr_isspace(*p));
- }
- else {
- i = strlen(list);
- }
-
- while (i > 0 && apr_isspace(list[i - 1])) {
- i--;
- }
- if (i == len && strncasecmp(list, val, len) == 0) {
- return 1;
- }
- list = p;
- }
- return 0;
-}
-
-/*
- * Converts 8 hex digits to a time integer
- */
-PROXY_DECLARE(int) ap_proxy_hex2sec(const char *x)
-{
- int i, ch;
- unsigned int j;
-
- for (i = 0, j = 0; i < 8; i++) {
- ch = x[i];
- j <<= 4;
- if (apr_isdigit(ch)) {
- j |= ch - '0';
- }
- else if (apr_isupper(ch)) {
- j |= ch - ('A' - 10);
- }
- else {
- j |= ch - ('a' - 10);
- }
- }
- if (j == 0xffffffff) {
- return -1; /* so that it works with 8-byte ints */
- }
- else {
- return j;
- }
-}
-
-/*
- * Converts a time integer to 8 hex digits
- */
-PROXY_DECLARE(void) ap_proxy_sec2hex(int t, char *y)
-{
- int i, ch;
- unsigned int j = t;
-
- for (i = 7; i >= 0; i--) {
- ch = j & 0xF;
- j >>= 4;
- if (ch >= 10) {
- y[i] = ch + ('A' - 10);
- }
- else {
- y[i] = ch + '0';
- }
- }
- y[8] = '\0';
-}
-
PROXY_DECLARE(int) ap_proxyerror(request_rec *r, int statuscode, const char *message)
{
const char *uri = ap_escape_html(r->pool, r->uri);
return OK;
}
-/*
- * converts a series of buckets into a string
- * XXX: BillS says this function performs essentially the same function as
- * ap_rgetline() in protocol.c. Deprecate this function and use ap_rgetline()
- * instead? I think ap_proxy_string_read() will not work properly on non ASCII
- * (EBCDIC) machines either.
- */
-PROXY_DECLARE(apr_status_t) ap_proxy_string_read(conn_rec *c, apr_bucket_brigade *bb,
- char *buff, apr_size_t bufflen, int *eos)
-{
- apr_bucket *e;
- apr_status_t rv;
- char *pos = buff;
- char *response;
- int found = 0;
- apr_size_t len;
-
- /* start with an empty string */
- buff[0] = 0;
- *eos = 0;
-
- /* loop through each brigade */
- while (!found) {
- /* get brigade from network one line at a time */
- if (APR_SUCCESS != (rv = ap_get_brigade(c->input_filters, bb,
- AP_MODE_GETLINE,
- APR_BLOCK_READ,
- 0))) {
- return rv;
- }
- /* loop through each bucket */
- while (!found) {
- if (*eos || APR_BRIGADE_EMPTY(bb)) {
- /* The connection aborted or timed out */
- return APR_ECONNABORTED;
- }
- e = APR_BRIGADE_FIRST(bb);
- if (APR_BUCKET_IS_EOS(e)) {
- *eos = 1;
- }
- else {
- if (APR_SUCCESS != (rv = apr_bucket_read(e,
- (const char **)&response,
- &len,
- APR_BLOCK_READ))) {
- return rv;
- }
- /*
- * is string LF terminated?
- * XXX: This check can be made more efficient by simply checking
- * if the last character in the 'response' buffer is an ASCII_LF.
- * See ap_rgetline() for an example.
- */
- if (memchr(response, APR_ASCII_LF, len)) {
- found = 1;
- }
- /* concat strings until buff is full - then throw the data away */
- if (len > ((bufflen-1)-(pos-buff))) {
- len = (bufflen-1)-(pos-buff);
- }
- if (len > 0) {
- memcpy(pos, response, len);
- pos += len;
- }
- }
- APR_BUCKET_REMOVE(e);
- apr_bucket_destroy(e);
- }
- *pos = '\0';
- }
-
- return APR_SUCCESS;
-}
-
-/* unmerge an element in the table */
-PROXY_DECLARE(void) ap_proxy_table_unmerge(apr_pool_t *p, apr_table_t *t, char *key)
-{
- apr_off_t offset = 0;
- apr_off_t count = 0;
- char *value = NULL;
-
- /* get the value to unmerge */
- const char *initial = apr_table_get(t, key);
- if (!initial) {
- return;
- }
- value = apr_pstrdup(p, initial);
-
- /* remove the value from the headers */
- apr_table_unset(t, key);
-
- /* find each comma */
- while (value[count]) {
- if (value[count] == ',') {
- value[count] = 0;
- apr_table_add(t, key, value + offset);
- offset = count + 1;
- }
- count++;
- }
- apr_table_add(t, key, value + offset);
-}
-
PROXY_DECLARE(const char *) ap_proxy_location_reverse_map(request_rec *r,
proxy_dir_conf *conf, const char *url)
{
APR_BRIGADE_INSERT_TAIL(brigade, e);
}
-/*
- * Transform buckets from one bucket allocator to another one by creating a
- * transient bucket for each data bucket and let it use the data read from
- * the old bucket. Metabuckets are transformed by just recreating them.
- * Attention: Currently only the following bucket types are handled:
- *
- * All data buckets
- * FLUSH
- * EOS
- *
- * If an other bucket type is found its type is logged as a debug message
- * and APR_EGENERAL is returned.
- */
-PROXY_DECLARE(apr_status_t)
-ap_proxy_buckets_lifetime_transform(request_rec *r, apr_bucket_brigade *from,
- apr_bucket_brigade *to)
-{
- apr_bucket *e;
- apr_bucket *new;
- const char *data;
- apr_size_t bytes;
- apr_status_t rv = APR_SUCCESS;
-
- apr_brigade_cleanup(to);
- for (e = APR_BRIGADE_FIRST(from);
- e != APR_BRIGADE_SENTINEL(from);
- e = APR_BUCKET_NEXT(e)) {
- if (!APR_BUCKET_IS_METADATA(e)) {
- apr_bucket_read(e, &data, &bytes, APR_BLOCK_READ);
- new = apr_bucket_transient_create(data, bytes, r->connection->bucket_alloc);
- APR_BRIGADE_INSERT_TAIL(to, new);
- }
- else if (APR_BUCKET_IS_FLUSH(e)) {
- new = apr_bucket_flush_create(r->connection->bucket_alloc);
- APR_BRIGADE_INSERT_TAIL(to, new);
- }
- else if (APR_BUCKET_IS_EOS(e)) {
- new = apr_bucket_eos_create(r->connection->bucket_alloc);
- APR_BRIGADE_INSERT_TAIL(to, new);
- }
- else {
- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
- "Unhandled bucket type of type %s in"
- " ap_proxy_buckets_lifetime_transform", e->type->name);
- apr_bucket_delete(e);
- rv = APR_EGENERAL;
- }
- }
- return rv;
-}
-
/*
* Provide a string hashing function for the proxy.
* We offer 2 methods: one is the APR model but we
* @{
*/
+PROXY_DECLARE(int) ap_proxy_is_ipaddr(struct dirconn_entry *This, apr_pool_t *p);
+PROXY_DECLARE(int) ap_proxy_is_domainname(struct dirconn_entry *This, apr_pool_t *p);
+PROXY_DECLARE(int) ap_proxy_is_hostname(struct dirconn_entry *This, apr_pool_t *p);
+PROXY_DECLARE(int) ap_proxy_is_word(struct dirconn_entry *This, apr_pool_t *p);
+
+extern int PROXY_DECLARE_DATA proxy_lb_workers;
+extern const apr_strmatch_pattern PROXY_DECLARE_DATA *ap_proxy_strmatch_path;
+extern const apr_strmatch_pattern PROXY_DECLARE_DATA *ap_proxy_strmatch_domain;
+
/**
* Register optional functions declared within proxy_util.c.
*/