You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2019/11/30 20:28:36 UTC

svn commit: r1870650 - in /httpd/httpd/trunk: CHANGES modules/lua/lua_apr.c

Author: covener
Date: Sat Nov 30 20:28:36 2019
New Revision: 1870650

URL: http://svn.apache.org/viewvc?rev=1870650&view=rev
Log:
PR63971 expose apr_table_unset for headers/envvars

via nil assignment


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

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1870650&r1=1870649&r2=1870650&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sat Nov 30 20:28:36 2019
@@ -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

Modified: httpd/httpd/trunk/modules/lua/lua_apr.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/lua_apr.c?rev=1870650&r1=1870649&r2=1870650&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/lua/lua_apr.c (original)
+++ httpd/httpd/trunk/modules/lua/lua_apr.c Sat Nov 30 20:28:36 2019
@@ -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