From b9574b995fb48219d8f4e1641f8730e10f2c9f3c Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Fri, 21 Jan 2011 13:47:27 -0800 Subject: [PATCH] Expose http.getAgent --- doc/api/http.markdown | 3 ++- lib/http.js | 1 + lib/https.js | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/api/http.markdown b/doc/api/http.markdown index e818582..b21314b 100644 --- a/doc/api/http.markdown +++ b/doc/api/http.markdown @@ -394,11 +394,12 @@ Example: ## http.Agent +## http.getAgent(host, port) `http.request()` uses a special `Agent` for managing multiple connections to an HTTP server. Normally `Agent` instances should not be exposed to user code, however in certain situations it's useful to check the status of the -agent. +agent. The `http.getAgent()` function allows you to access the agents. ### Event: 'upgrade' diff --git a/lib/http.js b/lib/http.js index 6e4a066..17b8f00 100644 --- a/lib/http.js +++ b/lib/http.js @@ -1148,6 +1148,7 @@ function getAgent(host, port) { return agent; } +exports.getAgent = getAgent; exports._requestFromAgent = function(agent, options, cb) { diff --git a/lib/https.js b/lib/https.js index aaa070a..1b161e6 100644 --- a/lib/https.js +++ b/lib/https.js @@ -55,6 +55,7 @@ function getAgent(options) { return agent; } +exports.getAgent = getAgent; exports.request = function(options, cb) { -- 2.7.4