mirror of
https://github.com/apache/httpd.git
synced 2025-08-07 04:02:58 +03:00
mod_lua: Allow scripts handled by the lua-script handler to set a return
code that will be sent to the client, such as 302, 500 etc. This will allow scripts to be able to f.x. redirect a user to another page by returning 302. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1374185 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -233,6 +233,7 @@ static const char* ap_lua_interpolate_string(apr_pool_t* pool, const char* strin
|
||||
*/
|
||||
static int lua_handler(request_rec *r)
|
||||
{
|
||||
int rc = OK;
|
||||
if (strcmp(r->handler, "lua-script")) {
|
||||
return DECLINED;
|
||||
}
|
||||
@@ -275,12 +276,15 @@ static int lua_handler(request_rec *r)
|
||||
return HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
ap_lua_run_lua_request(L, r);
|
||||
if (lua_pcall(L, 1, 0, 0)) {
|
||||
if (lua_pcall(L, 1, 1, 0)) {
|
||||
report_lua_error(L, r);
|
||||
}
|
||||
if (lua_isnumber(L, -1)) {
|
||||
rc = lua_tointeger(L, -1);
|
||||
}
|
||||
ap_lua_release_state(L, spec, r);
|
||||
}
|
||||
return OK;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user