tony2001                                 Wed, 16 Dec 2009 17:49:57 +0000

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

Log:
check if the file exists, return 404 otherwise (Jerome Loyet)

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

Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_main.c
===================================================================
--- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_main.c    2009-12-16 
17:49:04 UTC (rev 292217)
+++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_main.c    2009-12-16 
17:49:57 UTC (rev 292218)
@@ -1776,24 +1776,32 @@
                                return FAILURE;
                        }

-                       if (SG(request_info).path_translated) {
-                               if (php_fopen_primary_script(&file_handle 
TSRMLS_CC) == FAILURE) {
-                                       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 */
+                       /* If path_translated is NULL, terminate here with a 
404 */
+                       if (!SG(request_info).path_translated) {
+                               zend_try {
+                                       SG(sapi_headers).http_response_code = 
404;
+                               } zend_catch {
+                               } zend_end_try();
+                               goto fastcgi_request_done;
+                       }

-                                       goto fastcgi_request_done;
-                               }
+                       /* path_translated exists, we can continue ! */
+                       if (php_fopen_primary_script(&file_handle TSRMLS_CC) == 
FAILURE) {
+                               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 */
+
+                               goto fastcgi_request_done;
                        }

                        fpm_request_executing();

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to