[Rspamd-Users] Not working: task:modify_header(name, mods)

lutz.niederer at gmx.net lutz.niederer at gmx.net
Wed Aug 24 16:21:26 UTC 2022


> Gesendet: Mittwoch, 24. August 2022 um 17:53 Uhr
> Von: "G.W. Haywood via Users" <users at lists.rspamd.com>
>
> On Wed, 24 Aug 2022, lutz.niederer at gmx.net wrote:
>
> > I have tried everything with task:modify_header(name, mods).  Nothing works.
> > task:modify_header( 'X-ENTRY', { add = {0, "VALUE"}, remove = {0} } )
> > This seems to me the closest thing that should work...
>
> I haven't used any of this personally, but that doesn't match my
> reading of the documentation:
>
> https://rspamd.com/doc/lua/rspamd_task.html#m3b1f8
>
> > Could someone please show me how this would be called correctly?
>
> Based on my reading of the documentation linked above, try putting
> quotes around "add" and "remove" ?

If you place quotes around add & remove you get an error from rspamadm configtest.
From the documentation add is { { order, value }, { order, value } } and remove is { order, order, order } which does not make sense to me if we are talking about one header.

>
> > Otherwise I believe that there may be a bug.
>
> With something like this it's much more likely to be the user's
> misunderstanding than to be a fault in the software.  It is however a
> little unfortunate that the rendering of the documentation on the
> rspamd Website leaves much to be desired from the formatting POV.

I believe that, too.  But I am not sure.  I don't know how many people use LUA inline code in config files.  From the search with google I found that there are nearly no references to that function.  ...  and not only from the formatting POV.  I am missing much of the glue and a "big picture" of symbols etc, who sets what when and who does what with them when.  I ended up with trial and error learning in an amount that I normally don't want with mail filtering.

>
> Incidentally you should _append_ any header like X-ENTRY so I think you
> would want {-1, "VALUE"} instead of {0, "VALUE"} in the 'mods' table.
> In general I'd be cautious about removing headers.

Maybe, but currently the function doesn't do anything.  With debug mode you don't see any errors or hints that the function is ever executed.

Cheers!
-lutzn



More information about the Users mailing list