Skip to content

Commit

Permalink
Migrating to safe-buffer for security reasons.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeal committed Mar 4, 2017
1 parent e72d830 commit cdc47b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var net = require('net')
, events = require('events')
, assert = require('assert')
, util = require('util')
, Buffer = require('safe-buffer').Buffer
;

exports.httpOverHttp = httpOverHttp
Expand Down Expand Up @@ -118,7 +119,7 @@ TunnelingAgent.prototype.createSocket = function createSocket(options, cb) {
var placeholder = {}
self.sockets.push(placeholder)

var connectOptions = mergeOptions({}, self.proxyOptions,
var connectOptions = mergeOptions({}, self.proxyOptions,
{ method: 'CONNECT'
, path: options.host + ':' + options.port
, agent: false
Expand Down Expand Up @@ -183,7 +184,7 @@ TunnelingAgent.prototype.createSocket = function createSocket(options, cb) {
TunnelingAgent.prototype.removeSocket = function removeSocket(socket) {
var pos = this.sockets.indexOf(socket)
if (pos === -1) return

this.sockets.splice(pos, 1)

var pending = this.requests.shift()
Expand All @@ -198,7 +199,7 @@ function createSecureSocket(options, cb) {
var self = this
TunnelingAgent.prototype.createSocket.call(self, options, function(socket) {
// 0 is dummy port for v0.6
var secureSocket = tls.connect(0, mergeOptions({}, self.options,
var secureSocket = tls.connect(0, mergeOptions({}, self.options,
{ servername: options.host
, socket: socket
}
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"files": [
"index.js"
],
"dependencies": {},
"dependencies": {
"safe-buffer": "^5.0.1"
},
"devDependencies": {},
"optionalDependencies": {},
"engines": {
Expand Down

0 comments on commit cdc47b9

Please sign in to comment.