Skip Menu |

This queue is for tickets about the MIME-Lite CPAN distribution.

Report information
The Basics
Id: 17188
Status: open
Priority: 0/
Queue: MIME-Lite

People
Owner: Nobody in particular
Requestors: fbriere [...] fbriere.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 3.01
Fixed in: (no value)



Subject: Headers with \n wreak havoc
The following snippet: use MIME::Lite; print MIME::Lite->new(Subject => "This is a bad header\n", To => "me\@here")->header_as_string; Produces this: Content-Disposition: inline Content-Transfer-Encoding: binary Content-Type: text/plain MIME-Version: 1.0 X-Mailer: MIME::Lite 3.01 (F2.73; B3.05; Q3.03) Date: Fri, 20 Jan 2006 15:25:35 -0500 Subject: This is a bad header To: me@here Looks like each header value should be chomped to prevent this.
It's technically valid for a header to span multiple lines (subsequent lines must start with whitespace). This happens a lot for messages with many recipients or long subject lines. A quick test with MIME::Lite 3.027 shows that it handles this correctly (leading whitespace is inserted if there's a newline in Subject). However, RFC2822 and RFC5822 forbid continuation lines consisting *only* of whitespace (sections 3.2.3 and 4.2 resp.), and MIME::Lite doesn't prevent that. IMHO It would be reasonable for MIME::Lite to trim trailing newlines or any inner sequences of newlines separated only by whitespace.
Funny, I just encountered this bug in a *different* email library this week. The values given to the constructor should, imho, be free of newline. Folding of long lines should happen later. -- rjbs