Date: Mon, 4 Jul 2016 18:52:09 +0300
Subject: [PATCH 2/7] comments
---
.../java/org/littleshoot/proxy/ChainedProxy.java | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/main/java/org/littleshoot/proxy/ChainedProxy.java b/src/main/java/org/littleshoot/proxy/ChainedProxy.java
index 82f514fdd..57f9b59b8 100644
--- a/src/main/java/org/littleshoot/proxy/ChainedProxy.java
+++ b/src/main/java/org/littleshoot/proxy/ChainedProxy.java
@@ -7,6 +7,8 @@
import java.net.InetSocketAddress;
+import javax.net.ssl.SSLEngine;
+
/**
*
* Encapsulates information needed to connect to a chained proxy.
@@ -52,8 +54,22 @@ public interface ChainedProxy extends SslEngineSource {
*/
boolean requiresEncryption();
+ /**
+ * Implement this method to tell LittleProxy whether or not to use custom ConnectionFlow
+ * to the chained proxy for the given request. If true,
+ * LittleProxy will call {@link ChainedProxy#customConnectionFlow(ProxyConnection)} to obtain a
+ * ConnectionFlow.
+ *
+ * @return true of the connection to the chained proxy should be used a custom ConnectionFlow
+ */
boolean requiresCustomConnectionFlow();
+ /**
+ * Returns an {@link ConnectionFlowStep} to use for a server connection from
+ * LittleProxy to the client.
+ *
+ * @return
+ */
ConnectionFlowStep customConnectionFlow(ProxyConnection connection);
/**
From 07f58ef6718b8cee59cb8eaf837108db120fd600 Mon Sep 17 00:00:00 2001
From: AlmogBaku
Date: Tue, 5 Jul 2016 09:41:30 +0300
Subject: [PATCH 3/7] specify changes
---
src/main/java/org/littleshoot/proxy/ChainedProxy.java | 8 ++++----
.../java/org/littleshoot/proxy/ChainedProxyAdapter.java | 6 ++++--
.../java/org/littleshoot/proxy/impl/ConnectionFlow.java | 3 +++
.../org/littleshoot/proxy/impl/ConnectionFlowStep.java | 2 ++
.../java/org/littleshoot/proxy/impl/ConnectionState.java | 1 +
.../java/org/littleshoot/proxy/impl/ProxyConnection.java | 2 ++
.../littleshoot/proxy/impl/ProxyToServerConnection.java | 3 +--
7 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/src/main/java/org/littleshoot/proxy/ChainedProxy.java b/src/main/java/org/littleshoot/proxy/ChainedProxy.java
index 57f9b59b8..97caa7aa8 100644
--- a/src/main/java/org/littleshoot/proxy/ChainedProxy.java
+++ b/src/main/java/org/littleshoot/proxy/ChainedProxy.java
@@ -1,14 +1,12 @@
package org.littleshoot.proxy;
-import org.littleshoot.proxy.impl.ConnectionFlowStep;
-import org.littleshoot.proxy.impl.ProxyConnection;
+import org.littleshoot.proxy.impl.ConnectionFlowStep; //Change: @AlmogBaku
+import org.littleshoot.proxy.impl.ProxyConnection; //Change: @AlmogBaku
import io.netty.handler.codec.http.HttpObject;
import java.net.InetSocketAddress;
-import javax.net.ssl.SSLEngine;
-
/**
*
* Encapsulates information needed to connect to a chained proxy.
@@ -55,6 +53,7 @@ public interface ChainedProxy extends SslEngineSource {
boolean requiresEncryption();
/**
+ * //Change: @AlmogBaku
* Implement this method to tell LittleProxy whether or not to use custom ConnectionFlow
* to the chained proxy for the given request. If true,
* LittleProxy will call {@link ChainedProxy#customConnectionFlow(ProxyConnection)} to obtain a
@@ -65,6 +64,7 @@ public interface ChainedProxy extends SslEngineSource {
boolean requiresCustomConnectionFlow();
/**
+ * //Change: @AlmogBaku
* Returns an {@link ConnectionFlowStep} to use for a server connection from
* LittleProxy to the client.
*
diff --git a/src/main/java/org/littleshoot/proxy/ChainedProxyAdapter.java b/src/main/java/org/littleshoot/proxy/ChainedProxyAdapter.java
index 7b80abdde..0eca7370c 100644
--- a/src/main/java/org/littleshoot/proxy/ChainedProxyAdapter.java
+++ b/src/main/java/org/littleshoot/proxy/ChainedProxyAdapter.java
@@ -1,7 +1,7 @@
package org.littleshoot.proxy;
-import org.littleshoot.proxy.impl.ConnectionFlowStep;
-import org.littleshoot.proxy.impl.ProxyConnection;
+import org.littleshoot.proxy.impl.ConnectionFlowStep;//Change: @AlmogBaku
+import org.littleshoot.proxy.impl.ProxyConnection;//Change: @AlmogBaku
import io.netty.handler.codec.http.HttpObject;
@@ -39,11 +39,13 @@ public boolean requiresEncryption() {
return false;
}
+ //Change: @AlmogBaku
@Override
public boolean requiresCustomConnectionFlow() {
return false;
}
+ //Change: @AlmogBaku
@Override
public ConnectionFlowStep customConnectionFlow(ProxyConnection connection) {
return null;
diff --git a/src/main/java/org/littleshoot/proxy/impl/ConnectionFlow.java b/src/main/java/org/littleshoot/proxy/impl/ConnectionFlow.java
index fe9f89976..8975bfd70 100644
--- a/src/main/java/org/littleshoot/proxy/impl/ConnectionFlow.java
+++ b/src/main/java/org/littleshoot/proxy/impl/ConnectionFlow.java
@@ -11,6 +11,7 @@
* establishing a socket connection, SSL handshaking, HTTP CONNECT request
* processing, and so on.
*/
+//Change(expose to public): @AlmogBaku
public class ConnectionFlow {
private Queue steps = new ConcurrentLinkedQueue();
@@ -77,6 +78,7 @@ void start() {
}
/**
+ * //Change(expose to public): @AlmogBaku
*
* Advances the flow. {@link #advance()} will be called until we're either
* out of steps, or a step has failed.
@@ -202,6 +204,7 @@ public void operationComplete(Future future)
}
/**
+ * //Change(expose to public): @AlmogBaku
* Like {@link #fail(Throwable)} but with no cause.
*/
public void fail() {
diff --git a/src/main/java/org/littleshoot/proxy/impl/ConnectionFlowStep.java b/src/main/java/org/littleshoot/proxy/impl/ConnectionFlowStep.java
index bdb8ba25b..043d6e885 100644
--- a/src/main/java/org/littleshoot/proxy/impl/ConnectionFlowStep.java
+++ b/src/main/java/org/littleshoot/proxy/impl/ConnectionFlowStep.java
@@ -3,6 +3,7 @@
import io.netty.util.concurrent.Future;
/**
+ * //Change(expose to public): @AlmogBaku
* Represents a phase in a {@link ConnectionFlow}.
*/
public abstract class ConnectionFlowStep {
@@ -11,6 +12,7 @@ public abstract class ConnectionFlowStep {
private final ConnectionState state;
/**
+ * //Change(expose to protected): @AlmogBaku
* Construct a new step in a connection flow.
*
* @param connection
diff --git a/src/main/java/org/littleshoot/proxy/impl/ConnectionState.java b/src/main/java/org/littleshoot/proxy/impl/ConnectionState.java
index 919ea01b0..f3598c7f6 100644
--- a/src/main/java/org/littleshoot/proxy/impl/ConnectionState.java
+++ b/src/main/java/org/littleshoot/proxy/impl/ConnectionState.java
@@ -1,5 +1,6 @@
package org.littleshoot.proxy.impl;
+//Change(expose to public): @AlmogBaku
public enum ConnectionState {
/**
* Connection attempting to connect.
diff --git a/src/main/java/org/littleshoot/proxy/impl/ProxyConnection.java b/src/main/java/org/littleshoot/proxy/impl/ProxyConnection.java
index 4cd681427..b3db3c7dd 100644
--- a/src/main/java/org/littleshoot/proxy/impl/ProxyConnection.java
+++ b/src/main/java/org/littleshoot/proxy/impl/ProxyConnection.java
@@ -60,6 +60,7 @@
* the type of "initial" message. This will be either
* {@link HttpResponse} or {@link HttpRequest}.
*/
+//Change(expose to public): @AlmogBaku
public abstract class ProxyConnection extends
SimpleChannelInboundHandler