fix header value parsing behavior for folded lines

fork
mscdex 11 years ago
parent 4e0e7436e3
commit baf18ad2b8

@ -1,8 +1,7 @@
var utils = require('./imap.utilities');
var reCRLF = /\r\n/g,
reHdr = /^([^:]+):\s?(.+)?$/,
reHdrFold = /^\s+(.+)$/;
reHdr = /^([^:]+):[ \t]?(.+)?$/;
exports.convStr = function(str, literals) {
if (str[0] === '"')
@ -29,8 +28,9 @@ exports.parseHeaders = function(str) {
continue;
if (lines[i][0] === '\t' || lines[i][0] === ' ') {
// folded header content
m = reHdrFold.exec(lines[i]);
headers[h][headers[h].length - 1] += m[1];
// RFC2822 says to just remove the CRLF and not the whitespace following
// it, so we follow the RFC and include the leading whitespace ...
headers[h][headers[h].length - 1] += lines[i];
} else {
m = reHdr.exec(lines[i]);
h = m[1].toLowerCase();

Loading…
Cancel
Save