Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

http-proxy

Package Overview
Dependencies
Maintainers
3
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 0.7.3 to 0.7.4

examples/middleware/modifyResponse-middleware.js

10

lib/node-http-proxy/http-proxy.js

@@ -227,2 +227,3 @@ /*

//
var paused = false;
response.on('data', function (chunk) {

@@ -242,5 +243,7 @@ if (req.method !== 'HEAD' && res.writable) {

if (!flushed) {
if (!flushed && !paused) {
paused = true;
response.pause();
res.once('drain', function () {
paused = false;
try { response.resume() }

@@ -268,3 +271,8 @@ catch (er) { console.error("response.resume error: %s", er.message) }

//
var ended = false
response.on('close', function () {
if(!ended) response.emit('end')
})
response.on('end', function () {
ended = true
if (!errState) {

@@ -271,0 +279,0 @@ reverseProxy.removeListener('error', proxyError);

20

lib/node-http-proxy/proxy-table.js

@@ -104,3 +104,4 @@ /*

route: route,
target: router[path]
target: router[path],
path: path
});

@@ -138,6 +139,15 @@ });

for (var i in this.routes) {
var route = this.routes[i],
match;
if (match = target.match(route.route)) {
var route = this.routes[i];
if (target.match(route.route)) {
var segments = route.path.split('/');
if (segments.length > 0) {
var lastSegment = new RegExp("/" + segments[segments.length - 1] + "$");
if(req.url.match(lastSegment)) {
req.url = req.url.replace(lastSegment, '/');
}
}
var location = route.target.split(':'),

@@ -144,0 +154,0 @@ host = location[0],

{
"name": "http-proxy",
"version": "0.7.3",
"version": "0.7.4",
"description": "A full-featured http reverse proxy for node.js",

@@ -5,0 +5,0 @@ "author": "Charlie Robbins <charlie.robbins@gmail.com>",

@@ -361,3 +361,3 @@ # node-http-proxy

By default, `node-http-proxy` will set a 100 socket limit for all `host:port` proxy targets. If you wish to change this you can two it in two ways:
By default, `node-http-proxy` will set a 100 socket limit for all `host:port` proxy targets. You can change this in two ways:

@@ -364,0 +364,0 @@ 1. By passing the `maxSockets` option to `httpProxy.createServer()`

@@ -58,6 +58,8 @@ /*

TestRunner.prototype.assertProxied = function (host, proxyPort, port, createProxy) {
TestRunner.prototype.assertProxied = function (host, proxyPort, port, requestPath, targetPath, createProxy) {
if (!targetPath) targetPath = "";
var self = this,
assertion = "should receive 'hello " + host + "'",
output = 'hello ' + host;
output = "hello " + host + targetPath,
assertion = "should receive '" + output + "'";

@@ -77,2 +79,3 @@ var test = {

if (requestPath) options.uri += requestPath;

@@ -85,3 +88,2 @@ function startTest () {

}
request(options, this.callback);

@@ -88,0 +90,0 @@ }

@@ -54,3 +54,3 @@ /*

"with no latency" : {
"and a valid target server": runner.assertProxied('localhost', 8080, 8081, function (callback) {
"and a valid target server": runner.assertProxied('localhost', 8080, 8081, false, false, function (callback) {
runner.startProxyServer(8080, 8081, 'localhost', callback);

@@ -63,3 +63,3 @@ }),

"with latency": {
"and a valid target server": runner.assertProxied('localhost', 8083, 8084, function (callback) {
"and a valid target server": runner.assertProxied('localhost', 8083, 8084, false, false, function (callback) {
runner.startLatentProxyServer(8083, 8084, 'localhost', 1000, callback);

@@ -76,3 +76,3 @@ }),

"with no latency" : {
"and a valid target server": runner.assertProxied('localhost', 8120, 8121, function (callback) {
"and a valid target server": runner.assertProxied('localhost', 8120, 8121, false, false, function (callback) {
runner.startProxyServerWithForwarding(8120, 8121, 'localhost', forwardOptions, callback);

@@ -83,3 +83,3 @@ }),

}),
"and without a valid forward server": runner.assertProxied('localhost', 8124, 8125, function (callback) {
"and without a valid forward server": runner.assertProxied('localhost', 8124, 8125, false, false, function (callback) {
runner.startProxyServerWithForwarding(8124, 8125, 'localhost', badForwardOptions, callback);

@@ -86,0 +86,0 @@ })

@@ -32,3 +32,5 @@ /*

"foo.com": "127.0.0.1:8091",
"bar.com": "127.0.0.1:8092"
"bar.com": "127.0.0.1:8092",
"baz.com/taco": "127.0.0.1:8098",
"pizza.com/taco/muffins": "127.0.0.1:8099",
}

@@ -54,2 +56,4 @@ };

"an incoming request to bar.com": runner.assertProxied('bar.com', 8090, 8092),
"an incoming request to baz.com/taco": runner.assertProxied('baz.com', 8090, 8098, "/taco", "/"),
"an incoming request to pizza.com/taco/muffins": runner.assertProxied('pizza.com', 8090, 8099, "/taco/muffins", "/taco"),
"an incoming request to unknown.com": runner.assertResponseCode(8090, 404)

@@ -56,0 +60,0 @@ },

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc