You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Yann Ylavic <yl...@gmail.com> on 2017/02/22 15:51:39 UTC
Expr's lists evaluated in a string context (was: [users@httpd]
mod_lua and subprocess_env)
> On Tue, Feb 21, 2017 at 6:32 PM, Yann Ylavic <yl...@gmail.com> wrote:
>>
>> Header set Client-SAN "expr=%{PeerExtList:2.5.29.17}"
This currently fails because list functions are not recognized in a
string context.
For now, lists can be either expressed with the syntax "{ <word>,
<word>, ... }", with <word> being itself something powerful, or
obtained from the mod_ssl's PeerExtList() function (grab anything from
a peer certificate).
For the latter case (or for future functions), it could be useful to
be able to work on such strings (e.g. with extracting regexes).
So I wonder if we could return the string elements separated by
something in the case of lists evaluated in a string context.
For example, the attached patch uses the seprator ", " (quite HTTP
field inspired), but it could be a json string or whatever...
We could also have an explicit tostring/tojson() function which would
stringify anything as argument.
Or yet more operators on lists, like list_empty(), list_first(),
list_last(), list_nth(), list_match(<list>, <regex>) (returning
another list of matching entries), ... you name it.
Working on anything from a certificates looks very useful at least.
WDYT?
Re: Expr's lists evaluated in a string context (was: [users@httpd]
mod_lua and subprocess_env)
Posted by Eric Covener <co...@gmail.com>.
On Wed, Feb 22, 2017 at 10:51 AM, Yann Ylavic <yl...@gmail.com> wrote:
>
> For example, the attached patch uses the seprator ", " (quite HTTP
> field inspired), but it could be a json string or whatever...
> We could also have an explicit tostring/tojson() function which would
> stringify anything as argument.
>
> Or yet more operators on lists, like list_empty(), list_first(),
> list_last(), list_nth(), list_match(<list>, <regex>) (returning
> another list of matching entries), ... you name it.
>
> Working on anything from a certificates looks very useful at least.
>
> WDYT?
+1.
What does the list evaluate to prior to the fix? Seems like regression
risk is low (sophisticated expression with lists that don't ever
return what you'd expect). Otherwise I'd suggest we give users e.g.
list_join() and just add a few examples.
--
Eric Covener
covener@gmail.com
Re: Expr's lists evaluated in a string context (was: [users@httpd]
mod_lua and subprocess_env)
Posted by Jim Jagielski <ji...@jaguNET.com>.
Would it be possible that people are using it that way
for exactly that purpose? I am wondering about this
causing some regression for external users.
> On Feb 22, 2017, at 10:51 AM, Yann Ylavic <yl...@gmail.com> wrote:
>
>> On Tue, Feb 21, 2017 at 6:32 PM, Yann Ylavic <yl...@gmail.com> wrote:
>>>
>>> Header set Client-SAN "expr=%{PeerExtList:2.5.29.17}"
>
> This currently fails because list functions are not recognized in a
> string context.
>
> For now, lists can be either expressed with the syntax "{ <word>,
> <word>, ... }", with <word> being itself something powerful, or
> obtained from the mod_ssl's PeerExtList() function (grab anything from
> a peer certificate).
>
> For the latter case (or for future functions), it could be useful to
> be able to work on such strings (e.g. with extracting regexes).
> So I wonder if we could return the string elements separated by
> something in the case of lists evaluated in a string context.
>
> For example, the attached patch uses the seprator ", " (quite HTTP
> field inspired), but it could be a json string or whatever...
> We could also have an explicit tostring/tojson() function which would
> stringify anything as argument.
>
> Or yet more operators on lists, like list_empty(), list_first(),
> list_last(), list_nth(), list_match(<list>, <regex>) (returning
> another list of matching entries), ... you name it.
>
> Working on anything from a certificates looks very useful at least.
>
> WDYT?
> <ap_expr_eval_list-string.patch>