diff options
author | Nathan Rajlich <nathan@tootallnate.net> | 2014-02-25 14:15:02 -0800 |
---|---|---|
committer | Nathan Rajlich <nathan@tootallnate.net> | 2014-02-26 13:18:54 -0800 |
commit | d6bbb19f1d1d6397d862d09304bc63c476f675c1 (patch) | |
tree | 7d371831c0d769125d5b4c062c69783ee697f283 /lib/http.js | |
parent | d307bebec4a7b087e4bb3576665235e4ab086a60 (diff) | |
download | android-node-v8-d6bbb19f1d1d6397d862d09304bc63c476f675c1.tar.gz android-node-v8-d6bbb19f1d1d6397d862d09304bc63c476f675c1.tar.bz2 android-node-v8-d6bbb19f1d1d6397d862d09304bc63c476f675c1.zip |
http, https: don't depend on `globalAgent`
For the `request()` and `get()` functions. I could never
really understand why these two functions go through agent
first... Especially since the user could be passing `agent: false`
or a different Agent instance completely, in which `globalAgent`
will be completely bypassed.
Moved the relevant logic from `Agent#request()` into the
`ClientRequest` constructor.
Incidentally, this commit fixes #7012 (which was the original
intent of this commit).
Diffstat (limited to 'lib/http.js')
-rw-r--r-- | lib/http.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/http.js b/lib/http.js index 128bb0d2a4..db87b589b5 100644 --- a/lib/http.js +++ b/lib/http.js @@ -49,11 +49,13 @@ var client = require('_http_client'); var ClientRequest = exports.ClientRequest = client.ClientRequest; exports.request = function(options, cb) { - return globalAgent.request(options, cb); + return new ClientRequest(options, cb); }; exports.get = function(options, cb) { - return globalAgent.get(options, cb); + var req = exports.request(options, cb); + req.end(); + return req; }; exports._connectionListener = server._connectionListener; |