--- httpd-2.2.9-orig/modules/dav/main/util.c 2008-01-05 09:45:07.000000000 +0000 +++ httpd-2.2.9-orig/modules/dav/main/util.c 2008-09-19 13:33:07.000000000 +0000 @@ -254,6 +254,25 @@ comp.hostname = apr_pstrcat(r->pool, comp.hostname, domain, NULL); } + const char *host = apr_table_get(r->headers_in, "Host"); + if (NULL != host) { + char *port_str = strstr(host, ":"); + int port; + + if (port_str) { + *port_str = 0; + port_str++; + port = atoi(port_str); + } else { + port = ap_default_port(r); + } + + if (port != comp.port || strcmp(host, comp.hostname) != 0) { + result.err.status = HTTP_BAD_GATEWAY; + return result; + } + } + /* now, if a hostname was provided, then verify that it represents the same server as the current connection. note that we just use our port, since we've verified the URI matches ours */ @@ -1419,11 +1438,11 @@ retVal = ap_meets_conditions(r); - /* If-None-Match '*' fix. If-None-Match '*' request should succeed + /* If-None-Match '*' fix. If-None-Match '*' request should succeed * if the resource does not exist. */ if (retVal == HTTP_PRECONDITION_FAILED) { /* Note. If if_none_match != NULL, if_none_match is the culprit. - * Since, in presence of If-None-Match, + * Since, in presence of If-None-Match, * other If-* headers are undefined. */ if ((if_none_match = apr_table_get(r->headers_in, "If-None-Match")) != NULL) { --- httpd-2.2.9-orig/modules/proxy/mod_proxy.c 2008-05-28 21:11:24.000000000 +0000 +++ httpd-2.2.9-orig/modules/proxy/mod_proxy.c 2008-09-18 16:16:18.000000000 +0000 @@ -494,6 +494,55 @@ } return ret; } + +static void proxy_trans_destination(request_rec *r) +{ + char *dest = apr_table_get(r->headers_in, "Destination"); + if (!dest) + return; + + + apr_uri_t dest_uri; + + if (apr_uri_parse(r->pool, dest, &dest_uri) != APR_SUCCESS) { + return; + } + + void *sconf = r->server->module_config; + proxy_server_conf *conf = + (proxy_server_conf *) ap_get_module_config(sconf, &proxy_module); + int i, len; + proxy_dir_conf *dconf = ap_get_module_config(r->per_dir_config, + &proxy_module); + + const char *fake; + const char *real; + struct proxy_alias *ent = (struct proxy_alias *) conf->aliases->elts; + + for (i = 0; i < conf->aliases->nelts; i++) { + const char *use_uri = dest_uri.path; + if ((dconf->interpolate_env == 1) + && (ent[i].flags & PROXYPASS_INTERPOLATE)) { + fake = proxy_interpolate(r, ent[i].fake); + real = proxy_interpolate(r, ent[i].real); + } + else { + fake = ent[i].fake; + real = ent[i].real; + } + + if (!ent[i].regex) { + len = alias_match(use_uri, fake); + if (0 == len) + continue; + + use_uri = apr_pstrcat(r->pool, real, use_uri + len, NULL); + apr_table_set(r->headers_in, "Destination", use_uri); + return; + } + } +} + static int proxy_trans(request_rec *r) { void *sconf = r->server->module_config; @@ -510,6 +559,8 @@ char *found = NULL; int mismatch = 0; + proxy_trans_destination(r); + if (r->proxyreq) { /* someone has already set up the proxy, it was possibly ourselves * in proxy_detect