Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH 8/8] wrap_in_html(): process message in bulk rather than line-by-line

From: Michael Haggerty <hidden>
Date: 2016-06-15 22:55:28

On 11/29/2012 10:33 PM, Junio C Hamano wrote:
Michael Haggerty [off-list ref] writes:
quoted
Now that we can xml-quote an arbitrary string in O(N), there is no
reason to process the message line by line.  This change saves lots of
memory allocations and copying.

The old code would have created invalid output for a malformed input
message (one that does not contain a blank line separating the header
from the body).  The new code die()s in this situation.
Given that imap-send is about sending a patch the distinction would
not matter in practice, but isn't the difference between the two
that the new version would not allow sending a header-only message
without a body, while the old one allowed it?
I was thinking that the end-of-header line is a required part of an
RFC2282 email message, but I was wrong.  If you squash the attached
patch onto this commit, it will handle emails without bodies correctly.

Nevertheless, the old code was even *more* broken because it added a
"</pre>" regardless of whether the separator line had been seen, and
therefore a message without an end-of-header line would come out like

    Header1: foo
    Header2: bar
    </pre>

with no content_type line, no pre_open, and </pre> appended to the
header without a blank line in between.  This is the "invalid output"
that I was referring to.

Michael

-- 
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help