Description: Make mod_proxy_balancer and mod_proxy_fcgi RFC 3875 complient --- apache2-2.4.10.orig/modules/proxy/mod_proxy_balancer.c +++ apache2-2.4.10/modules/proxy/mod_proxy_balancer.c @@ -101,7 +101,23 @@ static int proxy_balancer_canon(request_ r->filename = apr_pstrcat(r->pool, "proxy:", BALANCER_PREFIX, host, "/", path, (search) ? "?" : "", (search) ? search : "", NULL); - r->path_info = apr_pstrcat(r->pool, "/", path, NULL); + /* According to RFC 3875 PATH_INFO should contain the portion + * of the URI to be interpreted by the FCGI script. In general + * terms that would be the portion _after_ the script name. + */ + // r->path_info = apr_pstrcat(r->pool, "/", path, NULL); + int sru_p = 0; + while ( path[sru_p] != '.' && sru_p < strlen(path)) { sru_p++; } // search for first '.' + while ( path[sru_p] && ((path[sru_p] != '/') && (path[sru_p] != '?')) && sru_p < strlen(path)) { + sru_p++; + } + if (sru_p && path[sru_p]) { + if (search) { + r->path_info = apr_pstrcat(r->pool, apr_pstrndup(r->pool, path + sru_p, strlen(path) - sru_p), "?", search, NULL); + } else { + r->path_info = apr_pstrndup(r->pool, path + sru_p, strlen(path) - sru_p); + } + } return OK; } --- apache2-2.4.10.orig/modules/proxy/mod_proxy_fcgi.c +++ apache2-2.4.10/modules/proxy/mod_proxy_fcgi.c @@ -76,11 +76,27 @@ static int proxy_fcgi_canon(request_rec ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01060) "set r->filename to %s", r->filename); - if (apr_table_get(r->subprocess_env, "proxy-fcgi-pathinfo")) { - r->path_info = apr_pstrcat(r->pool, "/", path, NULL); - - ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01061) - "set r->path_info to %s", r->path_info); + /* According to RFC 3875 PATH_INFO should contain the portion + * of the URI to be interpreted by the FCGI script. In general + * terms that would be the portion _after_ the script name. + */ + // if (apr_table_get(r->subprocess_env, "proxy-fcgi-pathinfo")) { + // r->path_info = apr_pstrcat(r->pool, "/", path, NULL); + // + // ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01061) + // "set r->path_info to %s", r->path_info); + //} + int sru_p = 0; + while ( path[sru_p] != '.' && sru_p < strlen(path)) { sru_p++; } // search for first '.' + while ( path[sru_p] && ((path[sru_p] != '/') && (path[sru_p] != '?')) && sru_p < strlen(path)) { + sru_p++; + } + if (sru_p && path[sru_p]) { + if (r->args) { + r->path_info = apr_pstrcat(r->pool, apr_pstrndup(r->pool, path + sru_p, strlen(path) - sru_p), "?", r->args, NULL); + } else { + r->path_info = apr_pstrndup(r->pool, path + sru_p, strlen(path) - sru_p); + } } return OK; --- apache2-2.4.10.orig/server/util_script.c +++ apache2-2.4.10/server/util_script.c @@ -297,6 +297,13 @@ AP_DECLARE(int) ap_find_path_info(const int lu = strlen(uri); int lp = strlen(path_info); + /* Since path_info may contain GET vars we need to + * skip those first + */ + if strchr(path_info, '?') { + while (path_info[--lp] != '?') { } + /* lp--; */ + } while (lu-- && lp-- && uri[lu] == path_info[lp]) { if (path_info[lp] == '/') { while (lu && uri[lu-1] == '/') lu--;