You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by hu...@apache.org on 2012/08/07 19:29:27 UTC

svn commit: r1370377 - in /httpd/httpd/trunk: CHANGES modules/lua/mod_lua.c

Author: humbedooh
Date: Tue Aug  7 17:29:26 2012
New Revision: 1370377

URL: http://svn.apache.org/viewvc?rev=1370377&view=rev
Log:
mod_lua: Decline to serve a request if the script doesn't exist, instead of throwing an internal server error.

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/modules/lua/mod_lua.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1370377&r1=1370376&r2=1370377&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Tue Aug  7 17:29:26 2012
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mod_lua: Decline handling 'lua-script' if the file doesn't exist,
+     rather than throwing an internal server error. [Daniel Gruno]
+
   *) mod_lua: Add functions r:flush and r:sendfile as well as additional
      request information to the request_rec structure. [Daniel Gruno]
 

Modified: httpd/httpd/trunk/modules/lua/mod_lua.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/mod_lua.c?rev=1370377&r1=1370376&r2=1370377&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/lua/mod_lua.c (original)
+++ httpd/httpd/trunk/modules/lua/mod_lua.c Tue Aug  7 17:29:26 2012
@@ -236,6 +236,14 @@ static int lua_handler(request_rec *r)
     if (strcmp(r->handler, "lua-script")) {
         return DECLINED;
     }
+    /* Decline the request if the script does not exist (or is a directory),
+     * rather than just returning internal server error */
+    if (
+            (r->finfo.filetype == APR_NOFILE)
+            || (r->finfo.filetype & APR_DIR)
+        ) {
+        return DECLINED;
+    }
     ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, APLOGNO(01472)
                   "handling [%s] in mod_lua", r->filename);