]> granicus.if.org Git - php/commitdiff
Return HTTP 403 in case of "access denied".
authorDmitry Stogov <dmitry@php.net>
Fri, 9 Mar 2007 16:46:07 +0000 (16:46 +0000)
committerDmitry Stogov <dmitry@php.net>
Fri, 9 Mar 2007 16:46:07 +0000 (16:46 +0000)
sapi/cgi/cgi_main.c

index d97d75efeb2a7283739cc704a74b465739700db9..320b32d00afe9bf54249425880d273fbba6568f2 100644 (file)
@@ -1705,8 +1705,13 @@ consult the installation file that came with this distribution, or visit \n\
                        running from shell (so fp == NULL), then fail.
                */
                if (retval == FAILURE && file_handle.handle.fp == NULL) {
-                       SG(sapi_headers).http_response_code = 404;
-                       PUTS("No input file specified.\n");
+                       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");
+                       }
 #if PHP_FASTCGI
                        /* we want to serve more requests if this is fastcgi
                           so cleanup and continue, request shutdown is