Socket
Socket
Sign inDemoInstall

emailjs-imap-handler

Package Overview
Dependencies
0
Maintainers
3
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.2 to 2.0.0

12

Gruntfile.js

@@ -30,11 +30,2 @@ module.exports = function(grunt) {

}
},
mocha_phantomjs: {
all: {
options: {
reporter: 'spec'
},
src: ['test/index.html']
}
}

@@ -45,3 +36,2 @@ });

grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-mocha-phantomjs');
grunt.loadNpmTasks('grunt-contrib-connect');

@@ -52,3 +42,3 @@ grunt.loadNpmTasks('grunt-mocha-test');

grunt.registerTask('dev', ['connect:dev']);
grunt.registerTask('default', ['jshint', 'mochaTest', 'mocha_phantomjs']);
grunt.registerTask('default', ['jshint', 'mochaTest']);
};

4

package.json
{
"name": "emailjs-imap-handler",
"main": "src/emailjs-imap-handler.js",
"version": "1.0.2",
"version": "2.0.0",
"homepage": "https://github.com/emailjs/emailjs-imap-handler",

@@ -26,8 +26,6 @@ "author": "Andris Reinman <andris@kreata.ee>",

"grunt-contrib-jshint": "^0.11.3",
"grunt-mocha-phantomjs": "^2.0.1",
"grunt-mocha-test": "^0.12.7",
"mocha": "^2.3.4",
"phantomjs": "^1.9.19",
"requirejs": "^2.1.22"
}
}

@@ -13,3 +13,3 @@ # IMAP Handler

To parse a command you need to have the command as one complete string (including all literals) without the ending &lt;CR&gt;&lt;LF&gt;
To parse a command you need to have the command as one complete Uint8Array (including all literals) without the ending &lt;CR&gt;&lt;LF&gt;

@@ -20,3 +20,3 @@ imapHandler.parser(imapCommand);

* **imapCommand** is an IMAP string without the final line break
* **imapCommand** is an Uint8Array without the final line break

@@ -53,5 +53,6 @@ The function returns an object in the following form:

```javascript
var imapHandler = require("imap-handler");
var mimecodec = require("emailjs-mime-codec");
var imapHandler = require("emailjs-imap-handler");
imapHandler.parser("A1 FETCH *:4 (BODY[HEADER.FIELDS ({4}\r\nDate Subject)]<12.45> UID)");
imapHandler.parser(mimecodec.toTypedArray("A1 FETCH *:4 (BODY[HEADER.FIELDS ({4}\r\nDate Subject)]<12.45> UID)"));
```

@@ -106,3 +107,3 @@

You can "compile" parsed or self generated IMAP command obejcts to IMAP command strings with
You can "compile" parsed or self generated IMAP command objects to IMAP command strings with

@@ -109,0 +110,0 @@ imapHandler.compiler(commandObject, asArray);

@@ -35,6 +35,60 @@ // Copyright (c) 2013 Andris Reinman

var ASCII_NL = 10;
var ASCII_CR = 13;
var ASCII_SPACE = 32;
var ASCII_LEFT_BRACKET = 91;
var ASCII_RIGHT_BRACKET = 93;
function fromCharCode(uint8Array, skip) {
skip = skip || [];
var max = 10240;
var begin = 0;
var strings = [];
for (var i = 0; i < uint8Array.length; i++) {
if (skip.indexOf(i) >= 0) {
strings.push(String.fromCharCode.apply(null, uint8Array.subarray(begin, i)));
begin = i + 1;
} else if (i - begin >= max) {
strings.push(String.fromCharCode.apply(null, uint8Array.subarray(begin, i)));
begin = i;
}
}
strings.push(String.fromCharCode.apply(null, uint8Array.subarray(begin, i)));
return strings.join('');
}
function fromCharCodeTrimmed(uint8Array, skip) {
var begin = 0;
var end = uint8Array.length;
while (uint8Array[begin] === ASCII_SPACE) {
begin++;
}
while (uint8Array[end - 1] === ASCII_SPACE) {
end--;
}
if (begin !== 0 || end !== uint8Array.length) {
uint8Array = uint8Array.subarray(begin, end);
}
return fromCharCode(uint8Array, skip);
}
function isEmpty(uint8Array) {
for (var i = 0; i < uint8Array.length; i++) {
if (uint8Array[i] !== ASCII_SPACE) {
return false;
}
}
return true;
}
function ParserInstance(input, options) {
this.input = (input || '').toString();
this.remainder = new Uint8Array(input || 0);
this.options = options || {};
this.remainder = this.input;
this.pos = 0;

@@ -51,4 +105,2 @@ }

ParserInstance.prototype.getCommand = function() {
var responseCode;
if (!this.command) {

@@ -64,9 +116,10 @@ this.command = this.getElement(imapFormalSyntax.command());

case 'BYE':
responseCode = this.remainder.match(/^ \[(?:[^\]]*\])+/);
if (responseCode) {
this.humanReadable = this.remainder.substr(responseCode[0].length).trim();
this.remainder = responseCode[0];
var lastRightBracket = this.remainder.lastIndexOf(ASCII_RIGHT_BRACKET);
if (this.remainder[1] === ASCII_LEFT_BRACKET && lastRightBracket > 1) {
this.humanReadable = fromCharCodeTrimmed(this.remainder.subarray(lastRightBracket + 1));
this.remainder = this.remainder.subarray(0, lastRightBracket + 1);
} else {
this.humanReadable = this.remainder.trim();
this.remainder = '';
this.humanReadable = fromCharCodeTrimmed(this.remainder);
this.remainder = new Uint8Array(0);
}

@@ -80,9 +133,14 @@ break;

ParserInstance.prototype.getElement = function(syntax) {
var match, element, errPos;
if (this.remainder.match(/^\s/)) {
var element, errPos;
if (this.remainder[0] === ASCII_SPACE) {
throw new Error('Unexpected whitespace at position ' + this.pos);
}
if ((match = this.remainder.match(/^[^\s]+(?=\s|$)/))) {
element = match[0];
var firstSpace = this.remainder.indexOf(ASCII_SPACE);
if (this.remainder.length > 0 && firstSpace !== 0) {
if (firstSpace === -1) {
element = fromCharCode(this.remainder);
} else {
element = fromCharCode(this.remainder.subarray(0, firstSpace));
}

@@ -96,4 +154,4 @@ if ((errPos = imapFormalSyntax.verify(element, syntax)) >= 0) {

this.pos += match[0].length;
this.remainder = this.remainder.substr(match[0].length);
this.pos += element.length;
this.remainder = this.remainder.subarray(element.length);

@@ -108,3 +166,3 @@ return element;

if (imapFormalSyntax.verify(this.remainder.charAt(0), imapFormalSyntax.SP()) >= 0) {
if (imapFormalSyntax.verify(String.fromCharCode(this.remainder[0]), imapFormalSyntax.SP()) >= 0) {
throw new Error('Unexpected char at position ' + this.pos);

@@ -114,3 +172,3 @@ }

this.pos++;
this.remainder = this.remainder.substr(1);
this.remainder = this.remainder.subarray(1);
};

@@ -123,11 +181,133 @@

if (this.remainder.match(/^\s/)) {
if (this.remainder[0] === ASCII_SPACE) {
throw new Error('Unexpected whitespace at position ' + this.pos);
}
return new TokenParser(this, this.pos, this.remainder, this.options).getAttributes();
return new TokenParser(this, this.pos, this.remainder.subarray(), this.options).getAttributes();
};
function TokenParser(parent, startPos, str, options) {
this.str = (str || '').toString();
function Node(uint8Array, parentNode, startPos) {
this.uint8Array = uint8Array;
this.childNodes = [];
this.type = false;
this.closed = true;
this.valueSkip = [];
this.startPos = startPos;
this.valueStart = this.valueEnd = typeof startPos === 'number' ? startPos + 1 : 0;
if (parentNode) {
this.parentNode = parentNode;
parentNode.childNodes.push(this);
}
}
Node.prototype.getValue = function() {
var value = fromCharCode(this.uint8Array.subarray(this.valueStart, this.valueEnd), this.valueSkip);
return this.valueToUpperCase ? value.toUpperCase() : value;
};
Node.prototype.getValueLength = function() {
return this.valueEnd - this.valueStart - this.valueSkip.length;
};
Node.prototype.equals = function(value, caseSensitive) {
if (this.getValueLength() !== value.length) {
return false;
}
return this.equalsAt(value, 0, caseSensitive);
};
Node.prototype.equalsAt = function(value, index, caseSensitive) {
caseSensitive = typeof caseSensitive === 'boolean' ? caseSensitive : true;
if (index < 0) {
index = this.valueEnd + index;
while (this.valueSkip.indexOf(this.valueStart + index) >= 0) {
index--;
}
} else {
index = this.valueStart + index;
}
for (var i = 0; i < value.length; i++) {
while (this.valueSkip.indexOf(index - this.valueStart) >= 0) {
index++;
}
if (index >= this.valueEnd) {
return false;
}
var uint8Char = String.fromCharCode(this.uint8Array[index]);
var char = value[i];
if (!caseSensitive) {
uint8Char = uint8Char.toUpperCase();
char = char.toUpperCase();
}
if (uint8Char !== char) {
return false;
}
index++;
}
return true;
};
Node.prototype.isNumber = function() {
for (var i = 0; i < this.valueEnd - this.valueStart; i++) {
if (this.valueSkip.indexOf(i) >= 0) {
continue;
}
if (!this.isDigit(i)) {
return false;
}
}
return true;
};
Node.prototype.isDigit = function(index) {
if (index < 0) {
index = this.valueEnd + index;
while (this.valueSkip.indexOf(this.valueStart + index) >= 0) {
index--;
}
} else {
index = this.valueStart + index;
while (this.valueSkip.indexOf(this.valueStart + index) >= 0) {
index++;
}
}
var ascii = this.uint8Array[index];
return ascii >= 48 && ascii <= 57;
};
Node.prototype.containsChar = function(char) {
var ascii = char.charCodeAt(0);
for (var i = this.valueStart; i < this.valueEnd; i++) {
if (this.valueSkip.indexOf(i - this.valueStart) >= 0) {
continue;
}
if (this.uint8Array[i] === ascii) {
return true;
}
}
return false;
};
function TokenParser(parent, startPos, uint8Array, options) {
this.uint8Array = uint8Array;
this.options = options || {};

@@ -154,3 +334,3 @@ this.parent = parent;

if (!node.closed && node.type === 'SEQUENCE' && node.value === '*') {
if (!node.closed && node.type === 'SEQUENCE' && node.equals('*')) {
node.closed = true;

@@ -162,3 +342,3 @@ node.type = 'ATOM';

if (!node.closed) {
throw new Error('Unexpected end of input at position ' + (this.pos + this.str.length - 1));
throw new Error('Unexpected end of input at position ' + (this.pos + this.uint8Array.length - 1));
}

@@ -172,3 +352,3 @@

type: node.type.toUpperCase(),
value: node.value
value: node.getValue()
};

@@ -178,3 +358,3 @@ branch.push(elm);

case 'ATOM':
if (node.value.toUpperCase() === 'NIL') {
if (node.equals('NIL', true)) {
branch.push(null);

@@ -185,3 +365,3 @@ break;

type: node.type.toUpperCase(),
value: node.value
value: node.getValue()
};

@@ -199,3 +379,3 @@ branch.push(elm);

case 'PARTIAL':
partial = node.value.split('.').map(Number);
partial = node.getValue().split('.').map(Number);
branch[branch.length - 1].partial = partial;

@@ -217,29 +397,10 @@ break;

TokenParser.prototype.createNode = function(parentNode, startPos) {
var node = {
childNodes: [],
type: false,
value: '',
closed: true
};
if (parentNode) {
node.parentNode = parentNode;
}
if (typeof startPos === 'number') {
node.startPos = startPos;
}
if (parentNode) {
parentNode.childNodes.push(node);
}
return node;
return new Node(this.uint8Array, parentNode, startPos);
};
TokenParser.prototype.processString = function() {
var chr, i, len,
var i, len,
checkSP = function() {
// jump to the next non whitespace pos
while (this.str.charAt(i + 1) === ' ') {
while (this.uint8Array[i + 1] === ' ') {
i++;

@@ -249,5 +410,5 @@ }

for (i = 0, len = this.str.length; i < len; i++) {
for (i = 0, len = this.uint8Array.length; i < len; i++) {
chr = this.str.charAt(i);
var chr = String.fromCharCode(this.uint8Array[i]);

@@ -262,3 +423,3 @@ switch (this.state) {

case '"':
this.currentNode = this.createNode(this.currentNode, this.pos + i);
this.currentNode = this.createNode(this.currentNode, i);
this.currentNode.type = 'string';

@@ -271,3 +432,3 @@ this.state = 'STRING';

case '(':
this.currentNode = this.createNode(this.currentNode, this.pos + i);
this.currentNode = this.createNode(this.currentNode, i);
this.currentNode.type = 'LIST';

@@ -303,9 +464,10 @@ this.currentNode.closed = false;

case '<':
if (this.str.charAt(i - 1) !== ']') {
this.currentNode = this.createNode(this.currentNode, this.pos + i);
if (String.fromCharCode(this.uint8Array[i - 1]) !== ']') {
this.currentNode = this.createNode(this.currentNode, i);
this.currentNode.type = 'ATOM';
this.currentNode.value = chr;
this.currentNode.valueStart = i;
this.currentNode.valueEnd = i + 1;
this.state = 'ATOM';
} else {
this.currentNode = this.createNode(this.currentNode, this.pos + i);
this.currentNode = this.createNode(this.currentNode, i);
this.currentNode.type = 'PARTIAL';

@@ -319,3 +481,3 @@ this.state = 'PARTIAL';

case '{':
this.currentNode = this.createNode(this.currentNode, this.pos + i);
this.currentNode = this.createNode(this.currentNode, i);
this.currentNode.type = 'LITERAL';

@@ -328,5 +490,6 @@ this.state = 'LITERAL';

case '*':
this.currentNode = this.createNode(this.currentNode, this.pos + i);
this.currentNode = this.createNode(this.currentNode, i);
this.currentNode.type = 'SEQUENCE';
this.currentNode.value = chr;
this.currentNode.valueStart = i;
this.currentNode.valueEnd = i + 1;
this.currentNode.closed = false;

@@ -347,6 +510,6 @@ this.state = 'SEQUENCE';

this.currentNode = this.createNode(this.currentNode, this.pos + i);
this.currentNode = this.createNode(this.currentNode, i);
this.currentNode.type = 'ATOM';
this.currentNode = this.createNode(this.currentNode, this.pos + i);
this.currentNode = this.createNode(this.currentNode, i);
this.currentNode.type = 'SECTION';

@@ -360,3 +523,3 @@ this.currentNode.closed = false;

// (and crazy) term, we just specialize that case here.
if (this.str.substr(i + 1, 9).toUpperCase() === 'REFERRAL ') {
if (fromCharCode(this.uint8Array.subarray(i + 1, i + 10)).toUpperCase() === 'REFERRAL ') {
// create the REFERRAL atom

@@ -366,3 +529,5 @@ this.currentNode = this.createNode(this.currentNode, this.pos + i + 1);

this.currentNode.endPos = this.pos + i + 8;
this.currentNode.value = 'REFERRAL';
this.currentNode.valueStart = i + 1;
this.currentNode.valueEnd = i + 9;
this.currentNode.valueToUpperCase = true;
this.currentNode = this.currentNode.parentNode;

@@ -375,6 +540,6 @@

// jump i to the ']'
i = this.str.indexOf(']', i + 10);
i = this.uint8Array.indexOf(ASCII_RIGHT_BRACKET, i + 10);
this.currentNode.endPos = this.pos + i - 1;
this.currentNode.value = this.str.substring(this.currentNode.startPos - this.pos,
this.currentNode.endPos - this.pos + 1);
this.currentNode.valueStart = this.currentNode.startPos - this.pos;
this.currentNode.valueEnd = this.currentNode.endPos - this.pos + 1;
this.currentNode = this.currentNode.parentNode;

@@ -399,5 +564,6 @@

this.currentNode = this.createNode(this.currentNode, this.pos + i);
this.currentNode = this.createNode(this.currentNode, i);
this.currentNode.type = 'ATOM';
this.currentNode.value = chr;
this.currentNode.valueStart = i;
this.currentNode.valueEnd = i + 1;
this.state = 'ATOM';

@@ -438,3 +604,3 @@ break;

if ((chr === ',' || chr === ':') && this.currentNode.value.match(/^\d+$/)) {
if ((chr === ',' || chr === ':') && this.currentNode.isNumber()) {
this.currentNode.type = 'SEQUENCE';

@@ -446,3 +612,3 @@ this.currentNode.closed = true;

// [ starts a section group for this element
if (chr === '[' && ['BODY', 'BODY.PEEK'].indexOf(this.currentNode.value.toUpperCase()) >= 0) {
if (chr === '[' && (this.currentNode.equals('BODY', false) || this.currentNode.equals('BODY.PEEK', false))) {
this.currentNode.endPos = this.pos + i;

@@ -461,9 +627,9 @@ this.currentNode = this.createNode(this.currentNode.parentNode, this.pos + i);

// if the char is not ATOM compatible, throw. Allow \* as an exception
if (imapFormalSyntax['ATOM-CHAR']().indexOf(chr) < 0 && chr !== ']' && !(chr === '*' && this.currentNode.value === '\\')) {
if (imapFormalSyntax['ATOM-CHAR']().indexOf(chr) < 0 && chr !== ']' && !(chr === '*' && this.currentNode.equals('\\'))) {
throw new Error('Unexpected char at position ' + (this.pos + i));
} else if (this.currentNode.value === '\\*') {
} else if (this.currentNode.equals('\\*')) {
throw new Error('Unexpected char at position ' + (this.pos + i));
}
this.currentNode.value += chr;
this.currentNode.valueEnd = i + 1;
break;

@@ -486,2 +652,3 @@

if (chr === '\\') {
this.currentNode.valueSkip.push(i - this.currentNode.valueStart);
i++;

@@ -491,3 +658,3 @@ if (i >= len) {

}
chr = this.str.charAt(i);
chr = String.fromCharCode(this.uint8Array[i]);
}

@@ -501,3 +668,3 @@

this.currentNode.value += chr;
this.currentNode.valueEnd = i + 1;
break;

@@ -507,3 +674,3 @@

if (chr === '>') {
if (this.currentNode.value.substr(-1) === '.') {
if (this.currentNode.equalsAt('.', -1)) {
throw new Error('Unexpected end of partial at position ' + this.pos);

@@ -519,3 +686,3 @@ }

if (chr === '.' && (!this.currentNode.value.length || this.currentNode.value.match(/\./))) {
if (chr === '.' && (!this.currentNode.getValueLength() || this.currentNode.containsChar("."))) {
throw new Error('Unexpected partial separator . at position ' + this.pos);

@@ -528,7 +695,7 @@ }

if (this.currentNode.value.match(/^0$|\.0$/) && chr !== '.') {
if (chr !== '.' && (this.currentNode.equals('0') || this.currentNode.equalsAt('.0', -2))) {
throw new Error('Invalid partial at position ' + (this.pos + i));
}
this.currentNode.value += chr;
this.currentNode.valueEnd = i + 1;
break;

@@ -542,5 +709,5 @@

}
this.currentNode.value += chr;
this.currentNode.valueEnd = i + 1;
if (this.currentNode.value.length >= this.currentNode.literalLength) {
if (this.currentNode.getValueLength() >= this.currentNode.literalLength) {
this.currentNode.endPos = this.pos + i;

@@ -564,5 +731,5 @@ this.currentNode.closed = true;

}
if (this.str.charAt(i + 1) === '\n') {
if (this.uint8Array[i + 1] === ASCII_NL) {
i++;
} else if (this.str.charAt(i + 1) === '\r' && this.str.charAt(i + 2) === '\n') {
} else if (this.uint8Array[i + 1] === ASCII_CR && this.uint8Array[i + 2] === ASCII_NL) {
i += 2;

@@ -572,2 +739,3 @@ } else {

}
this.currentNode.valueStart = i + 1;
this.currentNode.literalLength = Number(this.currentNode.literalLength);

@@ -599,7 +767,7 @@ this.currentNode.started = true;

if (chr === ' ') {
if (!this.currentNode.value.substr(-1).match(/\d/) && this.currentNode.value.substr(-1) !== '*') {
if (!this.currentNode.isDigit(-1) && !this.currentNode.equalsAt('*', -1)) {
throw new Error('Unexpected whitespace at position ' + (this.pos + i));
}
if (this.currentNode.value.substr(-1) === '*' && this.currentNode.value.substr(-2, 1) !== ':') {
if (this.currentNode.equalsAt('*', -1) && !this.currentNode.equalsAt(':', -2)) {
throw new Error('Unexpected whitespace at position ' + (this.pos + i));

@@ -629,25 +797,25 @@ }

if (chr === ':') {
if (!this.currentNode.value.substr(-1).match(/\d/) && this.currentNode.value.substr(-1) !== '*') {
if (!this.currentNode.isDigit(-1) && !this.currentNode.equalsAt('*', -1)) {
throw new Error('Unexpected range separator : at position ' + (this.pos + i));
}
} else if (chr === '*') {
if ([',', ':'].indexOf(this.currentNode.value.substr(-1)) < 0) {
if (!this.currentNode.equalsAt(',', -1) && !this.currentNode.equalsAt(':', -1)) {
throw new Error('Unexpected range wildcard at position ' + (this.pos + i));
}
} else if (chr === ',') {
if (!this.currentNode.value.substr(-1).match(/\d/) && this.currentNode.value.substr(-1) !== '*') {
if (!this.currentNode.isDigit(-1) && !this.currentNode.equalsAt('*', -1)) {
throw new Error('Unexpected sequence separator , at position ' + (this.pos + i));
}
if (this.currentNode.value.substr(-1) === '*' && this.currentNode.value.substr(-2, 1) !== ':') {
if (this.currentNode.equalsAt('*', -1) && !this.currentNode.equalsAt(':', -2)) {
throw new Error('Unexpected sequence separator , at position ' + (this.pos + i));
}
} else if (!chr.match(/\d/)) {
} else if (!/\d/.test(chr)) {
throw new Error('Unexpected char at position ' + (this.pos + i));
}
if (chr.match(/\d/) && this.currentNode.value.substr(-1) === '*') {
if (/\d/.test(chr) && this.currentNode.equalsAt('*', -1)) {
throw new Error('Unexpected number at position ' + (this.pos + i));
}
this.currentNode.value += chr;
this.currentNode.valueEnd = i + 1;
break;

@@ -658,3 +826,3 @@ }

return function(command, options) {
return function(buffers, options) {
var parser, response = {};

@@ -664,3 +832,3 @@

parser = new ParserInstance(command, options);
parser = new ParserInstance(buffers, options);

@@ -676,3 +844,3 @@ response.tag = parser.getTag();

if (parser.remainder.trim().length) {
if (!isEmpty(parser.remainder)) {
parser.getSpace();

@@ -679,0 +847,0 @@ response.attributes = parser.getAttributes();

@@ -12,2 +12,10 @@ (function(root, factory) {

function toUint8ArrayList(command) {
var asciiArray = [command.length];
for (var i = 0; i < command.length; i++) {
asciiArray[i] = command.charCodeAt(i);
}
return new Uint8Array(asciiArray);
}
var expect = chai.expect;

@@ -20,3 +28,3 @@ chai.Assertion.includeStack = true;

var command = '* FETCH (ENVELOPE ("Mon, 2 Sep 2013 05:30:13 -0700 (PDT)" NIL ((NIL NIL "andris" "kreata.ee")) ((NIL NIL "andris" "kreata.ee")) ((NIL NIL "andris" "kreata.ee")) ((NIL NIL "andris" "tr.ee")) NIL NIL NIL "<-4730417346358914070@unknownmsgid>") BODYSTRUCTURE BODY.PEEK[HEADER.FIELDS (REFERENCES, LIST-ID)] (("MESSAGE" "RFC822" NIL NIL NIL "7BIT" 105 (NIL NIL ((NIL NIL "andris" "kreata.ee")) ((NIL NIL "andris" "kreata.ee")) ((NIL NIL "andris" "kreata.ee")) ((NIL NIL "andris" "pangalink.net")) NIL NIL "<test1>" NIL) ("TEXT" "PLAIN" NIL NIL NIL "7BIT" 12 0 NIL NIL NIL) 5 NIL NIL NIL) ("MESSAGE" "RFC822" NIL NIL NIL "7BIT" 83 (NIL NIL ((NIL NIL "andris" "kreata.ee")) ((NIL NIL "andris" "kreata.ee")) ((NIL NIL "andris" "kreata.ee")) ((NIL NIL "andris" "pangalink.net")) NIL NIL "NIL" NIL) ("TEXT" "PLAIN" NIL NIL NIL "7BIT" 12 0 NIL NIL NIL) 4 NIL NIL NIL) ("TEXT" "HTML" ("CHARSET" "utf-8") NIL NIL "QUOTED-PRINTABLE" 19 0 NIL NIL NIL) "MIXED" ("BOUNDARY" "----mailcomposer-?=_1-1328088797399") NIL NIL))',
parsed = imapHandler.parser(command, {
parsed = imapHandler.parser(toUint8ArrayList(command), {
allowUntagged: true

@@ -23,0 +31,0 @@ }),

@@ -15,6 +15,14 @@ (function(root, factory) {

function toUint8ArrayList(command) {
var asciiArray = [command.length];
for (var i = 0; i < command.length; i++) {
asciiArray[i] = command.charCodeAt(i);
}
return new Uint8Array(asciiArray);
}
describe('IMAP Command Parser', function() {
describe('get tag', function() {
it('should succeed', function() {
expect(imapHandler.parser('TAG1 CMD').tag).to.equal('TAG1');
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD')).tag).to.equal('TAG1');
});

@@ -24,3 +32,3 @@

expect(function() {
imapHandler.parser(' TAG CMD');
imapHandler.parser(toUint8ArrayList(' TAG CMD'));
}).to.throw(Error);

@@ -31,3 +39,3 @@ });

expect(function() {
imapHandler.parser(' TAG CMD');
imapHandler.parser(toUint8ArrayList(' TAG CMD'));
}).to.throw(Error);

@@ -37,3 +45,3 @@ });

it('should + OK ', function() {
expect(imapHandler.parser('+ TAG CMD').tag).to.equal('+');
expect(imapHandler.parser(toUint8ArrayList('+ TAG CMD')).tag).to.equal('+');
});

@@ -43,3 +51,3 @@

expect(function() {
imapHandler.parser('* CMD');
imapHandler.parser(toUint8ArrayList('* CMD'));
}).to.not.throw(Error);

@@ -50,3 +58,3 @@ });

expect(function() {
imapHandler.parser('');
imapHandler.parser(toUint8ArrayList(''));
}).to.throw(Error);

@@ -57,3 +65,3 @@ });

expect(function() {
imapHandler.parser('TAG1');
imapHandler.parser(toUint8ArrayList('TAG1'));
}).to.throw(Error);

@@ -64,3 +72,3 @@ });

expect(function() {
imapHandler.parser('TAG"1 CMD');
imapHandler.parser(toUint8ArrayList('TAG"1 CMD'));
}).to.throw(Error);

@@ -73,3 +81,3 @@ });

expect(function() {
imapHandler.parser('* SEARCH ');
imapHandler.parser(toUint8ArrayList('* SEARCH '));
}).to.not.throw(Error);

@@ -81,7 +89,7 @@ });

it('should succeed', function() {
expect(imapHandler.parser('TAG1 CMD').command).to.equal('CMD');
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD')).command).to.equal('CMD');
});
it('should work for multi word command', function() {
expect(imapHandler.parser('TAG1 UID FETCH').command).to.equal('UID FETCH');
expect(imapHandler.parser(toUint8ArrayList('TAG1 UID FETCH')).command).to.equal('UID FETCH');
});

@@ -91,3 +99,3 @@

expect(function() {
imapHandler.parser('TAG1 CMD');
imapHandler.parser(toUint8ArrayList('TAG1 CMD'));
}).to.throw(Error);

@@ -98,3 +106,3 @@ });

expect(function() {
imapHandler.parser('TAG1 ');
imapHandler.parser(toUint8ArrayList('TAG1 '));
}).to.throw(Error);

@@ -105,3 +113,3 @@ });

expect(function() {
imapHandler.parser('TAG1 CM=D');
imapHandler.parser(toUint8ArrayList('TAG1 CM=D'));
}).to.throw(Error);

@@ -113,3 +121,3 @@ });

it('should succeed', function() {
expect(imapHandler.parser('TAG1 CMD FED').attributes).to.deep.equal([{
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD FED')).attributes).to.deep.equal([{
type: 'ATOM',

@@ -121,3 +129,3 @@ value: 'FED'

it('should succeed for single whitespace between values', function() {
expect(imapHandler.parser('TAG1 CMD FED TED').attributes).to.deep.equal([{
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD FED TED')).attributes).to.deep.equal([{
type: 'ATOM',

@@ -132,3 +140,3 @@ value: 'FED'

it('should succeed for ATOM', function() {
expect(imapHandler.parser('TAG1 CMD ABCDE').attributes).to.deep.equal([{
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD ABCDE')).attributes).to.deep.equal([{
type: 'ATOM',

@@ -138,3 +146,3 @@ value: 'ABCDE'

expect(imapHandler.parser('TAG1 CMD ABCDE DEFGH').attributes).to.deep.equal([{
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD ABCDE DEFGH')).attributes).to.deep.equal([{
type: 'ATOM',

@@ -147,3 +155,3 @@ value: 'ABCDE'

expect(imapHandler.parser('TAG1 CMD %').attributes).to.deep.equal([{
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD %')).attributes).to.deep.equal([{
type: 'ATOM',

@@ -153,3 +161,3 @@ value: '%'

expect(imapHandler.parser('TAG1 CMD \\*').attributes).to.deep.equal([{
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD \\*')).attributes).to.deep.equal([{
type: 'ATOM',

@@ -159,3 +167,3 @@ value: '\\*'

expect(imapHandler.parser('12.82 STATUS [Gmail].Trash (UIDNEXT UNSEEN HIGHESTMODSEQ)').attributes).to.deep.equal([{
expect(imapHandler.parser(toUint8ArrayList('12.82 STATUS [Gmail].Trash (UIDNEXT UNSEEN HIGHESTMODSEQ)')).attributes).to.deep.equal([{
type: 'ATOM',

@@ -179,3 +187,3 @@ value: '[Gmail].Trash'

expect(function() {
imapHandler.parser('TAG1 CMD \\*a');
imapHandler.parser(toUint8ArrayList('TAG1 CMD \\*a'));
}).to.throw(Error);

@@ -187,3 +195,3 @@ });

it('should succeed', function() {
expect(imapHandler.parser('TAG1 CMD "ABCDE"').attributes).to.deep.equal([{
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD "ABCDE"')).attributes).to.deep.equal([{
type: 'STRING',

@@ -193,3 +201,3 @@ value: 'ABCDE'

expect(imapHandler.parser('TAG1 CMD "ABCDE" "DEFGH"').attributes).to.deep.equal([{
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD "ABCDE" "DEFGH"')).attributes).to.deep.equal([{
type: 'STRING',

@@ -204,3 +212,3 @@ value: 'ABCDE'

it('should not explode on invalid char', function() {
expect(imapHandler.parser('* 1 FETCH (BODY[] "\xc2")').attributes).to.deep.equal([{
expect(imapHandler.parser(toUint8ArrayList('* 1 FETCH (BODY[] "\xc2")')).attributes).to.deep.equal([{
type: 'ATOM',

@@ -229,3 +237,3 @@ value: 'FETCH'

it('should support Parent folder being in brackets', function() {
expect(imapHandler.parser('TAG1 CMD "/" [Folder]/Subfolder').attributes).to.deep.equal([
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD "/" [Folder]/Subfolder')).attributes).to.deep.equal([
{

@@ -243,3 +251,3 @@ type: 'STRING',

it('should support sub-folder being in brackets', function() {
expect(imapHandler.parser('TAG1 CMD "/" Folder/[Subfolder]').attributes).to.deep.equal([
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD "/" Folder/[Subfolder]')).attributes).to.deep.equal([
{

@@ -259,3 +267,3 @@ type: 'STRING',

it('should support Parent folder being in brackets', function() {
expect(imapHandler.parser('TAG1 CMD "." [Folder].Subfolder').attributes).to.deep.equal([
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD "." [Folder].Subfolder')).attributes).to.deep.equal([
{

@@ -273,3 +281,3 @@ type: 'STRING',

it('should support sub-folder being in brackets', function() {
expect(imapHandler.parser('TAG1 CMD "." Folder.[Subfolder]').attributes).to.deep.equal([
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD "." Folder.[Subfolder]')).attributes).to.deep.equal([
{

@@ -290,3 +298,3 @@ type: 'STRING',

it('should succeed', function() {
expect(imapHandler.parser('TAG1 CMD (1234)').attributes).to.deep.equal([
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD (1234)')).attributes).to.deep.equal([
[{

@@ -297,3 +305,3 @@ type: 'ATOM',

]);
expect(imapHandler.parser('TAG1 CMD (1234 TERE)').attributes).to.deep.equal([
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD (1234 TERE)')).attributes).to.deep.equal([
[{

@@ -307,3 +315,3 @@ type: 'ATOM',

]);
expect(imapHandler.parser('TAG1 CMD (1234)(TERE)').attributes).to.deep.equal([
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD (1234)(TERE)')).attributes).to.deep.equal([
[{

@@ -318,3 +326,3 @@ type: 'ATOM',

]);
expect(imapHandler.parser('TAG1 CMD ( 1234)').attributes).to.deep.equal([
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD ( 1234)')).attributes).to.deep.equal([
[{

@@ -327,3 +335,3 @@ type: 'ATOM',

// observed on yahoo.co.jp's
expect(imapHandler.parser('TAG1 CMD (1234 )').attributes).to.deep.equal([
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD (1234 )')).attributes).to.deep.equal([
[{

@@ -334,3 +342,3 @@ type: 'ATOM',

]);
expect(imapHandler.parser('TAG1 CMD (1234) ').attributes).to.deep.equal([
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD (1234) ')).attributes).to.deep.equal([
[{

@@ -346,3 +354,3 @@ type: 'ATOM',

it('should succeed', function() {
expect(imapHandler.parser('TAG1 CMD (((TERE)) VANA)').attributes).to.deep.equal([
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD (((TERE)) VANA)')).attributes).to.deep.equal([
[

@@ -360,3 +368,3 @@ [

]);
expect(imapHandler.parser('TAG1 CMD (( (TERE)) VANA)').attributes).to.deep.equal([
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD (( (TERE)) VANA)')).attributes).to.deep.equal([
[

@@ -374,3 +382,3 @@ [

]);
expect(imapHandler.parser('TAG1 CMD (((TERE) ) VANA)').attributes).to.deep.equal([
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD (((TERE) ) VANA)')).attributes).to.deep.equal([
[

@@ -393,3 +401,3 @@ [

it('should succeed', function() {
expect(imapHandler.parser('TAG1 CMD {4}\r\nabcd').attributes).to.deep.equal([{
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD {4}\r\nabcd')).attributes).to.deep.equal([{
type: 'LITERAL',

@@ -399,3 +407,3 @@ value: 'abcd'

expect(imapHandler.parser('TAG1 CMD {4}\r\nabcd {4}\r\nkere').attributes).to.deep.equal([{
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD {4}\r\nabcd {4}\r\nkere')).attributes).to.deep.equal([{
type: 'LITERAL',

@@ -408,3 +416,3 @@ value: 'abcd'

expect(imapHandler.parser('TAG1 CMD ({4}\r\nabcd {4}\r\nkere)').attributes).to.deep.equal([
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD ({4}\r\nabcd {4}\r\nkere)')).attributes).to.deep.equal([
[{

@@ -422,3 +430,3 @@ type: 'LITERAL',

expect(function() {
imapHandler.parser('TAG1 CMD {4}\r\nabcd{4} \r\nkere');
imapHandler.parser(toUint8ArrayList('TAG1 CMD {4}\r\nabcd{4} \r\nkere'));
}).to.throw(Error);

@@ -428,3 +436,3 @@ });

it('should allow zero length literal in the end of a list', function() {
expect(imapHandler.parser('TAG1 CMD ({0}\r\n)').attributes).to.deep.equal([
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD ({0}\r\n)')).attributes).to.deep.equal([
[{

@@ -441,3 +449,3 @@ type: 'LITERAL',

it('should succeed', function() {
expect(imapHandler.parser('TAG1 CMD BODY[]').attributes).to.deep.equal([{
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD BODY[]')).attributes).to.deep.equal([{
type: 'ATOM',

@@ -447,3 +455,3 @@ value: 'BODY',

}]);
expect(imapHandler.parser('TAG1 CMD BODY[(KERE)]').attributes).to.deep.equal([{
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD BODY[(KERE)]')).attributes).to.deep.equal([{
type: 'ATOM',

@@ -465,3 +473,3 @@ value: 'BODY',

// reality (unlike for lists).
expect(imapHandler.parser('TAG1 CMD BODY[HEADER.FIELDS (Subject From) ]').attributes).to.deep.equal([{
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD BODY[HEADER.FIELDS (Subject From) ]')).attributes).to.deep.equal([{
type: 'ATOM',

@@ -486,4 +494,4 @@ value: 'BODY',

describe('Human readable', function() {
it('should succeed', function() {
expect(imapHandler.parser('* OK [CAPABILITY IDLE] Hello world!')).to.deep.equal({
it('should succeed 1', function() {
expect(imapHandler.parser(toUint8ArrayList('* OK [CAPABILITY IDLE] Hello world!'))).to.deep.equal({
command: 'OK',

@@ -506,4 +514,6 @@ tag: '*',

});
});
expect(imapHandler.parser('* OK Hello world!')).to.deep.equal({
it('should succeed 2', function() {
expect(imapHandler.parser(toUint8ArrayList('* OK Hello world!'))).to.deep.equal({
command: 'OK',

@@ -516,12 +526,16 @@ tag: '*',

});
});
expect(imapHandler.parser('* OK')).to.deep.equal({
it('should succeed 3', function() {
expect(imapHandler.parser(toUint8ArrayList('* OK'))).to.deep.equal({
command: 'OK',
tag: '*'
});
});
it('should succeed 4', function() {
// USEATTR is from RFC6154; we are testing that just an ATOM
// on its own will parse successfully here. (All of the
// RFC5530 codes are also single atoms.)
expect(imapHandler.parser('TAG1 OK [USEATTR] \\All not supported')).to.deep.equal({
expect(imapHandler.parser(toUint8ArrayList('TAG1 OK [USEATTR] \\All not supported'))).to.deep.equal({
tag: 'TAG1',

@@ -541,6 +555,8 @@ command: 'OK',

});
});
it('should succeed 5', function() {
// RFC5267 defines the NOUPDATE error. Including for quote /
// string coverage.
expect(imapHandler.parser('* NO [NOUPDATE "B02"] Too many contexts')).to.deep.equal({
expect(imapHandler.parser(toUint8ArrayList('* NO [NOUPDATE "B02"] Too many contexts'))).to.deep.equal({
tag: '*',

@@ -563,8 +579,9 @@ command: 'NO',

});
});
it('should succeed 6', function() {
// RFC5464 defines the METADATA response code; adding this to
// ensure the transition for when '2199' hits ']' is handled
// safely.
expect(imapHandler.parser('TAG1 OK [METADATA LONGENTRIES 2199] GETMETADATA complete')).to.deep.equal({
expect(imapHandler.parser(toUint8ArrayList('TAG1 OK [METADATA LONGENTRIES 2199] GETMETADATA complete'))).to.deep.equal({
tag: 'TAG1',

@@ -590,6 +607,8 @@ command: 'OK',

});
});
it('should succeed 7', function() {
// RFC4467 defines URLMECH. Included because of the example
// third atom involves base64-encoding which is somewhat unusual
expect(imapHandler.parser('TAG1 OK [URLMECH INTERNAL XSAMPLE=P34OKhO7VEkCbsiYY8rGEg==] done')).to.deep.equal({
expect(imapHandler.parser(toUint8ArrayList('TAG1 OK [URLMECH INTERNAL XSAMPLE=P34OKhO7VEkCbsiYY8rGEg==] done'))).to.deep.equal({
tag: 'TAG1',

@@ -615,3 +634,5 @@ command: 'OK',

});
});
it('should succeed 8', function() {
// RFC2221 defines REFERRAL where the argument is an imapurl

@@ -625,3 +646,3 @@ // (defined by RFC2192 which is obsoleted by RFC5092) which

// of REFERRAL.
expect(imapHandler.parser('TAG1 NO [REFERRAL IMAP://user;AUTH=*@SERVER2/] Remote Server')).to.deep.equal({
expect(imapHandler.parser(toUint8ArrayList('TAG1 NO [REFERRAL IMAP://user;AUTH=*@SERVER2/] Remote Server'))).to.deep.equal({
tag: 'TAG1',

@@ -644,7 +665,9 @@ command: 'NO',

});
});
it('should succeed 9', function() {
// PERMANENTFLAGS is from RFC3501. Its syntax is also very
// similar to BADCHARSET, except BADCHARSET has astrings
// inside the list.
expect(imapHandler.parser('* OK [PERMANENTFLAGS (de:hacking $label kt-evalution [css3-page] \\*)] Flags permitted.')).to.deep.equal({
expect(imapHandler.parser(toUint8ArrayList('* OK [PERMANENTFLAGS (de:hacking $label kt-evalution [css3-page] \\*)] Flags permitted.'))).to.deep.equal({
tag: '*',

@@ -681,7 +704,9 @@ command: 'OK',

});
});
it('should succeed 10', function() {
// COPYUID is from RFC4315 and included the previously failing
// parsing situation of a sequence terminated by ']' rather than
// whitespace.
expect(imapHandler.parser('TAG1 OK [COPYUID 4 1417051618:1417051620 1421730687:1421730689] COPY completed')).to.deep.equal({
expect(imapHandler.parser(toUint8ArrayList('TAG1 OK [COPYUID 4 1417051618:1417051620 1421730687:1421730689] COPY completed'))).to.deep.equal({
tag: 'TAG1',

@@ -710,3 +735,5 @@ command: 'OK',

});
});
it('should succeed 11', function() {
// MODIFIED is from RFC4551 and is basically the same situation

@@ -716,3 +743,3 @@ // as the COPYUID case, but in this case our example sequences

// '7,9' payload would end up an ATOM.)
expect(imapHandler.parser('TAG1 OK [MODIFIED 7,9] Conditional STORE failed')).to.deep.equal({
expect(imapHandler.parser(toUint8ArrayList('TAG1 OK [MODIFIED 7,9] Conditional STORE failed'))).to.deep.equal({
tag: 'TAG1',

@@ -741,3 +768,3 @@ command: 'OK',

it('should succeed', function() {
expect(imapHandler.parser('TAG1 CMD BODY[]<0>').attributes).to.deep.equal([{
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD BODY[]<0>')).attributes).to.deep.equal([{
type: 'ATOM',

@@ -748,3 +775,3 @@ value: 'BODY',

}]);
expect(imapHandler.parser('TAG1 CMD BODY[]<12.45>').attributes).to.deep.equal([{
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD BODY[]<12.45>')).attributes).to.deep.equal([{
type: 'ATOM',

@@ -755,3 +782,3 @@ value: 'BODY',

}]);
expect(imapHandler.parser('TAG1 CMD BODY[HEADER.FIELDS (Subject From)]<12.45>').attributes).to.deep.equal([{
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD BODY[HEADER.FIELDS (Subject From)]<12.45>')).attributes).to.deep.equal([{
type: 'ATOM',

@@ -777,15 +804,15 @@ value: 'BODY',

expect(function() {
imapHandler.parser('TAG1 CMD KODY<0.123>');
imapHandler.parser(toUint8ArrayList('TAG1 CMD KODY<0.123>'));
}).to.throw(Error);
expect(function() {
imapHandler.parser('TAG1 CMD BODY[]<01>');
imapHandler.parser(toUint8ArrayList('TAG1 CMD BODY[]<01>'));
}).to.throw(Error);
expect(function() {
imapHandler.parser('TAG1 CMD BODY[]<0.01>');
imapHandler.parser(toUint8ArrayList('TAG1 CMD BODY[]<0.01>'));
}).to.throw(Error);
expect(function() {
imapHandler.parser('TAG1 CMD BODY[]<0.1.>');
imapHandler.parser(toUint8ArrayList('TAG1 CMD BODY[]<0.1.>'));
}).to.throw(Error);

@@ -797,3 +824,3 @@ });

it('should succeed', function() {
expect(imapHandler.parser('TAG1 CMD *:4,5:7 TEST').attributes).to.deep.equal([{
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD *:4,5:7 TEST')).attributes).to.deep.equal([{
type: 'SEQUENCE',

@@ -806,3 +833,3 @@ value: '*:4,5:7'

expect(imapHandler.parser('TAG1 CMD 1:* TEST').attributes).to.deep.equal([{
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD 1:* TEST')).attributes).to.deep.equal([{
type: 'SEQUENCE',

@@ -815,3 +842,3 @@ value: '1:*'

expect(imapHandler.parser('TAG1 CMD *:4 TEST').attributes).to.deep.equal([{
expect(imapHandler.parser(toUint8ArrayList('TAG1 CMD *:4 TEST')).attributes).to.deep.equal([{
type: 'SEQUENCE',

@@ -827,27 +854,27 @@ value: '*:4'

expect(function() {
imapHandler.parser('TAG1 CMD *:4,5:');
imapHandler.parser(toUint8ArrayList('TAG1 CMD *:4,5:'));
}).to.throw(Error);
expect(function() {
imapHandler.parser('TAG1 CMD *:4,5:TEST TEST');
imapHandler.parser(toUint8ArrayList('TAG1 CMD *:4,5:TEST TEST'));
}).to.throw(Error);
expect(function() {
imapHandler.parser('TAG1 CMD *:4,5: TEST');
imapHandler.parser(toUint8ArrayList('TAG1 CMD *:4,5: TEST'));
}).to.throw(Error);
expect(function() {
imapHandler.parser('TAG1 CMD *4,5 TEST');
imapHandler.parser(toUint8ArrayList('TAG1 CMD *4,5 TEST'));
}).to.throw(Error);
expect(function() {
imapHandler.parser('TAG1 CMD *,5 TEST');
imapHandler.parser(toUint8ArrayList('TAG1 CMD *,5 TEST'));
}).to.throw(Error);
expect(function() {
imapHandler.parser('TAG1 CMD 5,* TEST');
imapHandler.parser(toUint8ArrayList('TAG1 CMD 5,* TEST'));
}).to.throw(Error);
expect(function() {
imapHandler.parser('TAG1 CMD 5, TEST');
imapHandler.parser(toUint8ArrayList('TAG1 CMD 5, TEST'));
}).to.throw(Error);

@@ -859,3 +886,3 @@ });

it('should succeed', function() {
expect(imapHandler.parser('* 331 FETCH (ENVELOPE ("=?ISO-8859-1?Q?\\"G=FCnter__Hammerl\\"?="))').attributes).to.deep.equal([{
expect(imapHandler.parser(toUint8ArrayList('* 331 FETCH (ENVELOPE ("=?ISO-8859-1?Q?\\"G=FCnter__Hammerl\\"?="))')).attributes).to.deep.equal([{
type: 'ATOM',

@@ -881,3 +908,3 @@ value: 'FETCH'

expect(function() {
parsed = imapHandler.parser(mimetorture.input);
parsed = imapHandler.parser(toUint8ArrayList(mimetorture.input));
}).to.not.throw(Error);

@@ -884,0 +911,0 @@ expect(parsed).to.deep.equal(mimetorture.output);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc