Checkout Tools
  • last updated 7 hours ago
Constraints: committers
Constraints: files
Constraints: dates
util_expr: allow to specify only one of ap_expr_eval_ctx_t's r/c/s.

Depending on where the expression is evaluated, a request_rec might not be

available, so allow to specify only a conn_rec or a server_rec (at least) in

the passed in ap_expr_eval_ctx_t.

Constify pointers in ap_expr lookup tables, as well as the already

const pointed-to strings. ~1/2Kb moves to r/o text section, size(1)


text data bss dec hex filename

- 667519 18384 13952 699855 aadcf httpd

+ 668015 17864 13952 699831 aadb7 httpd

* server/util_expr_eval.c

[*_var_names, expr_provider_multi]: Mark pointers in name

lists as const.

(core_expr_lookup): Adjust accordingly.

Fix spelling errors found by codespell. [skip ci]

  1. … 100 more files in changeset.
Fix a typo reported by [stephane.blondon gmail.com]

PR 63092

Fix a potential un-intialized variable usage warning.

This can not be a runtime ixsue, because, in such a case, we would assert and abort before.

PR 59819.

* server/util_expr_eval.c (ap_expr_eval_re_backref): Fix gcc 7.x warning.

util_expr_eval.c: In function ‘ap_expr_eval_re_backref’:

util_expr_eval.c:265:63: error: comparison between pointer and zero character constant [-Werror=pointer-compare]

if (!ctx->re_pmatch || !ctx->re_source || *ctx->re_source == '\0' ||

ap_expr: follow up to r1810605.

The "split" and "join" operators are now a prefix, ala perl.

Add the "sub" operator for string substitutions, prefix still.

  1. … 3 more files in changeset.
apr_expr: follow up to r1810605.

Not necessarily ASCII here..

ap_expr: open string expressions to the <word>.

Introduces the syntax "%{:<word>:}", borrowed from the <var>'s one, and which

likewise can be embedded anywhere in a string expression (the same reserved

character ':' gets reused in an unambiguous manner).

This allows the two types of expressions (boolean and string) to now share

fully the same language set, namely: strings, lists, vars, regexes, backrefs,

functions with multiple or complex arguments, and especially combinations


Most of them were reserved to boolean expressions only, while complex string

constructions can also benefit to, well, strings. The <word> construct allows

that (say the syntax "%{:<word>:}" looks like a temporary variable constructed

in a string).

Since string expressions may now have to deal with lists (arrays), they also

need a way to produce/extract strings from list and vice versa. This can be

done with the new "join" and "split" operators, while the new substitution

regexes (like "s/<pattern>/<substitute>/<flags>") may be used to manipulate

strings in place. All this of course available for both string and boolean


Tests and doc updates upcoming..

  1. … 8 more files in changeset.
mod_rewrite,core: avoid Vary:Host (part 2)

This is a follow up of r1808746 after a chat

with Yann on dev@:

- the HTTP:Host variable suffers from the same problem

- the strcasecmp should be used to allow case-sensitive


- in mod_rewrite is less cumbersome and more clean to just

make the Host header check in lookup_header, so it will

be automatically picked up by every part of the code

that uses it. It shouldn't be a relevant overhead for


  1. … 2 more files in changeset.
mod_rewrite/core: avoid the 'Vary: Host' header

In PR 58231 is was brought up that httpd adds the

Vary: Host header whenever a condition is set to true

in mod_rewrite or in an <If> block.

The https://tools.ietf.org/html/rfc7231#section-7.1.4

section seems to disallow this use case:

"The "Vary" header field in a response describes "

"what parts of a request message, "

"aside from the method, Host header field, [...]"

I had a chat with the folks in #traffic-server and

they don't see much point in having a Vary: Host header,

plus it was reported that Varnish doesn't like it very

much (namely it does not cache the response when

it sees the header, links of the report in the PR).

I don't see much value in this behavior of httpd so

I am inclined to remove this response header value,

but I'd be glad to get a more experienced opinion.

  1. … 2 more files in changeset.
Fix %{DOCUMENT_URI} in SSI w/ default parser

*) core: %{DOCUMENT_URI} used in nested SSI expressions should point to the

URI originally requsted by the user, not the nested documents URI. This

restores the behavior of this variable to match the "legacy" SSI parser.


Submitted By [Hank Ibell <hwibell gmail.com>]

  1. … 1 more file in changeset.
PR59938: add %{REMOTE_PORT} to the expression parser

Submitted By: Hank Ibell <hwibell gmail.com>

  1. … 2 more files in changeset.
Rename ap_casecmpstr[n]() to ap_cstr_casecmp[n](), update with APR doxygen
  1. … 49 more files in changeset.
hostname: Test and log useragent_host per-request across various modules,

including the scoreboard, expression and rewrite engines, setenvif,

authz_host, access_compat, custom logging, ssl and REMOTE_HOST variables.

PR55348 [William Rowe]

This is the complete change set which applies cleanly to 2.4.x as well,

the server/scoreboard.c will follow, which does not apply due to drift.

  1. … 9 more files in changeset.
expr support for HTTP2 variable
  1. … 3 more files in changeset.

  1. … 2 more files in changeset.
expand and err-check...

Just in case...

ap_expr now allows kept_body() function to grab/use

response body if stored in r->kept_body

  1. … 2 more files in changeset.
Added some more log numbers to log statements that

had none.

Those were not detected by the coccinelle script.

Only a few hard cases are remaining now.

  1. … 12 more files in changeset.
Follow up to r1715880: revert more abusive ap_casecmpstr[n]() usages.
  1. … 7 more files in changeset.
Use 'ap_array_str_contains' to simplify code.
Use new ap_casecmpstr[n]() functions where appropriate (not exhaustive).

  1. … 32 more files in changeset.
Revert r1715789: will re-commit without spurious functional changes.

  1. … 32 more files in changeset.
Use new ap_casecmpstr[n]() functions where appropriate (not exhaustive).

[Reverted by r1715869]

  1. … 32 more files in changeset.
reverting unwanted loss of missing case
httpd compiles warning free on gcc and every new warning will be treated as an error, standard c-89 is enforced
  1. … 5 more files in changeset.
Expression parser: Optimize another concatenation

case by using iteration instead of recursion.

We have a relatively small recursion limit of

about 10 operations. This is a compilation

limit (a define). It can be hit if many expr

vars or function calls are concatenated.

The new optimization is very similar to the

existing one, which optimizes consecutive

concatenations in node2 of the tree. The new

one optimizes consecutive concatenations in

node 1.

looks like debug left in r1642154