Wietse, On 04/03/2019 15:34, Wietse Venema wrote: > Vsevolod Stakhov: >> I don't call any library, I have my own implementation of the milter >> protocol. It checks for any errors that could arise but there are no >> errors of course, or I would have not asked this question. > > Could that be a problem? Before I sink any time into this, does the > problem also exist with implementations based on libmilter (which > I suppose is what almist everything else is using)? > > Wietse >
I don't really see that libmilter does anything in a different way when calling `smfi_chgheader`. The protocol does not expect any errors in reply to this command and there are lots of undefined pieces indeed. The only thing it states is 'If hdridx is greater than the number of times headerf appears, a new copy of headerf is added.' Of course, it leads to ambiguity when it comes to headers deletion. In my case, I have found that removing headers in reversed order will work with whatever milter implementation. I'm not quite sure about the performance of these approaches: from reading the code, it seems that all headers modifications are quite expensive operations whatever order is selected. But I've not dig too deeply into it I'm afraid.