Skip to content
Browse files

fix header value parsing for article()

this is a continuation of 8e0e8e1
  • Loading branch information...
1 parent 1a3cb47 commit 4803a5a842057bec74db7cbda0a0743c9e69668d @mscdex committed Mar 10, 2013
Showing with 4 additions and 8 deletions.
  1. +4 −8 lib/nntp.js
View
12 lib/nntp.js
@@ -488,19 +488,15 @@ NNTP.prototype.article = function(what, cb) {
continue;
if (list[i][0] === '\t' || list[i][0] === ' ') {
// folded header content
- m = reHdrFold.exec(list[i]);
- if (Array.isArray(headers[h]))
- headers[h][headers[h].length - 1] += m[1];
- else
- headers[h] += 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] += list[i];
} else {
m = RE_HDR.exec(list[i]);
h = m[1].toLowerCase();
if (m[2]) {
if (headers[h] === undefined)
- headers[h] = m[2];
- else if (!Array.isArray(headers[h]))
- headers[h] = [headers[h], m[2]];
+ headers[h] = [m[2]];
else
headers[h].push(m[2]);
} else

0 comments on commit 4803a5a

Please sign in to comment.
Something went wrong with that request. Please try again.