dmitry Mon, 30 Nov 2009 14:43:22 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=291497
Log: Fixed bug #50168 (FastCGI fails with wrong error on HEAD request to non-existant file) Bug: http://bugs.php.net/50168 (Assigned) FastCGI fails with wrong error on HEAD request to non-existant file Changed paths: U php/php-src/branches/PHP_5_2/NEWS U php/php-src/branches/PHP_5_2/sapi/cgi/cgi_main.c U php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c Modified: php/php-src/branches/PHP_5_2/NEWS =================================================================== --- php/php-src/branches/PHP_5_2/NEWS 2009-11-30 14:21:23 UTC (rev 291496) +++ php/php-src/branches/PHP_5_2/NEWS 2009-11-30 14:43:22 UTC (rev 291497) @@ -2,6 +2,8 @@ ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? Dec 2009, PHP 5.2.12RC4 - Fixed bug #50266 (conflicting types for llabs). (Jani) +- Fixed bug #50168 (FastCGI fails with wrong error on HEAD request to + non-existant file). (Dmitry) 27 Nov 2009, PHP 5.2.12RC3 Modified: php/php-src/branches/PHP_5_2/sapi/cgi/cgi_main.c =================================================================== --- php/php-src/branches/PHP_5_2/sapi/cgi/cgi_main.c 2009-11-30 14:21:23 UTC (rev 291496) +++ php/php-src/branches/PHP_5_2/sapi/cgi/cgi_main.c 2009-11-30 14:43:22 UTC (rev 291497) @@ -1496,8 +1496,9 @@ in case some server does something different than above */ && (!CGIG(redirect_status_env) || !getenv(CGIG(redirect_status_env))) ) { - SG(sapi_headers).http_response_code = 400; - PUTS("<b>Security Alert!</b> The PHP CGI cannot be accessed directly.\n\n\ + zend_try { + SG(sapi_headers).http_response_code = 400; + PUTS("<b>Security Alert!</b> The PHP CGI cannot be accessed directly.\n\n\ <p>This PHP CGI binary was compiled with force-cgi-redirect enabled. This\n\ means that a page will only be served up if the REDIRECT_STATUS CGI variable is\n\ set, e.g. via an Apache Action directive.</p>\n\ @@ -1506,7 +1507,8 @@ <p>For more information about changing this behaviour or re-enabling this webserver,\n\ consult the installation file that came with this distribution, or visit \n\ <a href=\"http://php.net/install.windows\">the manual page</a>.</p>\n"); - + } zend_catch { + } zend_end_try(); #if defined(ZTS) && !defined(PHP_DEBUG) /* XXX we're crashing here in msvc6 debug builds at php_message_handler_for_zend:839 because @@ -1936,13 +1938,16 @@ running from shell (so fp == NULL), then fail. */ if (retval == FAILURE && file_handle.handle.fp == NULL) { - if (errno == EACCES) { - SG(sapi_headers).http_response_code = 403; - PUTS("Access denied.\n"); - } else { - SG(sapi_headers).http_response_code = 404; - PUTS("No input file specified.\n"); - } + zend_try { + if (errno == EACCES) { + SG(sapi_headers).http_response_code = 403; + PUTS("Access denied.\n"); + } else { + SG(sapi_headers).http_response_code = 404; + PUTS("No input file specified.\n"); + } + } zend_catch { + } zend_end_try(); #if PHP_FASTCGI /* we want to serve more requests if this is fastcgi so cleanup and continue, request shutdown is Modified: php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c =================================================================== --- php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c 2009-11-30 14:21:23 UTC (rev 291496) +++ php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c 2009-11-30 14:43:22 UTC (rev 291497) @@ -1634,8 +1634,9 @@ * in case some server does something different than above */ (!CGIG(redirect_status_env) || !getenv(CGIG(redirect_status_env))) ) { - SG(sapi_headers).http_response_code = 400; - PUTS("<b>Security Alert!</b> The PHP CGI cannot be accessed directly.\n\n\ + zend_try { + SG(sapi_headers).http_response_code = 400; + PUTS("<b>Security Alert!</b> The PHP CGI cannot be accessed directly.\n\n\ <p>This PHP CGI binary was compiled with force-cgi-redirect enabled. This\n\ means that a page will only be served up if the REDIRECT_STATUS CGI variable is\n\ set, e.g. via an Apache Action directive.</p>\n\ @@ -1644,7 +1645,8 @@ <p>For more information about changing this behaviour or re-enabling this webserver,\n\ consult the installation file that came with this distribution, or visit \n\ <a href=\"http://php.net/install.windows\">the manual page</a>.</p>\n"); - + } zend_catch { + } zend_end_try(); #if defined(ZTS) && !defined(PHP_DEBUG) /* XXX we're crashing here in msvc6 debug builds at * php_message_handler_for_zend:839 because @@ -2040,13 +2042,16 @@ */ if (cgi || fastcgi || SG(request_info).path_translated) { if (php_fopen_primary_script(&file_handle TSRMLS_CC) == FAILURE) { - if (errno == EACCES) { - SG(sapi_headers).http_response_code = 403; - PUTS("Access denied.\n"); - } else { - SG(sapi_headers).http_response_code = 404; - PUTS("No input file specified.\n"); - } + zend_try { + if (errno == EACCES) { + SG(sapi_headers).http_response_code = 403; + PUTS("Access denied.\n"); + } else { + SG(sapi_headers).http_response_code = 404; + PUTS("No input file specified.\n"); + } + } zend_catch { + } zend_end_try(); /* we want to serve more requests if this is fastcgi * so cleanup and continue, request shutdown is * handled later */
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php