summaryrefslogtreecommitdiff
path: root/lib/tls.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tls.js')
-rw-r--r--lib/tls.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/tls.js b/lib/tls.js
index 86ace15b16..515761410b 100644
--- a/lib/tls.js
+++ b/lib/tls.js
@@ -239,6 +239,7 @@ function CryptoStream(pair, options) {
this.pair = pair;
this._pending = null;
+ this._pendingEncoding = '';
this._pendingCallback = null;
this._doneFlag = false;
this._resumingSession = false;
@@ -300,7 +301,7 @@ function onCryptoStreamEnd() {
}
-CryptoStream.prototype._write = function write(data, cb) {
+CryptoStream.prototype._write = function write(data, encoding, cb) {
assert(this._pending === null);
// Black-hole data
@@ -361,6 +362,7 @@ CryptoStream.prototype._write = function write(data, cb) {
// No write has happened
this._pending = data;
+ this._pendingEncoding = encoding;
this._pendingCallback = cb;
if (this === this.pair.cleartext) {
@@ -373,11 +375,13 @@ CryptoStream.prototype._write = function write(data, cb) {
CryptoStream.prototype._writePending = function writePending() {
var data = this._pending,
+ encoding = this._pendingEncoding,
cb = this._pendingCallback;
this._pending = null;
+ this._pendingEncoding = '';
this._pendingCallback = null;
- this._write(data, cb);
+ this._write(data, encoding, cb);
};