Skip to content

Possibility to respond to https requests without connecting upstream servers - #230

Closed
ganskef wants to merge 17 commits into
adamfisk:masterfrom
ganskef:enable_offline_caching_with_mitm
Closed

Possibility to respond to https requests without connecting upstream servers#230
ganskef wants to merge 17 commits into
adamfisk:masterfrom
ganskef:enable_offline_caching_with_mitm

Conversation

@ganskef

@ganskef ganskef commented Aug 2, 2015

Copy link
Copy Markdown
Collaborator

This enables a caching proxy for offline use, which is no problem with HTTP at the moment.

Additionally HTTPS needs the hostname to create a certificate and must suppress the handshake to upstream without a connection.

@jekh Please, let us discuss this.

This enables a caching proxy for offline use, which is no problem with
HTTP at the moment. Additionally HTTPS needs the hostname to create a
certificate and must suppress the handshake to upstream without a
connection.
@ganskef

ganskef commented Aug 2, 2015

Copy link
Copy Markdown
Collaborator Author

UnencryptedUDTChainedProxyTest fails in Travis-CI with Java 8, but works with Java 7 and 6. It works in my environment with Java 8, too:
$ java -version
java version "1.7.0_79"
OpenJDK Runtime Environment (IcedTea 2.5.6) (7u79-2.5.6-1~deb8u1)
OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)
$ /usr/lib/jvm/java-8-openjdk-amd64/bin/java -version
openjdk version "1.8.0_45-internal"
OpenJDK Runtime Environment (build 1.8.0_45-internal-b14)
OpenJDK 64-Bit Server VM (build 25.45-b02, mixed mode)
$ uname -sorv
Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u2 (2015-07-17) GNU/Linux

@jekh

jekh commented Aug 2, 2015

Copy link
Copy Markdown
Collaborator

I have some reservations about this change. It's very specific to one particular use case, a caching proxy for offline use.

I do see the utility of wanting to avoid making connections to the remote server. For non-SSL connections this is already possible using the filters, but for SSL connections it isn't, because the ConnectionFlow always attempts to establish the remote connection. In the long term, I'd like to see a more flexible way of controlling connections, so that users of LittleProxy can customize the connection flow as needed.

For now, I'm not sure that checking remoteAddress.isUnresolved() is the best way to indicate that we should suppress the connection to the remote server. It's overloading the use of the remoteAddress.isUnresolved() status for an unrelated purpose. Can you think of a better way to indicate in the connection flow that we should not connect to the upstream server? Perhaps it could be integrated into one of the return values of the filters?

ganskef and others added 10 commits November 28, 2015 21:04
Conflicts:
	src/main/java/org/littleshoot/proxy/impl/ProxyToServerConnection.java

Integrated with MITM while offline, removed unused variable
MINIMUM_RECV_BUFFER_SIZE_BYTES
Conflicts:
	src/main/java/org/littleshoot/proxy/impl/ProxyToServerConnection.java
Conflicts:
	src/main/java/org/littleshoot/proxy/impl/ProxyToServerConnection.java
Conflicts:
	src/main/java/org/littleshoot/proxy/impl/DefaultHttpProxyServer.java
	src/main/java/org/littleshoot/proxy/impl/ProxyToServerConnection.java
	src/test/java/org/littleshoot/proxy/MitmWithBadClientAuthenticationTCPChainedProxyTest.java
	src/test/java/org/littleshoot/proxy/MitmWithBadServerAuthenticationTCPChainedProxyTest.java
	src/test/java/org/littleshoot/proxy/MitmWithChainedProxyTest.java
	src/test/java/org/littleshoot/proxy/MitmWithClientAuthenticationNotRequiredTCPChainedProxyTest.java
	src/test/java/org/littleshoot/proxy/MitmWithEncryptedTCPChainedProxyTest.java
	src/test/java/org/littleshoot/proxy/MitmWithEncryptedUDTChainedProxyTest.java
	src/test/java/org/littleshoot/proxy/MitmWithUnencryptedTCPChainedProxyTest.java
	src/test/java/org/littleshoot/proxy/MitmWithUnencryptedUDTChainedProxyTest.java
Returning null is valid for this method. Decrease log level to info.
@ganskef ganskef mentioned this pull request Jan 13, 2016
@pledbrook

Copy link
Copy Markdown

For what it's worth, the Betamax testing library also has this requirement, as it works on the basis of replaying recorded responses in place of contacting the target server. I may try the options mentioned in #184 to see if they have an effect. I think this is going to become more and more important as websites default to SSL.

@ganskef

ganskef commented Mar 16, 2016

Copy link
Copy Markdown
Collaborator Author

@pledbrook You need special branches of LittleProxy and LittleProxy-mitm to enable MITM while offline. At the moment consider to use https://github.com/ganskef/LittleProxy-parent to build both.

I'm closing this PR since it's replaced with #282.

@ganskef ganskef closed this Mar 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants