php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | |
Patch fpm-balancer-v3 for FPM related Bug #62172Patch version 2015-04-28 15:20 UTC Return to Bug #62172 | Download this patchThis patch renders other patches obsolete Obsolete patches: Patch Revisions:Developer: matt@haught.org--- sapi/fpm/fpm/fpm_main.c.balancer +++ sapi/fpm/fpm/fpm_main.c @@ -1057,11 +1057,40 @@ static void init_request_info(void) memmove(env_script_filename, p, strlen(p) + 1); apache_was_here = 1; } + } + +#define APACHE_PROXY_BALANCER_PREFIX "proxy:balancer://" + /* Fix proxy URLs in SCRIPT_FILENAME generated by Apache mod_proxy_balancer: + * proxy:balancer://localhost:9000/some-dir/info.php/test?foo=bar + * should be changed to: + * /some-dir/info.php/test + * See: http://bugs.php.net/bug.php?id=54152 + * https://issues.apache.org/bugzilla/show_bug.cgi?id=50851 + */ + if (env_script_filename && + strncasecmp(env_script_filename, APACHE_PROXY_BALANCER_PREFIX, sizeof(APACHE_PROXY_BALANCER_PREFIX) - 1) == 0) { + /* advance to first character of hostname */ + char *p = env_script_filename + (sizeof(APACHE_PROXY_BALANCER_PREFIX) - 1); + while (*p != '\0' && *p != '/') { + p++; /* move past hostname and port */ + } + if (*p != '\0') { + /* Copy path portion in place to avoid memory leak. Note + * that this also affects what script_path_translated points + * to. */ + memmove(env_script_filename, p, strlen(p) + 1); + apache_was_here = 1; + } + } + + if (env_server_software && + strncmp(env_server_software, "Apache", sizeof("Apache") - 1) == 0) { /* ignore query string if sent by Apache (RewriteRule) */ - p = strchr(env_script_filename, '?'); + char *p = strchr(env_script_filename, '?'); if (p) { - *p =0; + *p = 0; } + apache_was_here = 1; } if (CGIG(fix_pathinfo)) { |
Copyright © 2001-2024 The PHP Group All rights reserved. |
Last updated: Thu Nov 21 20:01:29 2024 UTC |