diff --git a/lib/couchdb.js b/lib/couchdb.js index 7c9b831..669b525 100644 --- a/lib/couchdb.js +++ b/lib/couchdb.js @@ -217,7 +217,7 @@ exports.createClient = function(port, host, user, pass, maxListeners, secure) { }) .on('end', function() { var json; - httpAgent.sockets[host + ':' + port][0].emit("agentRemove"); + httpAgent.sockets[host + ':' + port + '::'][0].emit("agentRemove"); if(options.responseEncoding == 'binary') { cbFired = true; @@ -673,10 +673,13 @@ Db.prototype.changesStream = function(query, options) { var stream = new process.EventEmitter(), - client = http.createClient(this.client.port, this.client.host, this.client.port == 443), - path = '/'+this.name+'/_changes?'+exports.toQuery(query), - headers = this.client._authorizationHeaders({'Host': this.client.host}), - request = client.request('GET', path, headers), + request = http.request({ + port: this.client.port, + hostname: this.client.host, + path: '/' + this.name + '/_changes?' + exports.toQuery(query), + headers: this.client._authorizationHeaders({'Host': this.client.host}), + method: 'GET', + }), buffer = ''; request.setTimeout(options.timeout);