mirror of
https://github.com/moparisthebest/mail
synced 2024-12-21 23:08:50 -05:00
[WO-567] fix TLS worker handling
This commit is contained in:
parent
7be6c63060
commit
3a6e0463fb
24
Gruntfile.js
24
Gruntfile.js
@ -126,6 +126,12 @@ module.exports = function(grunt) {
|
||||
},
|
||||
options: browserifyOpt
|
||||
},
|
||||
tlsWorker: {
|
||||
files: {
|
||||
'dist/js/tcp-socket-tls-worker.browserified.js': ['node_modules/tcp-socket/src/tcp-socket-tls-worker.js']
|
||||
},
|
||||
options: browserifyOpt
|
||||
},
|
||||
unitTest: {
|
||||
files: {
|
||||
'test/unit/index.browserified.js': [
|
||||
@ -249,6 +255,15 @@ module.exports = function(grunt) {
|
||||
sourceMapName: 'dist/js/mailreader-parser-worker.min.js.map'
|
||||
}
|
||||
},
|
||||
tlsWorker: {
|
||||
files: {
|
||||
'dist/js/tcp-socket-tls-worker.min.js': ['dist/js/tcp-socket-tls-worker.browserified.js']
|
||||
},
|
||||
options: {
|
||||
sourceMap: true,
|
||||
sourceMapName: 'dist/js/tcp-socket-tls-worker.min.js.map'
|
||||
}
|
||||
},
|
||||
unitTest: {
|
||||
files: {
|
||||
'test/unit/index.js': [
|
||||
@ -321,13 +336,6 @@ module.exports = function(grunt) {
|
||||
src: ['openpgp/openpgp.js', 'openpgp/openpgp.worker.js', 'forge/forge.min.js'],
|
||||
dest: 'dist/js/'
|
||||
},
|
||||
tls: {
|
||||
expand: true,
|
||||
flatten: true,
|
||||
cwd: 'node_modules/tcp-socket/src/',
|
||||
src: ['tcp-socket-tls-worker.js', 'tcp-socket-tls.js'],
|
||||
dest: 'dist/js/'
|
||||
},
|
||||
font: {
|
||||
expand: true,
|
||||
cwd: 'src/font/',
|
||||
@ -489,4 +497,4 @@ module.exports = function(grunt) {
|
||||
grunt.registerTask('release-stable', ['dist', 'manifest-stable', 'compress']);
|
||||
grunt.registerTask('default', ['release-dev']);
|
||||
|
||||
};
|
||||
};
|
||||
|
@ -43,7 +43,7 @@
|
||||
"pgpbuilder": "~0.4.0",
|
||||
"pgpmailer": "~0.4.0",
|
||||
"socket.io": "^1.0.6",
|
||||
"tcp-socket": "https://github.com/whiteout-io/tcp-socket/tarball/dev/WO-567",
|
||||
"tcp-socket": "~0.3.13",
|
||||
"wo-smtpclient": "^0.3.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -70,4 +70,4 @@
|
||||
"sinon": "~1.7.3",
|
||||
"time-grunt": "^1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ ctrl.onConnect = function(callback) {
|
||||
credentials.imap.maxUpdateSize = config.imapUpdateBatchSize;
|
||||
|
||||
// tls socket worker path for multithreaded tls in non-native tls environments
|
||||
credentials.imap.tlsWorkerPath = credentials.smtp.tlsWorkerPath = config.workerPath + '/tcp-socket-tls-worker.js';
|
||||
credentials.imap.tlsWorkerPath = credentials.smtp.tlsWorkerPath = config.workerPath + '/tcp-socket-tls-worker.min.js';
|
||||
|
||||
var pgpMailer = new PgpMailer(credentials.smtp, ctrl._pgpbuilder);
|
||||
var imapClient = new ImapClient(credentials.imap);
|
||||
@ -268,4 +268,4 @@ ctrl.onConnect = function(callback) {
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = ctrl;
|
||||
module.exports = ctrl;
|
||||
|
@ -30,6 +30,8 @@ var NO_INBOX = ConnectionDoctor.NO_INBOX = 47;
|
||||
var GENERIC_ERROR = ConnectionDoctor.GENERIC_ERROR = 48;
|
||||
|
||||
|
||||
var WORKER_PATH = cfg.workerPath + '/tcp-socket-tls-worker.min.js';
|
||||
|
||||
//
|
||||
// Public API
|
||||
//
|
||||
@ -52,7 +54,7 @@ ConnectionDoctor.prototype.configure = function(credentials) {
|
||||
secure: this.credentials.imap.secure,
|
||||
ignoreTLS: this.credentials.imap.ignoreTLS,
|
||||
ca: this.credentials.imap.ca,
|
||||
tlsWorkerPath: cfg.workerPath + '/tcp-socket-tls-worker.js',
|
||||
tlsWorkerPath: WORKER_PATH,
|
||||
auth: {
|
||||
user: this.credentials.username,
|
||||
pass: this.credentials.password,
|
||||
@ -64,7 +66,7 @@ ConnectionDoctor.prototype.configure = function(credentials) {
|
||||
useSecureTransport: this.credentials.smtp.secure,
|
||||
ignoreTLS: this.credentials.smtp.ignoreTLS,
|
||||
ca: this.credentials.smtp.ca,
|
||||
tlsWorkerPath: cfg.workerPath + '/tcp-socket-tls-worker.js',
|
||||
tlsWorkerPath: WORKER_PATH,
|
||||
auth: {
|
||||
user: this.credentials.username,
|
||||
pass: this.credentials.password,
|
||||
@ -159,7 +161,7 @@ ConnectionDoctor.prototype._checkReachable = function(options, callback) {
|
||||
binaryType: 'arraybuffer',
|
||||
useSecureTransport: options.secure,
|
||||
ca: options.ca,
|
||||
tlsWorkerPath: cfg.workerPath + '/tcp-socket-tls-worker.js'
|
||||
tlsWorkerPath: WORKER_PATH
|
||||
});
|
||||
|
||||
socket.ondata = function() {}; // we don't actually care about the data
|
||||
|
@ -8,7 +8,7 @@ var TCPSocket = require('tcp-socket'),
|
||||
|
||||
describe('Connection Doctor', function() {
|
||||
var doctor;
|
||||
var socketStub, imapStub, smtpStub, credentials;
|
||||
var socketStub, imapStub, smtpStub, credentials, workerPath;
|
||||
|
||||
beforeEach(function() {
|
||||
//
|
||||
@ -22,6 +22,7 @@ describe('Connection Doctor', function() {
|
||||
}
|
||||
};
|
||||
|
||||
workerPath = 'js/tcp-socket-tls-worker.min.js';
|
||||
imapStub = sinon.createStubInstance(ImapClient);
|
||||
smtpStub = sinon.createStubInstance(SmtpClient);
|
||||
|
||||
@ -84,7 +85,8 @@ describe('Connection Doctor', function() {
|
||||
expect(TCPSocket.open.calledWith(credentials.imap.host, credentials.imap.port, {
|
||||
binaryType: 'arraybuffer',
|
||||
useSecureTransport: credentials.imap.secure,
|
||||
ca: credentials.imap.ca
|
||||
ca: credentials.imap.ca,
|
||||
tlsWorkerPath: workerPath
|
||||
})).to.be.true;
|
||||
|
||||
done();
|
||||
@ -108,7 +110,8 @@ describe('Connection Doctor', function() {
|
||||
expect(TCPSocket.open.calledWith(credentials.imap.host, credentials.imap.port, {
|
||||
binaryType: 'arraybuffer',
|
||||
useSecureTransport: credentials.imap.secure,
|
||||
ca: credentials.imap.ca
|
||||
ca: credentials.imap.ca,
|
||||
tlsWorkerPath: workerPath
|
||||
})).to.be.true;
|
||||
|
||||
done();
|
||||
@ -125,7 +128,8 @@ describe('Connection Doctor', function() {
|
||||
expect(TCPSocket.open.calledWith(credentials.imap.host, credentials.imap.port, {
|
||||
binaryType: 'arraybuffer',
|
||||
useSecureTransport: credentials.imap.secure,
|
||||
ca: credentials.imap.ca
|
||||
ca: credentials.imap.ca,
|
||||
tlsWorkerPath: workerPath
|
||||
})).to.be.true;
|
||||
|
||||
done();
|
||||
@ -408,4 +412,4 @@ describe('Connection Doctor', function() {
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user