httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yann Ylavic <>
Subject Expressions improvements
Date Fri, 14 Jul 2017 21:57:37 GMT
Starting from a feature request on users@ some time ago (see [1] if
you are interested by long threads...), I made changes in the
expressions parser.

Currently there are two types of expressions handled by httpd, string
and conditional expressions, usable in different contexts, with
different syntaxes.

While conditional expressions are quite powerful with the definition
of "word", regexps and even string expressions (what's between the
quotes), the string expressions are more limited (no "word" nor
So the idea is to open string expressions to the "word" :)

String expressions can reference a variable with %{var}, a function
call with %{func:arg}, or a regexp back-reference with $n, but that
almost all.
I propose that they now can reference almost anything with the
%{:word:} syntax, including conditions which become "true" or "false"
in a string context.
But this is not only about evaluating conditions in strings, the
"word" also gives access to list functions and regexps that can work
on list and return a string (or a sub-list...), like split// or

For the initial users@ case, it allows things like:
  Header always set "X-SubjectAltName" \
   "expr=%{: join/PeerExtList('subjectAltName')/', '/ :}"
  Header always set "X-Client-in-SubjectAltName" \
   "expr=%{: %{REMOTE_ADDR} -in \
             ( PeerExtList('subjectAltName') =~ \
               split/.*?IPAddress:([^,]+)/$1/ ) :}"

Patch attached, comments welcome...


View raw message