From: Daniel Gruno Date: Tue, 7 Aug 2012 17:29:26 +0000 (+0000) Subject: mod_lua: Decline to serve a request if the script doesn't exist, instead of throwing... X-Git-Tag: 2.5.0-alpha~6470 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7b20ffb70256c088a3e693a4143d761c8349935;p=thirdparty%2Fapache%2Fhttpd.git mod_lua: Decline to serve a request if the script doesn't exist, instead of throwing an internal server error. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1370377 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 257af74c20e..0a7538cded0 100644 --- a/CHANGES +++ b/CHANGES @@ -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] diff --git a/modules/lua/mod_lua.c b/modules/lua/mod_lua.c index dab098cbe6a..5deb3fe2c5a 100644 --- a/modules/lua/mod_lua.c +++ b/modules/lua/mod_lua.c @@ -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);