proxying-agent
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -46,2 +46,19 @@ 'use strict'; | ||
/** | ||
* Get absolutURI without port when using default | ||
*/ | ||
ProxyingAgent.prototype.getAbsoluteURI = function(ssl, host, port, path) { | ||
var absoluteUri = (ssl ? 'https://' : 'http://') + host; | ||
if (typeof port === 'string') { | ||
// Check if target url have specified port and add it to absoluteUri | ||
// When port is defined in target url then we get it as a string otherwise it's a number | ||
absoluteUri += ':' + port; | ||
} | ||
absoluteUri += path; | ||
return absoluteUri; | ||
}; | ||
/** | ||
* Overrides the 'addRequest' Agent method for establishing a socket with the proxy | ||
@@ -138,4 +155,3 @@ * that will e used to issue the actual request | ||
// issue a regular proxy request | ||
var protocol = this.options.ssl ? 'https://' : 'http://'; | ||
req.path = protocol+host+':'+port+req.path; | ||
req.path = this.getAbsoluteURI(this.options.ssl, host, port, req.path); | ||
if (this.authHeader) { | ||
@@ -155,3 +171,3 @@ req.setHeader(this.authHeader.header, this.authHeader.value); | ||
ntlmOptions.method = ntlmOptions.method || 'GET'; // just for the NTLM handshake | ||
ntlmOptions.path = (this.options.ssl ? 'https://' : 'http://')+host+':'+port+req.path | ||
ntlmOptions.path = this.getAbsoluteURI(this.options.ssl, host, port, req.path); | ||
ntlmOptions.ntlm.workstation = ntlmOptions.ntlm.workstation || require('os').hostname(); | ||
@@ -158,0 +174,0 @@ |
{ | ||
"name": "proxying-agent", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Node HTTP/HTTPS Forward Proxy Agent", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -1,3 +0,6 @@ | ||
# Node HTTP/HTTPS Forward Proxy Agent | ||
<div align="center"><img src="https://capriza.github.io/images/logos/logos-bird.svg" height="128" /></div> | ||
Node HTTP/HTTPS Forward Proxy Agent | ||
=== | ||
This a Node http agent capable of forward proxying HTTP/HTTPS requests. | ||
@@ -4,0 +7,0 @@ |
34221
662
106