diff --git a/docs/node-http-proxy.html b/docs/node-http-proxy.html index bd2fb82..fbcc8b1 100644 --- a/docs/node-http-proxy.html +++ b/docs/node-http-proxy.html @@ -30,29 +30,29 @@ events = require('events'), winston = require('winston'), ProxyTable = require('./proxy-table').ProxyTable, - maxSockets = 100;

function _getAgent (host, port)

+ maxSockets = 100;

Version 0.4.0

exports.version = [0, 4, 0];

function _getAgent (host, port)

@host {string} Host of the agent to get

@port {number} Port of the agent to get

Retreives an agent from the http module -and sets the maxSockets property appropriately.

function _getAgent (host, port) {

TODO (indexzero): Make this configurable for http / https

  var agent = http.getAgent(host, port);
+and sets the maxSockets property appropriately.

function _getAgent (host, port) {

TODO (indexzero): Make this configurable for http / https

  var agent = http.getAgent(host, port);
   agent.maxSockets = maxSockets;
   return agent;
-}

function getMaxSockets ()

+}

function getMaxSockets ()

Returns the maximum number of sockets allowed on every outgoing request made by all instances of HttpProxy

exports.getMaxSockets = function () {
   return maxSockets;
-};

function setMaxSockets ()

+};

function setMaxSockets ()

Sets the maximum number of sockets allowed on every outgoing request made by all instances of HttpProxy

exports.setMaxSockets = function (value) {
   maxSockets = value;
-};

function createServer ([port, host, options, handler])

+};

function createServer ([port, host, options, handler])

@port {number} Optional Port to use on the proxy target host.

@@ -89,7 +89,7 @@ made by all instances of HttpProxy

proxy = new HttpProxy(options); server = http.createServer(function (req, res) { - winston.verbose('Incoming HTTP request to: ' + req.headers.host + req.url);

If we were passed a callback to process the request + winston.verbose('Incoming HTTP request to: ' + req.headers.host + req.url);

If we were passed a callback to process the request or response in some way, then call it.

    if (callback) {
       callback(req, res, proxy);
     } 
@@ -114,14 +114,14 @@ or response in some way, then call it.

server.emit('routes', routes); }); - if (!callback) {

WebSocket support: if callback is empty tunnel -websocket request automatically

    server.on('upgrade', function(req, socket, head) {

Tunnel websocket requests too

      
+  if (!callback) {

WebSocket support: if callback is empty tunnel +websocket request automatically

    server.on('upgrade', function(req, socket, head) {

Tunnel websocket requests too

      
       proxy.proxyWebSocketRequest(port, host);
     });
   }
 
   return server;
-};

function HttpProxy (options)

+};

function HttpProxy (options)

@options {Object} Options for this instance.

@@ -153,7 +153,7 @@ for managing the life-cycle of streaming reverse proxyied HTTP requests.

self.emit('routes', routes); }); } -};

Inherit from events.EventEmitter

util.inherits(HttpProxy, events.EventEmitter);

function buffer (obj)

+};

Inherit from events.EventEmitter

util.inherits(HttpProxy, events.EventEmitter);

function buffer (obj)

@obj {Object} Object to pause events from

@@ -196,12 +196,12 @@ This simply chooses to manage the scope of the events on a new Object literal a } } }; -};

function close ()

+};

function close ()

Frees the resources associated with this instance, if they exist.

HttpProxy.prototype.close = function () {
   if (this.proxyTable) this.proxyTable.close();
-};

function proxyRequest (req, res, [port, host, paused])

+};

function proxyRequest (req, res, [port, host, paused])

@req {ServerRequest} Incoming HTTP Request to proxy.

@@ -212,18 +212,18 @@ if they exist.

@host {string} Optional Host of the proxy target.

@buffer {Object} Optional Result from httpProxy.buffer(req)

HttpProxy.prototype.proxyRequest = function (req, res, port, host, buffer) {
-  var self = this, reverseProxy, location, errState = false;
-  

Check the proxy table for this instance to see if we need + var self = this, reverseProxy, location, errState = false, opts; +

Check the proxy table for this instance to see if we need to get the proxy location for the request supplied. We will always ignore the proxyTable if an explicit port and host arguments are supplied to proxyRequest.

  if (this.proxyTable && !host) {
     location = this.proxyTable.getProxyLocation(req);
-    

If no location is returned from the ProxyTable instance +

If no location is returned from the ProxyTable instance then respond with 404 since we do not have a valid proxy target.

    if (!location) {
       res.writeHead(404);
       return res.end();
     }
-    

When using the ProxyTable in conjunction with an HttpProxy instance +

When using the ProxyTable in conjunction with an HttpProxy instance only the following arguments are valid: