This repository has been archived on 2018-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
node-task/node_modules/mysql2/lib/packets/ssl_request.js

25 lines
602 B
JavaScript
Raw Normal View History

2014-09-24 17:56:53 -04:00
var ClientConstants = require('../constants/client');
var Packet = require('../packets/packet');
var Charsets = require('../constants/charsets');
function SSLRequest(flags)
{
this.clientFlags = flags | ClientConstants.SSL;
}
SSLRequest.prototype.toPacket = function()
{
var length = 36;
var buffer = new Buffer(36);
var packet = new Packet(0, buffer);
buffer.fill(0);
packet.offset = 4;
packet.writeInt32(this.clientFlags);
packet.writeInt32(0); // max packet size. todo: move to config
packet.writeInt8(Charsets.UTF8_GENERAL_CI);
return packet;
};
module.exports = SSLRequest;