Re: [exim] Counting the number of headers in an incoming ema…

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Chris Siebenmann
Ημερομηνία:  
Προς: Jeremy Harris
Υ/ο: exim-users, cks
Αντικείμενο: Re: [exim] Counting the number of headers in an incoming email (was Re: Limit the total number of headers in incoming SMTP messages?)
> On 05/01/16 20:37, Chris Siebenmann wrote:
> > could be doing this in a more clever way.
>
> Clever is in the eye of the beholder, but...
>
> message_headers
> sg to convert newline-whitespace to space
> sg to discard non-newline
> strlen


 I'd imagine that's going to be more efficient than my version.
Is the 'sg to discard non-newline' sg something like:
    ${sg{...} {\N[^\n]+\N} {}}


It wasn't obvious to me how best to use sg to actually delete things
without deleting too much, but that seems about right. (And it works
in testing, which is always a good sign.)

Technically one wants strlen+1 here, as the final header does not seem
to have a trailing newline in $message_headers. (My original version
works right because of the semantics of list splitting and ${reduce}.)

    - cks