imapflow 1.0.134 → 1.0.136
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/lib/imap-flow.js +23 -3
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
- 1.0.136 - 2023-08-15
|
|
4
|
+
|
|
5
|
+
- Added missing destroySoon method for the PassThrough writable socket
|
|
6
|
+
|
|
7
|
+
- 1.0.135 - 2023-07-29
|
|
8
|
+
|
|
9
|
+
- Improved handling of unexpected close
|
|
10
|
+
|
|
3
11
|
- 1.0.134 - 2023-07-20
|
|
4
12
|
|
|
5
13
|
- Fixed unicode search if UTF8=ACCEPT extension was enabled
|
package/lib/imap-flow.js
CHANGED
|
@@ -725,6 +725,22 @@ class ImapFlow extends EventEmitter {
|
|
|
725
725
|
// route outgoing socket via deflate stream
|
|
726
726
|
this.writeSocket = new PassThrough();
|
|
727
727
|
|
|
728
|
+
this.writeSocket.destroySoon = () => {
|
|
729
|
+
try {
|
|
730
|
+
if (this.socket) {
|
|
731
|
+
this.socket.destroySoon();
|
|
732
|
+
}
|
|
733
|
+
this.writeSocket.end();
|
|
734
|
+
} catch (err) {
|
|
735
|
+
this.log.error({ err, info: 'Failed to destroy PassThrough socket', cid: this.id });
|
|
736
|
+
throw err;
|
|
737
|
+
}
|
|
738
|
+
};
|
|
739
|
+
|
|
740
|
+
Object.defineProperty(this.writeSocket, 'destroyed', {
|
|
741
|
+
get: () => this.socket.destroyed
|
|
742
|
+
});
|
|
743
|
+
|
|
728
744
|
// we need to force flush deflated data to socket so we can't
|
|
729
745
|
// use normal pipes for this.writeSocket -> this._deflate -> this.socket
|
|
730
746
|
let reading = false;
|
|
@@ -923,6 +939,7 @@ class ImapFlow extends EventEmitter {
|
|
|
923
939
|
this.log.error({ err, cid: this.id });
|
|
924
940
|
|
|
925
941
|
if (typeof this.initialReject === 'function') {
|
|
942
|
+
clearTimeout(this.greetingTimeout);
|
|
926
943
|
let reject = this.initialReject;
|
|
927
944
|
this.initialResolve = false;
|
|
928
945
|
this.initialReject = false;
|
|
@@ -958,6 +975,7 @@ class ImapFlow extends EventEmitter {
|
|
|
958
975
|
this.log.error({ err, cid: this.id });
|
|
959
976
|
|
|
960
977
|
if (typeof this.initialReject === 'function') {
|
|
978
|
+
clearTimeout(this.greetingTimeout);
|
|
961
979
|
let reject = this.initialReject;
|
|
962
980
|
this.initialResolve = false;
|
|
963
981
|
this.initialReject = false;
|
|
@@ -1370,12 +1388,14 @@ class ImapFlow extends EventEmitter {
|
|
|
1370
1388
|
this.idling = false;
|
|
1371
1389
|
|
|
1372
1390
|
if (typeof this.initialReject === 'function' && !this.options.verifyOnly) {
|
|
1391
|
+
clearTimeout(this.greetingTimeout);
|
|
1373
1392
|
let reject = this.initialReject;
|
|
1374
1393
|
this.initialResolve = false;
|
|
1375
1394
|
this.initialReject = false;
|
|
1376
1395
|
let err = new Error('Unexpected close');
|
|
1377
1396
|
err.code = `ClosedAfterConnect${this.secureConnection ? 'TLS' : 'Text'}`;
|
|
1378
|
-
|
|
1397
|
+
// still has to go through the logic below
|
|
1398
|
+
setImmediate(() => reject(err));
|
|
1379
1399
|
}
|
|
1380
1400
|
|
|
1381
1401
|
if (typeof this.preCheck === 'function') {
|
|
@@ -1412,7 +1432,7 @@ class ImapFlow extends EventEmitter {
|
|
|
1412
1432
|
|
|
1413
1433
|
if (this.writeSocket && !this.writeSocket.destroyed) {
|
|
1414
1434
|
try {
|
|
1415
|
-
this.writeSocket.
|
|
1435
|
+
this.writeSocket.destroySoon();
|
|
1416
1436
|
} catch (err) {
|
|
1417
1437
|
this.log.error({ err, cid: this.id });
|
|
1418
1438
|
}
|
|
@@ -1420,7 +1440,7 @@ class ImapFlow extends EventEmitter {
|
|
|
1420
1440
|
|
|
1421
1441
|
if (this.socket && !this.socket.destroyed && this.writeSocket !== this.socket) {
|
|
1422
1442
|
try {
|
|
1423
|
-
this.socket.
|
|
1443
|
+
this.socket.destroySoon();
|
|
1424
1444
|
} catch (err) {
|
|
1425
1445
|
this.log.error({ err, cid: this.id });
|
|
1426
1446
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "imapflow",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.136",
|
|
4
4
|
"description": "IMAP Client for Node",
|
|
5
5
|
"main": "./lib/imap-flow.js",
|
|
6
6
|
"scripts": {
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
},
|
|
28
28
|
"homepage": "https://imapflow.com/",
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@babel/eslint-parser": "7.22.
|
|
31
|
-
"@babel/eslint-plugin": "7.22.
|
|
30
|
+
"@babel/eslint-parser": "7.22.10",
|
|
31
|
+
"@babel/eslint-plugin": "7.22.10",
|
|
32
32
|
"@babel/plugin-syntax-class-properties": "7.12.13",
|
|
33
|
-
"@babel/preset-env": "7.22.
|
|
34
|
-
"@types/node": "20.
|
|
33
|
+
"@babel/preset-env": "7.22.10",
|
|
34
|
+
"@types/node": "20.5.0",
|
|
35
35
|
"braintree-jsdoc-template": "3.3.0",
|
|
36
|
-
"eslint": "8.
|
|
36
|
+
"eslint": "8.47.0",
|
|
37
37
|
"eslint-config-nodemailer": "1.2.0",
|
|
38
|
-
"eslint-config-prettier": "
|
|
38
|
+
"eslint-config-prettier": "9.0.0",
|
|
39
39
|
"grunt": "1.6.1",
|
|
40
40
|
"grunt-cli": "1.4.3",
|
|
41
41
|
"grunt-contrib-nodeunit": "5.0.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"libqp": "2.0.1",
|
|
53
53
|
"mailsplit": "5.4.0",
|
|
54
54
|
"nodemailer": "6.9.4",
|
|
55
|
-
"pino": "8.
|
|
55
|
+
"pino": "8.15.0",
|
|
56
56
|
"socks": "2.7.1"
|
|
57
57
|
}
|
|
58
58
|
}
|