diff options
author | Antony Dovgal <tony2001@php.net> | 2009-12-16 17:49:57 +0000 |
---|---|---|
committer | Antony Dovgal <tony2001@php.net> | 2009-12-16 17:49:57 +0000 |
commit | 8d79b4d11431bcaa054688fe83196e16aabcd5fc (patch) | |
tree | c74a49ebbcd6dcfdb4e63c5471578866b2db2ea8 | |
parent | 75ec779c062ec35f93b3b981e34d53e4e9e42549 (diff) | |
download | php-git-8d79b4d11431bcaa054688fe83196e16aabcd5fc.tar.gz |
check if the file exists, return 404 otherwise (Jerome Loyet)
-rw-r--r-- | sapi/fpm/fpm/fpm_main.c | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index 2eaa4cbf77..93cc03f332 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -1776,24 +1776,32 @@ consult the installation file that came with this distribution, or visit \n\ 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(); |