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. diff --git a/src/main/java/org/littleshoot/proxy/impl/ProxyToServerConnection.java b/src/main/java/org/littleshoot/proxy/impl/ProxyToServerConnection.java index bb5e09d5e..4e54c6c4d 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 REMOTE_ADDRESS_ATTR_KEY = 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(REMOTE_ADDRESS_ATTR_KEY).set(remoteAddress); + // Remember our initial request so that we can write it after connecting this.initialRequest = initialRequest; initializeConnectionFlow();