From a3524c04fb3965c51076df436ffcb5f5e454e008 Mon Sep 17 00:00:00 2001 From: Slava Fomin Date: Mon, 19 Jun 2017 11:28:09 +0300 Subject: [PATCH 1/4] Adds remote address to client to proxy channel on proxy to server connection --- .../org/littleshoot/proxy/impl/ProxyToServerConnection.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/org/littleshoot/proxy/impl/ProxyToServerConnection.java b/src/main/java/org/littleshoot/proxy/impl/ProxyToServerConnection.java index bb5e09d5e..485523ede 100644 --- a/src/main/java/org/littleshoot/proxy/impl/ProxyToServerConnection.java +++ b/src/main/java/org/littleshoot/proxy/impl/ProxyToServerConnection.java @@ -29,6 +29,7 @@ import io.netty.handler.codec.http.LastHttpContent; import io.netty.handler.timeout.IdleStateHandler; import io.netty.handler.traffic.GlobalTrafficShapingHandler; +import io.netty.util.AttributeKey; import io.netty.util.ReferenceCounted; import io.netty.util.concurrent.Future; import io.netty.util.concurrent.GenericFutureListener; @@ -137,6 +138,8 @@ public class ProxyToServerConnection extends ProxyConnection { * Minimum size of the adaptive recv buffer when throttling is enabled. */ private static final int MINIMUM_RECV_BUFFER_SIZE_BYTES = 64; + + public static final AttributeKey remoteAddressAttrKey = AttributeKey.valueOf("remoteAddressAttrKey"); /** * Create a new ProxyToServerConnection. @@ -528,6 +531,8 @@ private void respondWith(HttpObject httpObject) { private void connectAndWrite(HttpRequest initialRequest) { LOG.debug("Starting new connection to: {}", remoteAddress); + this.clientConnection.channel.attr(remoteAddressAttrKey).set(remoteAddress); + // Remember our initial request so that we can write it after connecting this.initialRequest = initialRequest; initializeConnectionFlow(); From fb4afdaf7430f3d9233c097b0ed385567016185c Mon Sep 17 00:00:00 2001 From: Slava Fomin Date: Mon, 19 Jun 2017 11:29:05 +0300 Subject: [PATCH 2/4] Bumps up version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e895f4e6c..69eb55325 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ org.littleshoot littleproxy jar - 1.1.3.2-VGS-SNAPSHOT + 1.1.3.3-VGS-SNAPSHOT LittleProxy LittleProxy is a high performance HTTP proxy written in Java and using the Netty networking framework. From 12509ff6e17474f64601c0f109d588e657453bbc Mon Sep 17 00:00:00 2001 From: Slava Fomin Date: Tue, 20 Jun 2017 07:48:21 +0300 Subject: [PATCH 3/4] Renames remoteAddressAttrKey --- .../org/littleshoot/proxy/impl/ProxyToServerConnection.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/littleshoot/proxy/impl/ProxyToServerConnection.java b/src/main/java/org/littleshoot/proxy/impl/ProxyToServerConnection.java index 485523ede..4d5e40ab3 100644 --- a/src/main/java/org/littleshoot/proxy/impl/ProxyToServerConnection.java +++ b/src/main/java/org/littleshoot/proxy/impl/ProxyToServerConnection.java @@ -139,7 +139,7 @@ public class ProxyToServerConnection extends ProxyConnection { */ private static final int MINIMUM_RECV_BUFFER_SIZE_BYTES = 64; - public static final AttributeKey remoteAddressAttrKey = AttributeKey.valueOf("remoteAddressAttrKey"); + public static final AttributeKey REMOTE_ADDRESS_ATTR_KEY = AttributeKey.valueOf("REMOTE_ADDRESS_ATTR_KEY"); /** * Create a new ProxyToServerConnection. @@ -531,7 +531,7 @@ private void respondWith(HttpObject httpObject) { private void connectAndWrite(HttpRequest initialRequest) { LOG.debug("Starting new connection to: {}", remoteAddress); - this.clientConnection.channel.attr(remoteAddressAttrKey).set(remoteAddress); + this.clientConnection.channel.attr(REMOTE_ADDRESS_ATTR_KEY).set(remoteAddress); // Remember our initial request so that we can write it after connecting this.initialRequest = initialRequest; From 4924c6ef59ea96c932da9acb7715564f95331a37 Mon Sep 17 00:00:00 2001 From: Slava Fomin Date: Tue, 20 Jun 2017 08:14:20 +0300 Subject: [PATCH 4/4] Camel case remote address att key vaule --- .../org/littleshoot/proxy/impl/ProxyToServerConnection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/littleshoot/proxy/impl/ProxyToServerConnection.java b/src/main/java/org/littleshoot/proxy/impl/ProxyToServerConnection.java index 4d5e40ab3..4e54c6c4d 100644 --- a/src/main/java/org/littleshoot/proxy/impl/ProxyToServerConnection.java +++ b/src/main/java/org/littleshoot/proxy/impl/ProxyToServerConnection.java @@ -139,7 +139,7 @@ public class ProxyToServerConnection extends ProxyConnection { */ private static final int MINIMUM_RECV_BUFFER_SIZE_BYTES = 64; - public static final AttributeKey REMOTE_ADDRESS_ATTR_KEY = AttributeKey.valueOf("REMOTE_ADDRESS_ATTR_KEY"); + public static final AttributeKey REMOTE_ADDRESS_ATTR_KEY = AttributeKey.valueOf("remoteAddressAttrKey"); /** * Create a new ProxyToServerConnection.