Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix scope issue when re-using mime parser instance

  • Loading branch information...
commit 61fdef282d680158329528892cde899d86baacc0 1 parent b5b0c2b
@mscdex authored
Showing with 5 additions and 10 deletions.
  1. +4 −4 lib/imap.js
  2. +1 −6 lib/mimeparser.js
View
8 lib/imap.js
@@ -255,13 +255,13 @@ ImapConnection.prototype.connect = function(loginCb) {
self._state.parser = new MIMEParser();
self._state.parser.on('header', function(name, val) {
name = name.toLowerCase();
- if (curReq._msg.headers[name] !== undefined)
- curReq._msg.headers[name].push(val);
+ if (self._state.requests[0]._msg.headers[name] !== undefined)
+ self._state.requests[0]._msg.headers[name].push(val);
else
- curReq._msg.headers[name] = [val];
+ self._state.requests[0]._msg.headers[name] = [val];
});
self._state.parser.on('data', function(str) {
- curReq._msg.emit('data', str);
+ self._state.requests[0]._msg.emit('data', str);
});
}
}
View
7 lib/mimeparser.js
@@ -13,12 +13,7 @@ var CR = 13,
REGEXP_FOLD = /\r\n\s+/g;
var MIMEParser = module.exports = function() {
- this._state = PARSE_HEADER_NAME;
- this._hdrname = '';
- this._hdrval = '';
- this._sawCR = false;
- this._sawLF = false;
- this._needUnfold = false;
+ this.finish();
};
inherits(MIMEParser, EventEmitter);
Please sign in to comment.
Something went wrong with that request. Please try again.