From 659cf30d6f45726b67f149c43d2441396113f34a Mon Sep 17 00:00:00 2001 From: Eric Covener Date: Sat, 30 Nov 2019 20:28:36 +0000 Subject: [PATCH] PR63971 expose apr_table_unset for headers/envvars via nil assignment git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1870650 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 4 ++++ modules/lua/lua_apr.c | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index e99096813c..f73f111dbf 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,10 @@ -*- coding: utf-8 -*- Changes with Apache 2.5.1 + *) mod_lua: Accept nil assignments to the exposed tables (r.subprocess_env, + r.headers_out, etc) to remove the key from the table. PR63971. + [Eric Covener] + *) mod_http2: Fixed interaction with mod_reqtimeout. A loaded mod_http2 was disabling the ssl handshake timeouts. Also, fixed a mistake of the last version that made `H2Direct` always `on`, irregardless of configuration. Found and reported by diff --git a/modules/lua/lua_apr.c b/modules/lua/lua_apr.c index 8e34cf3082..9590fd6e18 100644 --- a/modules/lua/lua_apr.c +++ b/modules/lua/lua_apr.c @@ -39,7 +39,13 @@ static int lua_table_set(lua_State *L) { req_table_t *t = ap_lua_check_apr_table(L, 1); const char *key = luaL_checkstring(L, 2); - const char *val = luaL_checkstring(L, 3); + const char *val = luaL_optlstring(L, 3, NULL, NULL); + + if (!val) { + apr_table_unset(t->t, key); + return 0; + } + /* Unless it's the 'notes' table, check for newline chars */ /* t->r will be NULL in case of the connection notes, but since we aren't going to check anything called 'notes', we can safely