diff --git a/lib/protocol/sequences/Handshake.js b/lib/protocol/sequences/Handshake.js index 0acfa0b51..5809e3487 100644 --- a/lib/protocol/sequences/Handshake.js +++ b/lib/protocol/sequences/Handshake.js @@ -57,6 +57,10 @@ Handshake.prototype['HandshakeInitializationPacket'] = function(packet) { this._config.protocol41 = packet.protocol41; + if (this._config.compress && packet.hasCapabilityFlag(ClientConstants.CLIENT_COMPRESS)) { + this._config.clientFlags |= ClientConstants.CLIENT_COMPRESS; + } + if (this._config.ssl) { if (!packet.hasCapabilityFlag(ClientConstants.CLIENT_SSL)) { var err = new Error('Server does not support secure connection'); @@ -87,10 +91,6 @@ Handshake.prototype._tlsUpgradeCompleteHandler = function() { Handshake.prototype._sendCredentials = function() { var packet = this._handshakeInitializationPacket; - if (this._config.compress && packet.hasCapabilityFlag(ClientConstants.CLIENT_COMPRESS)) { - this._config.clientFlags |= ClientConstants.CLIENT_COMPRESS; - } - this.emit('packet', new Packets.ClientAuthenticationPacket({ clientFlags : this._config.clientFlags, maxPacketSize : this._config.maxPacketSize,