php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | |
Patch mod_proxy_fcgi-support-v2.patch for FPM related Bug #54152Patch version 2011-03-07 17:37 UTC Return to Bug #54152 | Download this patchThis patch renders other patches obsolete Obsolete patches: Patch Revisions:Developer: mark@catseye.orgdiff -up php5.3-201103031330/sapi/fpm/fpm/fpm_main.c.paramfix php5.3-201103031330/sapi/fpm/fpm/fpm_main.c --- php5.3-201103031330/sapi/fpm/fpm/fpm_main.c.paramfix 2011-01-14 10:35:24.000000000 -0500 +++ php5.3-201103031330/sapi/fpm/fpm/fpm_main.c 2011-03-03 11:00:09.421159009 -0500 @@ -1130,6 +1130,26 @@ static void init_request_info(TSRMLS_D) env_path_info = _sapi_cgibin_putenv("PATH_INFO", env_path_info TSRMLS_CC); } + /* 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: + * /some-dir/info.php/test + */ + if (env_script_filename && strncasecmp(env_script_filename, "proxy:", + sizeof("proxy:") - 1) == 0) { + char *p = strstr(env_script_filename, "://"); + if (p) { + p += sizeof("://") - 1; /* advance to first character of hostname */ + 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); + } + } + } + if (CGIG(fix_pathinfo)) { struct stat st; char *real_path = NULL; @@ -1201,11 +1221,12 @@ static void init_request_info(TSRMLS_D) * we have to play the game of hide and seek to figure * out what SCRIPT_NAME should be */ - int slen = len - strlen(pt); + int ptlen = strlen(pt); + int slen = len - ptlen; int pilen = env_path_info ? strlen(env_path_info) : 0; - char *path_info = env_path_info ? env_path_info + pilen - slen : NULL; + char *path_info = script_path_translated + ptlen; - if (orig_path_info != path_info) { + if (slen != 0 && (!orig_path_info || strcmp(orig_path_info, path_info) != 0)) { if (orig_path_info) { char old; |
Copyright © 2001-2024 The PHP Group All rights reserved. |
Last updated: Sat Nov 23 21:01:28 2024 UTC |