You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ruediger Pluem <rp...@apache.org> on 2021/08/18 15:11:07 UTC

Re: svn commit: r1891990 - in /httpd/httpd/trunk: docs/manual/expr.xml include/ap_expr.h server/util_expr_eval.c


On 8/3/21 8:29 PM, covener@apache.org wrote:
> Author: covener
> Date: Tue Aug  3 18:29:35 2021
> New Revision: 1891990
> 
> URL: http://svn.apache.org/viewvc?rev=1891990&view=rev
> Log:
> clarification/fixes around the replace() function
> 
> 
> Modified:
>     httpd/httpd/trunk/docs/manual/expr.xml
>     httpd/httpd/trunk/include/ap_expr.h
>     httpd/httpd/trunk/server/util_expr_eval.c
> 
> Modified: httpd/httpd/trunk/docs/manual/expr.xml
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/expr.xml?rev=1891990&r1=1891989&r2=1891990&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/docs/manual/expr.xml (original)
> +++ httpd/httpd/trunk/docs/manual/expr.xml Tue Aug  3 18:29:35 2021
> @@ -602,7 +602,8 @@ DIGIT       ::= &lt;any US-ASCII digit "
>              (RFC4514) and LDAP filter escaping (RFC4515).</td><td></td></tr>
>      <tr><td><code>replace</code></td>
>          <td>replace(string, "from", "to") replaces all occurrences of "from"
> -            in the string with "to".</td><td></td></tr>
> +            in the string with "to". The first parameter must not be a literal string.

Why can't it be a literal string?

Regards

RĂ¼diger


Re: svn commit: r1891990 - in /httpd/httpd/trunk: docs/manual/expr.xml include/ap_expr.h server/util_expr_eval.c

Posted by Ruediger Pluem <rp...@apache.org>.

On 8/18/21 5:47 PM, Eric Covener wrote:
>> I think the first arg is passed to apr_strmatch_precompile() when the
>> expression is parsed and not at request time.  I wanted to change as
>> little as possible.
> 
> edit: first literal string among the arguments, since the pattern is
> not the first argument.
> 

Ahh, ok that makes some sense when looking at the code, but it does not seem to make sense from a users perspective.
This seems to be only in trunk which should give us a chance to fix it.

Regards

RĂ¼diger

Re: svn commit: r1891990 - in /httpd/httpd/trunk: docs/manual/expr.xml include/ap_expr.h server/util_expr_eval.c

Posted by Eric Covener <co...@gmail.com>.
> I think the first arg is passed to apr_strmatch_precompile() when the
> expression is parsed and not at request time.  I wanted to change as
> little as possible.

edit: first literal string among the arguments, since the pattern is
not the first argument.

Re: svn commit: r1891990 - in /httpd/httpd/trunk: docs/manual/expr.xml include/ap_expr.h server/util_expr_eval.c

Posted by Eric Covener <co...@gmail.com>.
On Wed, Aug 18, 2021 at 11:11 AM Ruediger Pluem <rp...@apache.org> wrote:
>
>
>
> On 8/3/21 8:29 PM, covener@apache.org wrote:
> > Author: covener
> > Date: Tue Aug  3 18:29:35 2021
> > New Revision: 1891990
> >
> > URL: http://svn.apache.org/viewvc?rev=1891990&view=rev
> > Log:
> > clarification/fixes around the replace() function
> >
> >
> > Modified:
> >     httpd/httpd/trunk/docs/manual/expr.xml
> >     httpd/httpd/trunk/include/ap_expr.h
> >     httpd/httpd/trunk/server/util_expr_eval.c
> >
> > Modified: httpd/httpd/trunk/docs/manual/expr.xml
> > URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/expr.xml?rev=1891990&r1=1891989&r2=1891990&view=diff
> > ==============================================================================
> > --- httpd/httpd/trunk/docs/manual/expr.xml (original)
> > +++ httpd/httpd/trunk/docs/manual/expr.xml Tue Aug  3 18:29:35 2021
> > @@ -602,7 +602,8 @@ DIGIT       ::= &lt;any US-ASCII digit "
> >              (RFC4514) and LDAP filter escaping (RFC4515).</td><td></td></tr>
> >      <tr><td><code>replace</code></td>
> >          <td>replace(string, "from", "to") replaces all occurrences of "from"
> > -            in the string with "to".</td><td></td></tr>
> > +            in the string with "to". The first parameter must not be a literal string.
>
> Why can't it be a literal string?

I don't totally recall, but the limitation was already present in
replace() not added here.
I think the first arg is passed to apr_strmatch_precompile() when the
expression is parsed and not at request time.  I wanted to change as
little as possible.
Further multi-string arg functions probably should not follow this
pattern added created w/ replace().