1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
#! /bin/sh /usr/share/dpatch/dpatch-run
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Fix parsing of mod_proxy_balancer configuration, PR40910, #453630
@DPATCH@
diff -urNad etch-apache2~/modules/proxy/proxy_util.c etch-apache2/modules/proxy/proxy_util.c
--- etch-apache2~/modules/proxy/proxy_util.c 2008-01-20 22:05:06.000000000 +0100
+++ etch-apache2/modules/proxy/proxy_util.c 2008-01-20 22:09:11.292897243 +0100
@@ -1215,6 +1215,7 @@
proxy_worker *max_worker = NULL;
int max_match = 0;
int url_length;
+ int min_match;
int worker_name_length;
const char *c;
char *url_copy;
@@ -1239,19 +1240,24 @@
pathstart = url_copy + (c - url);
*pathstart = '\0';
ap_str_tolower(url_copy);
+ min_match = strlen(url_copy);
*pathstart = '/';
} else {
ap_str_tolower(url_copy);
+ min_match = strlen(url_copy);
}
worker = (proxy_worker *)conf->workers->elts;
/*
* Do a "longest match" on the worker name to find the worker that
- * fits best to the URL.
+ * fits best to the URL, but keep in mind that we must have at least
+ * a minimum matching of length min_match such that
+ * scheme://hostname[:port] matches between worker and url.
*/
for (i = 0; i < conf->workers->nelts; i++) {
if ( ((worker_name_length = strlen(worker->name)) <= url_length)
+ && (worker_name_length >= min_match)
&& (worker_name_length > max_match)
&& (strncmp(url_copy, worker->name, worker_name_length) == 0) ) {
max_worker = worker;
|