Socket
Socket
Sign inDemoInstall

http-proxy

Package Overview
Dependencies
Maintainers
4
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-proxy - npm Package Compare versions

Comparing version 1.15.1 to 1.15.2

34

lib/http-proxy.js

@@ -1,10 +0,4 @@

var http = require('http'),
https = require('https'),
url = require('url'),
httpProxy = require('./http-proxy/');
// Use explicit /index.js to help browserify negociation in require '/lib/http-proxy' (!)
var ProxyServer = require('./http-proxy/index.js').Server;
/**
* Export the proxy "Server" as the main export.
*/
module.exports = httpProxy.Server;

@@ -26,5 +20,4 @@ /**

module.exports.createProxyServer =
module.exports.createServer =
module.exports.createProxy = function createProxyServer(options) {
function createProxyServer(options) {
/*

@@ -46,3 +39,3 @@ * `options` is needed and it must have the following layout:

* changeOrigin: <true/false, Default: false - changes the origin of the host header to the target URL>
* auth : Basic authentication i.e. 'user:password' to compute an Authorization header.
* auth : Basic authentication i.e. 'user:password' to compute an Authorization header.
* hostRewrite: rewrites the location hostname on (301/302/307/308) redirects, Default: null.

@@ -59,4 +52,17 @@ * autoRewrite: rewrites the location host/port on (301/302/307/308) redirects based on requested host/port. Default: false.

return new httpProxy.Server(options);
};
return new ProxyServer(options);
}
ProxyServer.createProxyServer = createProxyServer;
ProxyServer.createServer = createProxyServer;
ProxyServer.createProxy = createProxyServer;
/**
* Export the proxy "Server" as the main export.
*/
module.exports = ProxyServer;
var http = require('http'),
https = require('https'),
web_o = require('./web-outgoing'),
common = require('../common'),
passes = exports;
common = require('../common');

@@ -19,4 +18,5 @@ web_o = Object.keys(web_o).map(function(pass) {

[ // <--
module.exports = {
/**

@@ -32,3 +32,3 @@ * Sets `content-length` to '0' if request is of DELETE type.

function deleteLength(req, res, options) {
deleteLength: function deleteLength(req, res, options) {
if((req.method === 'DELETE' || req.method === 'OPTIONS')

@@ -51,3 +51,3 @@ && !req.headers['content-length']) {

function timeout(req, res, options) {
timeout: function timeout(req, res, options) {
if(options.timeout) {

@@ -68,3 +68,3 @@ req.socket.setTimeout(options.timeout);

function XHeaders(req, res, options) {
XHeaders: function XHeaders(req, res, options) {
if(!options.xfwd) return;

@@ -101,3 +101,3 @@

function stream(req, res, options, _, server, clb) {
stream: function stream(req, res, options, _, server, clb) {

@@ -176,5 +176,2 @@ // And we begin!

] // <--
.forEach(function(func) {
passes[func.name] = func;
});
};
var url = require('url'),
common = require('../common'),
passes = exports;
common = require('../common');
var redirectRegex = /^201|30(1|2|7|8)$/;

@@ -15,3 +15,3 @@

[ // <--
module.exports = { // <--

@@ -27,3 +27,3 @@ /**

*/
function removeChunked(req, res, proxyRes) {
removeChunked: function removeChunked(req, res, proxyRes) {
if (req.httpVersion === '1.0') {

@@ -44,6 +44,6 @@ delete proxyRes.headers['transfer-encoding'];

*/
function setConnection(req, res, proxyRes) {
setConnection: function setConnection(req, res, proxyRes) {
if (req.httpVersion === '1.0') {
proxyRes.headers.connection = req.headers.connection || 'close';
} else if (!proxyRes.headers.connection) {
} else if (req.httpVersion !== '2.0' && !proxyRes.headers.connection) {
proxyRes.headers.connection = req.headers.connection || 'keep-alive';

@@ -53,3 +53,3 @@ }

function setRedirectHostRewrite(req, res, proxyRes, options) {
setRedirectHostRewrite: function setRedirectHostRewrite(req, res, proxyRes, options) {
if ((options.hostRewrite || options.autoRewrite || options.protocolRewrite)

@@ -89,3 +89,3 @@ && proxyRes.headers['location']

*/
function writeHeaders(req, res, proxyRes, options) {
writeHeaders: function writeHeaders(req, res, proxyRes, options) {
var rewriteCookieDomainConfig = options.cookieDomainRewrite;

@@ -115,3 +115,3 @@ if (typeof rewriteCookieDomainConfig === 'string') { //also test for ''

*/
function writeStatusCode(req, res, proxyRes) {
writeStatusCode: function writeStatusCode(req, res, proxyRes) {
// From Node.js docs: response.writeHead(statusCode[, statusMessage][, headers])

@@ -125,5 +125,2 @@ if(proxyRes.statusMessage) {

] // <--
.forEach(function(func) {
passes[func.name] = func;
});
};
var http = require('http'),
https = require('https'),
common = require('../common'),
passes = exports;
common = require('../common');

@@ -19,5 +18,4 @@ /*!

var passes = exports;
[
module.exports = {
/**

@@ -33,3 +31,3 @@ * WebSocket requests must have the `GET` method and

function checkMethodAndHeader (req, socket) {
checkMethodAndHeader : function checkMethodAndHeader(req, socket) {
if (req.method !== 'GET' || !req.headers.upgrade) {

@@ -56,3 +54,3 @@ socket.destroy();

function XHeaders(req, socket, options) {
XHeaders : function XHeaders(req, socket, options) {
if(!options.xfwd) return;

@@ -84,3 +82,3 @@

*/
function stream(req, socket, options, head, server, clb) {
stream : function stream(req, socket, options, head, server, clb) {
common.setupSocket(socket);

@@ -162,6 +160,2 @@

}
] // <--
.forEach(function(func) {
passes[func.name] = func;
});
};
{
"name": "http-proxy",
"version": "1.15.1",
"version": "1.15.2",
"repository": {

@@ -5,0 +5,0 @@ "type": "git",

@@ -353,2 +353,3 @@ <p align="center">

* **headers**: object with extra headers to be added to target requests.
* **proxyTimeout**: timeout (in millis) when proxy receives no response from target

@@ -355,0 +356,0 @@ **NOTE:**

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc