Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_3/sapi/fpm/fpm/ fpm_main.c

2011-03-10 Thread Jim Jagielski
+1
On Thu, Mar 10, 2011 at 02:15:02PM +0100, Johannes Schl?ter wrote:
> Hi,
> 
> as Chris said we're trying to get out 5.3.6 out. Once 5.3.6 is out it
> can be re-added for 5.3.7.
> 
> johannes
> 
> On Wed, 2011-03-09 at 18:27 +, Jim Jagielski wrote:
> > jimjag   Wed, 09 Mar 2011 18:27:30 +
> > 
> > Revision: http://svn.php.net/viewvc?view=revision&revision=309053
> > 
> > Log:
> > Close [PHP-BUG] Req #54152...
> > Apache 2.3.12 (and later) will now work correctly with PHP's fcgi
> > impl with this patch.
> > 
> > Bug: http://bugs.php.net/54152 (Assigned) Make FPM compatible with Apache 
> > HTTP Server 2.3 mod_proxy_fcgi
> >   
> > Changed paths:
> > U   php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c
> > 
> > Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c
> > ===
> > --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c2011-03-09 
> > 16:41:07 UTC (rev 309052)
> > +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c2011-03-09 
> > 18:27:30 UTC (rev 309053)
> > @@ -1085,6 +1085,7 @@
> > char *env_path_translated = sapi_cgibin_getenv("PATH_TRANSLATED", 
> > sizeof("PATH_TRANSLATED")-1 TSRMLS_CC);
> > char *script_path_translated = env_script_filename;
> > char *ini;
> > +   int apache_was_here = 0;
> > 
> > /* some broken servers do not have script_filename or argv0
> >  * an example, IIS configured in some ways.  then they do more
> > @@ -1130,6 +1131,30 @@
> > env_path_info = _sapi_cgibin_putenv("PATH_INFO", 
> > env_path_info TSRMLS_CC);
> > }
> > 
> > +#define APACHE_PROXY_FCGI_PREFIX "proxy:fcgi://"
> > +   /* 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
> > +* 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_FCGI_PREFIX, sizeof(APACHE_PROXY_FCGI_PREFIX) - 1) == 0) {
> > +   /* advance to first character of hostname */
> > +   char *p = env_script_filename + 
> > (sizeof(APACHE_PROXY_FCGI_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 (CGIG(fix_pathinfo)) {
> > struct stat st;
> > char *real_path = NULL;
> > @@ -1201,11 +1226,21 @@
> >  * 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;
> > +   int tflag = 0;
> > +   char *path_info;
> > +   if (apache_was_here) {
> > +   /* recall that 
> > PATH_INFO won't exist */
> > +   path_info = 
> > script_path_translated + ptlen;
> > +   tflag = (slen != 0 && 
> > (!orig_path_info || strcmp(orig_path_info, path_info) != 0));
> > +   } else {
> > +   path_info = 
> > env_path_info ? env_path_info + pilen - slen : NULL;
> > +   tflag = (orig_path_info 
> > != path_info);
> > +   }
> > 
> > -   if (orig_path_info != 
> > path_info) {
> > +   if (

Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_3/sapi/fpm/fpm/ fpm_main.c

2011-03-10 Thread Johannes Schlüter
Hi,

as Chris said we're trying to get out 5.3.6 out. Once 5.3.6 is out it
can be re-added for 5.3.7.

johannes

On Wed, 2011-03-09 at 18:27 +, Jim Jagielski wrote:
> jimjag   Wed, 09 Mar 2011 18:27:30 +
> 
> Revision: http://svn.php.net/viewvc?view=revision&revision=309053
> 
> Log:
> Close [PHP-BUG] Req #54152...
> Apache 2.3.12 (and later) will now work correctly with PHP's fcgi
> impl with this patch.
> 
> Bug: http://bugs.php.net/54152 (Assigned) Make FPM compatible with Apache 
> HTTP Server 2.3 mod_proxy_fcgi
>   
> Changed paths:
> U   php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c
> 
> Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c
> ===
> --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c  2011-03-09 
> 16:41:07 UTC (rev 309052)
> +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c  2011-03-09 
> 18:27:30 UTC (rev 309053)
> @@ -1085,6 +1085,7 @@
>   char *env_path_translated = sapi_cgibin_getenv("PATH_TRANSLATED", 
> sizeof("PATH_TRANSLATED")-1 TSRMLS_CC);
>   char *script_path_translated = env_script_filename;
>   char *ini;
> + int apache_was_here = 0;
> 
>   /* some broken servers do not have script_filename or argv0
>* an example, IIS configured in some ways.  then they do more
> @@ -1130,6 +1131,30 @@
>   env_path_info = _sapi_cgibin_putenv("PATH_INFO", 
> env_path_info TSRMLS_CC);
>   }
> 
> +#define APACHE_PROXY_FCGI_PREFIX "proxy:fcgi://"
> + /* 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
> +  * 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_FCGI_PREFIX, sizeof(APACHE_PROXY_FCGI_PREFIX) - 1) == 0) {
> + /* advance to first character of hostname */
> + char *p = env_script_filename + 
> (sizeof(APACHE_PROXY_FCGI_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 (CGIG(fix_pathinfo)) {
>   struct stat st;
>   char *real_path = NULL;
> @@ -1201,11 +1226,21 @@
>* 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;
> + int tflag = 0;
> + char *path_info;
> + if (apache_was_here) {
> + /* recall that 
> PATH_INFO won't exist */
> + path_info = 
> script_path_translated + ptlen;
> + tflag = (slen != 0 && 
> (!orig_path_info || strcmp(orig_path_info, path_info) != 0));
> + } else {
> + path_info = 
> env_path_info ? env_path_info + pilen - slen : NULL;
> + tflag = (orig_path_info 
> != path_info);
> + }
> 
> - if (orig_path_info != 
> path_info) {
> + if (tflag) {
>   if (orig_path_info) {
>   char old;
> 
> 
> -- 
>

Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_3/sapi/fpm/fpm/ fpm_main.c

2011-03-09 Thread Christopher Jones


That would be a "no" then :)
We've already had to roll an unwanted RC3 due to a few patches coming in after 
RC2.

Also Derick was wondering about trunk?

Chris

On 03/09/2011 10:38 AM, Jim Jagielski wrote:

Pinged Johannes as soon as I started working on it in
hopes of getting it in 5.3.6... did not hear back with any
vetos or no's.
On Wed, Mar 09, 2011 at 10:33:10AM -0800, Christopher Jones wrote:


We're right at the end of the release process for PHP 5.3.6.
Did you check with Johannes before merging?

Chris

On 03/09/2011 10:27 AM, Jim Jagielski wrote:

jimjag   Wed, 09 Mar 2011 18:27:30 +

Revision: http://svn.php.net/viewvc?view=revision&revision=309053

Log:
Close [PHP-BUG] Req #54152...
Apache 2.3.12 (and later) will now work correctly with PHP's fcgi
impl with this patch.

Bug: http://bugs.php.net/54152 (Assigned) Make FPM compatible with Apache HTTP 
Server 2.3 mod_proxy_fcgi

Changed paths:
 U   php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c

Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c
===
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c2011-03-09 
16:41:07 UTC (rev 309052)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c2011-03-09 
18:27:30 UTC (rev 309053)
@@ -1085,6 +1085,7 @@
char *env_path_translated = sapi_cgibin_getenv("PATH_TRANSLATED", 
sizeof("PATH_TRANSLATED")-1 TSRMLS_CC);
char *script_path_translated = env_script_filename;
char *ini;
+   int apache_was_here = 0;

/* some broken servers do not have script_filename or argv0
 * an example, IIS configured in some ways.  then they do more
@@ -1130,6 +1131,30 @@
env_path_info = _sapi_cgibin_putenv("PATH_INFO", 
env_path_info TSRMLS_CC);
}

+#define APACHE_PROXY_FCGI_PREFIX "proxy:fcgi://"
+   /* 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
+* 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_FCGI_PREFIX, sizeof(APACHE_PROXY_FCGI_PREFIX) - 1) == 0) {
+   /* advance to first character of hostname */
+   char *p = env_script_filename + 
(sizeof(APACHE_PROXY_FCGI_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 (CGIG(fix_pathinfo)) {
struct stat st;
char *real_path = NULL;
@@ -1201,11 +1226,21 @@
 * 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;
+   int tflag = 0;
+   char *path_info;
+   if (apache_was_here) {
+   /* recall that 
PATH_INFO won't exist */
+   path_info = 
script_path_translated + ptlen;
+   tflag = (slen != 0&&   
(!orig_path_info || strcmp(orig_path_info, path_info) != 0));
+   } else {
+   path_info = 
env_path_info ? env_path_info + pilen - slen : NULL;
+   tflag = (orig_path_info 
!= path_info);
+   }

-

Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_3/sapi/fpm/fpm/ fpm_main.c

2011-03-09 Thread Jim Jagielski
Pinged Johannes as soon as I started working on it in
hopes of getting it in 5.3.6... did not hear back with any
vetos or no's.
On Wed, Mar 09, 2011 at 10:33:10AM -0800, Christopher Jones wrote:
> 
> We're right at the end of the release process for PHP 5.3.6.
> Did you check with Johannes before merging?
> 
> Chris
> 
> On 03/09/2011 10:27 AM, Jim Jagielski wrote:
> >jimjag   Wed, 09 Mar 2011 18:27:30 +
> >
> >Revision: http://svn.php.net/viewvc?view=revision&revision=309053
> >
> >Log:
> >Close [PHP-BUG] Req #54152...
> >Apache 2.3.12 (and later) will now work correctly with PHP's fcgi
> >impl with this patch.
> >
> >Bug: http://bugs.php.net/54152 (Assigned) Make FPM compatible with Apache 
> >HTTP Server 2.3 mod_proxy_fcgi
> >
> >Changed paths:
> > U   php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c
> >
> >Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c
> >===
> >--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c 2011-03-09 
> >16:41:07 UTC (rev 309052)
> >+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c 2011-03-09 
> >18:27:30 UTC (rev 309053)
> >@@ -1085,6 +1085,7 @@
> > char *env_path_translated = sapi_cgibin_getenv("PATH_TRANSLATED", 
> > sizeof("PATH_TRANSLATED")-1 TSRMLS_CC);
> > char *script_path_translated = env_script_filename;
> > char *ini;
> >+int apache_was_here = 0;
> >
> > /* some broken servers do not have script_filename or argv0
> >  * an example, IIS configured in some ways.  then they do more
> >@@ -1130,6 +1131,30 @@
> > env_path_info = _sapi_cgibin_putenv("PATH_INFO", 
> > env_path_info TSRMLS_CC);
> > }
> >
> >+#define APACHE_PROXY_FCGI_PREFIX "proxy:fcgi://"
> >+/* 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
> >+ * 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_FCGI_PREFIX, sizeof(APACHE_PROXY_FCGI_PREFIX) - 1) == 0) {
> >+/* advance to first character of hostname */
> >+char *p = env_script_filename + 
> >(sizeof(APACHE_PROXY_FCGI_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 (CGIG(fix_pathinfo)) {
> > struct stat st;
> > char *real_path = NULL;
> >@@ -1201,11 +1226,21 @@
> >  * 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;
> >+int tflag = 0;
> >+char *path_info;
> >+if (apache_was_here) {
> >+/* recall that 
> >PATH_INFO won't exist */
> >+path_info = 
> >script_path_translated + ptlen;
> >+tflag = (slen != 0&&  
> >(!orig_path_info || strcmp(orig_path_info, path_info) != 0));
> >+} else {
> >+path_info = 
> >env_path_info ? env_path_info + pilen - slen : NULL;
> >+tflag = (orig_path_info 
> >!= path_info);
> >+}
> >
> >-if (orig_path_info != 

Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_3/sapi/fpm/fpm/ fpm_main.c

2011-03-09 Thread Christopher Jones


We're right at the end of the release process for PHP 5.3.6.
Did you check with Johannes before merging?

Chris

On 03/09/2011 10:27 AM, Jim Jagielski wrote:

jimjag   Wed, 09 Mar 2011 18:27:30 +

Revision: http://svn.php.net/viewvc?view=revision&revision=309053

Log:
Close [PHP-BUG] Req #54152...
Apache 2.3.12 (and later) will now work correctly with PHP's fcgi
impl with this patch.

Bug: http://bugs.php.net/54152 (Assigned) Make FPM compatible with Apache HTTP 
Server 2.3 mod_proxy_fcgi

Changed paths:
 U   php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c

Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c
===
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c2011-03-09 
16:41:07 UTC (rev 309052)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c2011-03-09 
18:27:30 UTC (rev 309053)
@@ -1085,6 +1085,7 @@
char *env_path_translated = sapi_cgibin_getenv("PATH_TRANSLATED", 
sizeof("PATH_TRANSLATED")-1 TSRMLS_CC);
char *script_path_translated = env_script_filename;
char *ini;
+   int apache_was_here = 0;

/* some broken servers do not have script_filename or argv0
 * an example, IIS configured in some ways.  then they do more
@@ -1130,6 +1131,30 @@
env_path_info = _sapi_cgibin_putenv("PATH_INFO", 
env_path_info TSRMLS_CC);
}

+#define APACHE_PROXY_FCGI_PREFIX "proxy:fcgi://"
+   /* 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
+* 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_FCGI_PREFIX, sizeof(APACHE_PROXY_FCGI_PREFIX) - 1) == 0) {
+   /* advance to first character of hostname */
+   char *p = env_script_filename + 
(sizeof(APACHE_PROXY_FCGI_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 (CGIG(fix_pathinfo)) {
struct stat st;
char *real_path = NULL;
@@ -1201,11 +1226,21 @@
 * 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;
+   int tflag = 0;
+   char *path_info;
+   if (apache_was_here) {
+   /* recall that 
PATH_INFO won't exist */
+   path_info = 
script_path_translated + ptlen;
+   tflag = (slen != 0&&  
(!orig_path_info || strcmp(orig_path_info, path_info) != 0));
+   } else {
+   path_info = 
env_path_info ? env_path_info + pilen - slen : NULL;
+   tflag = (orig_path_info 
!= path_info);
+   }

-   if (orig_path_info != 
path_info) {
+   if (tflag) {
if (orig_path_info) {
char old;





--
Email: christopher.jo...@oracle.com
Tel:  +1 650 506 8630
Blog:  http://blogs.oracle.com/opal/

--
PHP CVS