php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #62172
Patch fpm-balancer-v3 revision 2015-04-28 15:20 UTC by matt at haught dot org
Patch fpm-balancer-v2 revision 2014-02-01 19:42 UTC by matt at haught dot org
Patch fpm-balancer revision 2012-05-28 00:50 UTC by jdr at alexanderinteractive dot com

Patch fpm-balancer-v2 for FPM related Bug #62172

Patch version 2014-02-01 19:42 UTC

Return to Bug #62172 | Download this patch
This patch is obsolete

Obsoleted by patches:

This patch renders other patches obsolete

Obsolete patches:

Patch Revisions:

Developer: matt@haught.org

--- sapi/fpm/fpm/fpm_main.c.balancer	2012-05-08 01:22:56.000000000 -0400
+++ sapi/fpm/fpm/fpm_main.c	2012-05-27 17:54:42.958772555 -0400
@@ -1059,6 +1059,7 @@ static void init_request_info(TSRMLS_D)
 		}
 
 #define APACHE_PROXY_FCGI_PREFIX "proxy:fcgi://"
+#define APACHE_PROXY_BALANCER_PREFIX "proxy:balancer://"
 		/* Fix proxy URLs in SCRIPT_FILENAME generated by Apache mod_proxy_fcgi:
 		 *     proxy:fcgi://localhost:9000/some-dir/info.php/test
 		 * should be changed to:
@@ -1082,6 +1083,27 @@ static void init_request_info(TSRMLS_D)
 			}
 		}
 
+		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;
+			}
+			/* ignore query string if sent by Apache (RewriteRule) */
+			p = strchr(env_script_filename, '?');
+			if (p) {
+				*p =0;
+			}
+		}
+
 		if (CGIG(fix_pathinfo)) {
 			struct stat st;
 			char *real_path = NULL;

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 20:01:29 2024 UTC