Re: [exim] [exim-dev] Reworking the header handling

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: Magnus Holmgren
CC: exim-users
Subject: Re: [exim] [exim-dev] Reworking the header handling
On Thu, 28 Sep 2006, Magnus Holmgren wrote:

> Presently, the accumulated header additions and deletions by routers and
> transports are stored in the extra_headers and remove_headers fields of the
> address_item_propagated struct, instead of copying the full headers, which
> can be rather big, to each address_item. How about instead employing
> copy-on-write to save space and copying time? address_item_propagated could
> have a list of pointers to original and new header_line:s. The whole list of
> pointers would still have to be copied, unless we use a second level of CoW.


Knowing that sometimes Exim has to deal with a message with thousands of
recipients, I am generally very cautious about adding anything to the
per-address data structure these days. But I suppose if it's a pointer
that replaces the existing one, that is not an issue.

It has just occurred to me - thinking as I write - to wonder if there
might be any mileage in doing it the other way round, and writing an
internal "package" with its own API to manage header lines. Something
with functions like this:

add_original_header(text, where - e.g. at end, at start, etc)
add_new_header_from_acl(text, where)
add_new_header_for_one_address_only(text, pointer to address structure)
delete_header_for_all(name)
delete_header_for_one_address(name, pointer...)

start_header_scan()
get_next_header_for_this_address(pointer)
get_next_original_header()

same_headers(count, address pointer1, address pointer2, ...)

These are just ideas that would need working out. You'd need to be able
to do 2 scans at once when checking for identical headers - or maybe
that could be done without a scan if, for each header, a list of
"addresses that this header applies to" could be kept (with an "all"
feature). Hmm. I think a lot of work on designing an efficient data
structure might be needed here. Hmm (2) ... the more I think about this,
the more I'm not sure if I'm talking sense at all ... got to bed far too
late last night...

-- 
Philip Hazel            University of Cambridge Computing Service
Get the Exim 4 book:    http://www.uit.co.uk/exim-book