[Email-SIG] blog post about the headef folding algorithm rewrite

R. David Murray rdmurray at bitdance.com
Tue Apr 12 03:09:20 CEST 2011


On Mon, 11 Apr 2011 15:26:27 -0700, Glenn Linderman <v+python at g.nevcal.com> wrote:
> On 4/11/2011 2:48 PM, R. David Murray wrote:
> > [2] 
> > <http://www.bitdance.com/blog/2011/04/11_01_Email6_Rewriting_Header_Folding/#id2>There 
> > may also be cases where whitespace does /not/ mark a valid folding 
> > point. So for email6 the folding API will further need to provide a 
> > way for the specific header to indicate these points before folding. 
> > The simplest scheme is probably to replace the non-folding whitespace 
> > with marker characters, fold the header, and then re-convert the 
> > marker characters to the original whitespace.
> 
> Another alternative may be to allow the header access to the 
> Accumulator, and let it emit chunks directly into the accumulator.  This 
> would save reparsing.

Well, the algorithm doesn't work that way, since the smarts for managing
the accumulator is all in the class that is building the output lines,
not in the accumulator itself.  Right now what gets fed into that class
is strings that are pieces of the header (actually it's (string, charset)
pairs), which the feed method then splits up into potential split points
and uses the accumulator to manage.

What would work would be to provide an alternate API where the Header
class feeds in an already-split list instead of a string.  That makes
sense from several perspectives.

Or, despite what I said in the blog post, I may end up rewriting the
algorithm again at some point ;)

--David


More information about the Email-SIG mailing list