From 6720c78154f3ad90fa82206e95adde23868c55ae Mon Sep 17 00:00:00 2001 From: Rainer Jung Date: Sun, 16 Dec 2012 14:46:45 +0000 Subject: [PATCH] ap_expr: Add req_novary function that allows HTTP header lookups without adding the name to the Vary header. Submitted by: sf Backported by: rjung Reviewed by: rjung, jailletc36, sf Backport of r1403483 from trunk. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1422586 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ STATUS | 11 ----------- docs/manual/expr.xml | 10 ++++++++-- server/util_expr_eval.c | 3 +++ 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/CHANGES b/CHANGES index f53a23f499..afb3d325f1 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ Changes with Apache 2.4.4 + *) ap_expr: Add req_novary function that allows HTTP header lookups + without adding the name to the Vary header. [Stefan Fritsch] + *) mod_slotmem_*: Add in new fgrab() function which forces a grab and slot allocation on a specified slot. Allow for clearing of inuse array. [Jim Jagielski] diff --git a/STATUS b/STATUS index 6409105d80..1a1478df57 100644 --- a/STATUS +++ b/STATUS @@ -91,17 +91,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - * ap_expr: Add req_novary function that allows HTTP header lookups - without adding the name to the Vary header - Not critical for 2.4.4. - trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1403483 - 2.4.x patch: Trunk patch works. - +1: rjung, jailletc36, sf - jailletc36: IMO, a line in CHANGES should be added to reflect the new functionality - and maybe the doc should tell in which version of apache it has been - introduced - rjung: Will include a CHANGES item and a compatibility note in expr.xml. - PATCHES PROPOSED TO BACKPORT FROM TRUNK: [ New proposals should be added at the end of the list ] diff --git a/docs/manual/expr.xml b/docs/manual/expr.xml index 6980419889..41bf6462b9 100644 --- a/docs/manual/expr.xml +++ b/docs/manual/expr.xml @@ -142,7 +142,9 @@ listfunction ::= listfuncname "(" word ")" req function. Using these variables may cause the header name to be added to the Vary header of the HTTP response, except where otherwise noted for the - directive accepting the expression.

+ directive accepting the expression. The req_novary + function may be used to circumvent this + behavior.

@@ -434,6 +436,9 @@ listfunction ::= listfuncname "(" word ")" + + @@ -468,7 +473,8 @@ listfunction ::= listfuncname "(" word ")"

When the functions req or http are used, the header name will automatically be added to the Vary header of the HTTP response, except where otherwise noted for the directive accepting - the expression.

+ the expression. The req_novary function can be used to + prevent names from being added to the Vary header.

In addition to string-valued functions, there are also list-valued functions which take one string as argument and return a wordlist, i.e. a list of strings. The wordlist diff --git a/server/util_expr_eval.c b/server/util_expr_eval.c index 699593108c..b350cfc771 100644 --- a/server/util_expr_eval.c +++ b/server/util_expr_eval.c @@ -968,6 +968,8 @@ static const char *req_table_func(ap_expr_eval_ctx_t *ctx, const void *data, t = ctx->r->notes; else if (name[3] == 'e') /* reqenv */ t = ctx->r->subprocess_env; + else if (name[3] == '_') /* req_novary */ + t = ctx->r->headers_in; else { /* req, http */ t = ctx->r->headers_in; add_vary(ctx, arg); @@ -1566,6 +1568,7 @@ static const struct expr_provider_single string_func_providers[] = { { req_table_func, "http", NULL, 0 }, { req_table_func, "note", NULL, 0 }, { req_table_func, "reqenv", NULL, 0 }, + { req_table_func, "req_novary", NULL, 0 }, { tolower_func, "tolower", NULL, 0 }, { toupper_func, "toupper", NULL, 0 }, { escape_func, "escape", NULL, 0 }, -- 2.40.0

req, http Get HTTP request header; header names may be added to the Vary header, see below
req_novarySame as req, but header names will not be added to the + Vary header
resp Get HTTP response header
reqenv