Ensure that created buffers aren't doing any charset conversion

This commit is contained in:
Michael Morrison 2014-02-02 11:10:25 -06:00
parent 906c21be61
commit d6d7fee80f
3 changed files with 3 additions and 3 deletions

View file

@ -8,7 +8,7 @@ module.exports = require('./protocols/valve').extend({
}, },
queryInfo: function(state,c) { queryInfo: function(state,c) {
var self = this; var self = this;
self.sendPacket(0x46,false,new Buffer('LSQ'),0x49,function(b) { self.sendPacket(0x46,false,'LSQ',0x49,function(b) {
var reader = self.reader(b); var reader = self.reader(b);
state.raw.protocol = reader.uint(1); state.raw.protocol = reader.uint(1);

View file

@ -5,7 +5,7 @@ function buildPacket(params) {
var paramBuffers = []; var paramBuffers = [];
params.forEach(function(param) { params.forEach(function(param) {
paramBuffers.push(new Buffer(param)); paramBuffers.push(new Buffer(param,'utf8'));
}); });
var totalLength = 12; var totalLength = 12;

View file

@ -174,7 +174,7 @@ module.exports = require('./core').extend({
sendPacket: function(type,sendChallenge,payload,expect,callback,ontimeout) { sendPacket: function(type,sendChallenge,payload,expect,callback,ontimeout) {
var self = this; var self = this;
if(typeof payload == 'string') payload = new Buffer(payload); if(typeof payload == 'string') payload = new Buffer(payload,'binary');
var challengeLength = sendChallenge !== false ? 4 : 0; var challengeLength = sendChallenge !== false ? 4 : 0;
var payloadLength = payload ? payload.length : 0; var payloadLength = payload ? payload.length : 0;