You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2020/01/30 15:11:21 UTC

svn commit: r1873366 - in /httpd/httpd/branches/2.4.x: ./ CHANGES STATUS modules/lua/lua_apr.c

Author: jim
Date: Thu Jan 30 15:11:21 2020
New Revision: 1873366

URL: http://svn.apache.org/viewvc?rev=1873366&view=rev
Log:
Merge r1870650 from trunk:

PR63971 expose apr_table_unset for headers/envvars

via nil assignment


Submitted by: covener
Reviewed by: covener, jim, humbedooh

Modified:
    httpd/httpd/branches/2.4.x/   (props changed)
    httpd/httpd/branches/2.4.x/CHANGES
    httpd/httpd/branches/2.4.x/STATUS
    httpd/httpd/branches/2.4.x/modules/lua/lua_apr.c

Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk:r1870650

Modified: httpd/httpd/branches/2.4.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/CHANGES?rev=1873366&r1=1873365&r2=1873366&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.4.x/CHANGES [utf-8] Thu Jan 30 15:11:21 2020
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.4.42
 
+  *) 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/branches/2.4.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/STATUS?rev=1873366&r1=1873365&r2=1873366&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/STATUS (original)
+++ httpd/httpd/branches/2.4.x/STATUS Thu Jan 30 15:11:21 2020
@@ -132,12 +132,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  *) mod_lua: allow nil assignment to trigger apr_table_unset
-           (nil assignment to an APR table used to throw an error)
-     trunk patch: http://svn.apache.org/r1870650
-     2.4.x patch: svn merge -c 1870650 ^/httpd/httpd/trunk
-     +1: covener, jim, humbedooh
-
   *) mod_lua: add _table() methods to return raw r/o lua tables that can be
      iterated over for headers/notes/subprocess_env:
      trunk patch: http://svn.apache.org/r1872455

Modified: httpd/httpd/branches/2.4.x/modules/lua/lua_apr.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/lua/lua_apr.c?rev=1873366&r1=1873365&r2=1873366&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/lua/lua_apr.c (original)
+++ httpd/httpd/branches/2.4.x/modules/lua/lua_apr.c Thu Jan 30 15:11:21 2020
@@ -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