Parser: ignore invalid first line that starts with a whitespace

fork
Chotiwat Chawannakul 10 years ago
parent c35e79803d
commit 36f2290a0c

@ -978,6 +978,8 @@ function parseHeader(str, noDecode) {
if (lines[i].length === 0)
break; // empty line separates message's header and body
if (lines[i][0] === '\t' || lines[i][0] === ' ') {
if (!Array.isArray(header[h]))
continue; // ignore invalid first line
// folded header content
val = lines[i];
if (!noDecode) {

@ -70,6 +70,11 @@ var CRLF = '\r\n';
expected: { subject: [ 'รูปภาพที่ embed ในเนื้อเมลล์ไม่แสดง' ] },
what: 'Folded header value (consecutive partial base64-encoded words)'
},
{ source: [' ', CRLF,
'To: Foo', CRLF],
expected: { to: [ 'Foo' ] },
what: 'Invalid first line'
},
// header with body
{ source: ['Subject: test subject', CRLF,
'X-Another-Header: test', CRLF,

Loading…
Cancel
Save