--- native/mod_proxy_cluster/mod_proxy_cluster.c 2011-03-14 17:11:42 UTC (rev 537) +++ native/mod_proxy_cluster/mod_proxy_cluster.c 2011-03-16 10:43:02 UTC (rev 538) @@ -1958,14 +1958,51 @@ */ static int proxy_cluster_canon(request_rec *r, char *url) { + char *host, *path; + char *search = NULL; + const char *err; + apr_port_t port = 0; + + if (strncasecmp(url, "balancer:", 9) == 0) { + url += 9; + } else { + return DECLINED; + } + #if HAVE_CLUSTER_EX_DEBUG ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, r->server, "proxy_cluster_canon url: %s", url); #endif - if (strncasecmp(url, "balancer:", 9) == 0) { - return OK; + + /* do syntatic check. + * We break the URL into host, port, path, search + */ + err = ap_proxy_canon_netloc(r->pool, &url, NULL, NULL, &host, &port); + if (err) { + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "error parsing URL %s: %s", + url, err); + return HTTP_BAD_REQUEST; } - return DECLINED; + /* + * now parse path/search args, according to rfc1738: + * process the path. With proxy-noncanon set (by + * mod_proxy) we use the raw, unparsed uri + */ + if (apr_table_get(r->notes, "proxy-nocanon")) { + path = url; /* this is the raw path */ + } + else { + path = ap_proxy_canonenc(r->pool, url, strlen(url), enc_path, 0, + r->proxyreq); + search = r->args; + } + if (path == NULL) + return HTTP_BAD_REQUEST; + + r->filename = apr_pstrcat(r->pool, "proxy:balancer://", host, + "/", path, (search) ? "?" : "", (search) ? search : "", NULL); + return OK; } /*