From d8255c6f85a81ebda52fe77f3ef66ff1550bc70f Mon Sep 17 00:00:00 2001 From: Philipp Borgers Date: Thu, 24 Jan 2013 01:08:32 +0100 Subject: [PATCH] fix jshint errors in lib/connection.js --- lib/connection.js | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/lib/connection.js b/lib/connection.js index 52a00ae..06aa687 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -37,7 +37,7 @@ p.connect = function(port, host) { this.stream.on('connect', function() { self.emit('connect'); }); - + this.stream.on('error', function(error) { self.emit('error', error); }); @@ -53,9 +53,9 @@ p.connect = function(port, host) { if (msg.text == 0x53) { var tls = require('tls'); self.stream.removeAllListeners(); - self.stream = tls.connect({ - socket: self.stream, - servername: host, + self.stream = tls.connect({ + socket: self.stream, + servername: host, rejectUnauthorized: self.ssl.rejectUnauthorized, ca: self.ssl.ca, pfx: self.ssl.pfx, @@ -67,9 +67,12 @@ p.connect = function(port, host) { self.attachListeners(self.stream); self.emit('sslconnect'); } else { - self.emit('error', new Error("The server doesn't support SSL/TLS connections.")); + self.emit( + 'error', + new Error("The server doesn't support SSL/TLS connections.") + ); } - }); + }); } else { this.attachListeners(this.stream); @@ -91,13 +94,13 @@ p.attachListeners = function(stream) { p.requestSsl = function(config) { this.checkSslResponse = true; - + var bodyBuffer = this.writer .addInt16(0x04D2) .addInt16(0x162F).flush(); - + var length = bodyBuffer.length + 4; - + var buffer = new Writer() .addInt32(length) .add(bodyBuffer) @@ -247,7 +250,7 @@ p.flush = function() { p.sync = function() { //clear out any pending data in the writer this.writer.flush(0); - + this.writer.add(emptyBuffer); this._send(0x53); }; @@ -391,7 +394,7 @@ p.parseMessage = function() { case 0x48: //H msg.name = 'copyOutResponse'; - return this.parseGH(msg); + return this.parseGH(msg); case 0x63: //c msg.name = 'copyDone'; return msg; @@ -540,7 +543,7 @@ p.parseGH = function (msg) { return msg; }; p.parseInt8 = function () { - var value = Number(this.buffer[this.offset]); + var value = Number(this.buffer[this.offset]); this.offset++; return value; }; @@ -570,7 +573,8 @@ p.parseInt16 = function() { }; p.readString = function(length) { - return this.buffer.toString(this.encoding, this.offset, (this.offset += length)); + return this.buffer.toString(this.encoding, this.offset, + (this.offset += length)); }; p.readBytes = function(length) { @@ -585,7 +589,7 @@ p.parseCString = function() { p.parsed = function (msg) { //exclude length field msg.chunk = this.readBytes(msg.length - 4); - return msg; + return msg; }; //end parsing methods module.exports = Connection;