Parser: handle tagged responses without response code and/or other text

fork
Suraj Sharma 9 years ago committed by Brian White
parent 3051724f85
commit c2a859727d

@ -18,7 +18,7 @@ var CH_LF = 10,
RE_LISTCONTENT = /^\((.*)\)$/,
RE_LITERAL = /\{(\d+)\}$/,
RE_UNTAGGED = /^\* (?:(OK|NO|BAD|BYE|FLAGS|ID|LIST|XLIST|LSUB|SEARCH|STATUS|CAPABILITY|NAMESPACE|PREAUTH|SORT|THREAD|ESEARCH|QUOTA|QUOTAROOT)|(\d+) (EXPUNGE|FETCH|RECENT|EXISTS))(?:(?: \[([^\]]+)\])?(?: (.+))?)?$/i,
RE_TAGGED = /^A(\d+) (OK|NO|BAD) (?:\[([^\]]+)\] )?(.+)$/i,
RE_TAGGED = /^A(\d+) (OK|NO|BAD) ?(?:\[([^\]]+)\] )?(.*)$/i,
RE_CONTINUE = /^\+(?: (?:\[([^\]]+)\] )?(.+))?$/i,
RE_CRLF = /\r\n/g,
RE_HDR = /^([^:]+):[ \t]?(.+)?$/,

@ -465,6 +465,15 @@ var CR = '\r', LF = '\n', CRLF = CR + LF;
],
what: 'QuotaRoot'
},
{ source: ['A1 OK', CRLF], // some servers like ppops.net sends such response
expected: [ { type: 'ok',
tagnum: 1,
textCode: undefined,
text: ''
}
],
what: 'Tagged OK (no text code, no text)'
},
].forEach(function(v) {
var ss = new require('stream').Readable(), p, result = [];
ss._read = function(){};

Loading…
Cancel
Save