Mailing List Archive

ap_expr_exec() and Vary: Vary remains unset if we parse a string
Hi all,

I just been digging into why the Vary header is not set when generating a string expression with ap_expr_exec().

We currently set the Vary header when evaluating a condition:

https://github.com/apache/httpd/blob/53b5c234e90db489197935b84c0066c9ec083038/server/util_expr_eval.c#L1182

but we calculate the Vary header and then discard it when evaluating a string:

https://github.com/apache/httpd/blob/53b5c234e90db489197935b84c0066c9ec083038/server/util_expr_eval.c#L1166

The fix appears to be this simple:

Index: server/util_expr_eval.c
===================================================================
--- server/util_expr_eval.c (revision 1880567)
+++ server/util_expr_eval.c (working copy)
@@ -1163,6 +1163,10 @@
"Evaluation of string expression from %s:%d gave: %s",
ctx->info->filename, ctx->info->line_number,
*ctx->result_string);
+
+ if (ctx->r && ctx->vary_this && *ctx->vary_this)
+ apr_table_merge(ctx->r->headers_out, "Vary", *ctx->vary_this);
+
return 1;
}
}

Apart from a sudden outbreak of RFC compliance, what effect might this have on a backport to v2.4?

Regards,
Graham