From 948e1e5f354e436d9216b66700ea8b3c45fd14d1 Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Thu, 28 May 2020 09:46:09 +0200 Subject: [PATCH] textops: docs for functions to remove or test headers with variables --- src/modules/textops/doc/textops_admin.xml | 113 ++++++++++++++++++++-- 1 file changed, 105 insertions(+), 8 deletions(-) diff --git a/src/modules/textops/doc/textops_admin.xml b/src/modules/textops/doc/textops_admin.xml index fecaa059f28..a8685510a09 100644 --- a/src/modules/textops/doc/textops_admin.xml +++ b/src/modules/textops/doc/textops_admin.xml @@ -1024,8 +1024,8 @@ append_urihf("CC-Diversion: ", "\r\n"); Meaning of the parameters is as follows: - hf_name - Header field name.(long or - compact form) + hf_name - Header field name (long or + compact form). It can be only a static string value. @@ -1037,7 +1037,25 @@ append_urihf("CC-Diversion: ", "\r\n"); <function>is_present_hf</function> usage ... -if (is_present_hf("From")) log(1, "From HF Present"); +if (is_present_hf("From")) xlog("From HF Present"); +... + + + + +
+ + <function moreinfo="none">is_present_hf_pv(hf_name)</function> + + + Same as is_present_hf() function, but the parameter can contain + variables. + + + <function>is_present_hf_pv</function> usage + +... +if (is_present_hf_pv("$var(hname)")) xinfo("Header $var(hname) is present\n"); ... @@ -1055,7 +1073,7 @@ if (is_present_hf("From")) log(1, "From HF Present"); hf_name_re - Regular expression to - match header field name. + match header field name. It can be only a static string value. @@ -1067,7 +1085,27 @@ if (is_present_hf("From")) log(1, "From HF Present"); <function>is_present_hf_re</function> usage ... -if (is_present_hf_re("^P-")) log(1, "There are headers starting with P-\n"); +if (is_present_hf_re("^P-")) + xlog("There are headers starting with P-\n"); +... + + +
+ +
+ + <function moreinfo="none">is_present_hf_re_pv(hf_name_re)</function> + + + Same as is_present_hf_re() function, but the parameter can contain + variables. + + + <function>is_present_hf_re_pv</function> usage + +... +if (is_present_hf_re_pv_("^$var(prefix)")) + xlog("There are headers starting with $var(prefix)\n"); ... @@ -1255,7 +1293,8 @@ if(is_method("OPTION|UPDATE")) hname - header name to be removed. - + It can be only a static string (because of the optimizations + done at startup to speed up execution at runtime). @@ -1271,9 +1310,26 @@ if(remove_hf("User-Agent")) # User Agent header removed } # compact form: remove "Contact" or "m" header -remove_hf("Contact") +remove_hf("Contact"); # compact form: remove "Contact" or "m" header -remove_hf("m") +remove_hf("m"); +... + + +
+ +
+ + <function moreinfo="none">remove_hf_pv(hname)</function> + + + Same as remove_hf() function, but the parameter can contain variables. + + + <function>remove_hf_pv</function> usage + +... +remove_hf_pv("$var(hname)"); ... @@ -1314,6 +1370,26 @@ if(remove_hf_re("^P-"))
+
+ + <function moreinfo="none">remove_hf_re_pv(re)</function> + + + Same as remove_hf_re() function, but the parameter can contain variables. + + + <function>remove_hf_re_pv</function> usage + +... +if(remove_hf_re_pv("^$var(prefix)")) +{ + # All headers starting with $var(prefix) value removed +} +... + + +
+
<function moreinfo="none">remove_hf_exp(expmatch, expskip)</function> @@ -1356,6 +1432,27 @@ if(remove_hf_exp("^P-", "^P-Keep-")) </example> </section> + <section id="textops.f.remove_hf_exp_pv"> + <title> + <function moreinfo="none">remove_hf_exp_pv(expmatch, expskip)</function> + + + Same as remove_hf_exp() function, but the parameters can contain variabes. + + + <function>remove_hf_exp_pv</function> usage + +... +if(remove_hf_exp_pv("^$var(match)", "^$var(keep)")) +{ + # All headers starting with $var(match) value removed, + # except the ones starting with $var(keep) value +} +... + + +
+
<function moreinfo="none">has_body()</function>,