Merge pull request #277 from alexindigo/master

Parser: relax parseHeader() implementation to allow parsing the header from a full message (header + body)
fork
Brian White 11 years ago
commit 8f0587083e

@ -719,7 +719,7 @@ function parseHeader(str, noDecode) {
for (var i = 0; i < len; ++i) {
if (lines[i].length === 0)
continue;
break; // empty line separates message's header and body
if (lines[i][0] === '\t' || lines[i][0] === ' ') {
// folded header content
val = lines[i];

@ -38,6 +38,15 @@ var CRLF = '\r\n';
expected: { subject: [ '测试题目与中国信 long subjects are not OK 12 345678901234567890123456789012345678901234567890123456789012345678901234567890' ] },
what: 'Folded header value (one adjacent, one non-adjacent MIME encoded-words)'
},
// header with body
{ source: ['Subject: test subject', CRLF,
'X-Another-Header: test', CRLF,
CRLF,
'This is body: Not a header', CRLF],
expected: { subject: [ 'test subject' ], 'x-another-header': [ 'test' ] },
what: 'Header with the body'
},
].forEach(function(v) {
var result;

Loading…
Cancel
Save