diff --git a/lib/_http_agent.js b/lib/_http_agent.js index 022b633c75..51e85854f8 100644 --- a/lib/_http_agent.js +++ b/lib/_http_agent.js @@ -20,10 +20,8 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. var net = require('net'); -var url = require('url'); var util = require('util'); var EventEmitter = require('events').EventEmitter; -var ClientRequest = require('_http_client').ClientRequest; var debug = util.debuglog('http'); // New Agent code. @@ -267,44 +265,4 @@ Agent.prototype.destroy = function() { }); }; -Agent.prototype.request = function(options, cb) { - if (util.isString(options)) { - options = url.parse(options); - } - // don't try to do dns lookups of foo.com:8080, just foo.com - if (options.hostname) { - options.host = options.hostname; - } - - if (options && options.path && / /.test(options.path)) { - // The actual regex is more like /[^A-Za-z0-9\-._~!$&'()*+,;=/:@]/ - // with an additional rule for ignoring percentage-escaped characters - // but that's a) hard to capture in a regular expression that performs - // well, and b) possibly too restrictive for real-world usage. That's - // why it only scans for spaces because those are guaranteed to create - // an invalid request. - throw new TypeError('Request path contains unescaped characters.'); - } else if (options.protocol && options.protocol !== this.protocol) { - throw new Error('Protocol:' + options.protocol + ' not supported.'); - } - - options = util._extend({ - agent: this, - keepAlive: this.keepAlive - }, options); - - // if it's false, then make a new one, just like this one. - if (options.agent === false) - options.agent = new this.constructor(); - - debug('agent.request', options); - return new ClientRequest(options, cb); -}; - -Agent.prototype.get = function(options, cb) { - var req = this.request(options, cb); - req.end(); - return req; -}; - exports.globalAgent = new Agent();