-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement HTTP proxy CONNECT with ALPN #2699
Merged
idelpivnitskiy
merged 5 commits into
apple:main
from
idelpivnitskiy:proxy-connect-with-alpn
Sep 29, 2023
Merged
Implement HTTP proxy CONNECT with ALPN #2699
idelpivnitskiy
merged 5 commits into
apple:main
from
idelpivnitskiy:proxy-connect-with-alpn
Sep 29, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
daschl
approved these changes
Sep 19, 2023
idelpivnitskiy
force-pushed
the
proxy-connect-with-alpn
branch
from
September 25, 2023 19:39
499d011
to
ae97ff0
Compare
idelpivnitskiy
force-pushed
the
proxy-connect-with-alpn
branch
from
September 28, 2023 21:02
5d79d9e
to
106f3fb
Compare
daschl
approved these changes
Sep 29, 2023
idelpivnitskiy
force-pushed
the
proxy-connect-with-alpn
branch
from
September 29, 2023 17:56
6f65ce6
to
70be0c1
Compare
idelpivnitskiy
added a commit
to idelpivnitskiy/servicetalk
that referenced
this pull request
Sep 29, 2023
Motivation: After apple#2699 implemented HTTP proxy CONNECT with ALPN, it made observability confusing. It broke the contract that only one `connectionEstablished` method can be invoked, which happens when ALPN switches from HTTP/1.1 to HTTP/2 pipeline. Also, for a proxy tunnel with HTTP/1.1 `ConnectionObserver` events were always confusing: users had to wait for `handshakeComplete` after `connectionEstablished` to report that the connection is "ready". Modifications: - Add `ConnectionObserver.ProxyConnectObserver` that reports events related to `CONNECT` phase that starts right after `onTransportHandshakeComplete`; - Refactor `PipelinedLBHttpConnectionFactory` to defer invocation of `connectionEstablished`/`multiplexedConnectionEstablished` until after the handshake is complete to make it consistent with non-proxied connections and make sure only one of the "established" methods is invoked; - Removed `ProxyConnectLBHttpConnectionFactoryTest` because it targeted code paths that do not exist anymore. Instead, enhanced `HttpsProxyTest` to cover similar use-cases. - Enhanced `ProxyTunnel` to allow behavior customization; Result: Enhanced observability for proxy tunnels, `ConnectionObserver` behavior is consistent between proxied and non-proxied use-cases.
idelpivnitskiy
added a commit
that referenced
this pull request
Sep 29, 2023
Motivation: After #2699 implemented HTTP proxy CONNECT with ALPN, it made observability confusing. It broke the contract that only one `connectionEstablished` method can be invoked, which happens when ALPN switches from HTTP/1.1 to HTTP/2 pipeline. Also, for a proxy tunnel with HTTP/1.1 `ConnectionObserver` events were always confusing: users had to wait for `handshakeComplete` after `connectionEstablished` to report that the connection is "ready". Modifications: - Add `ConnectionObserver.ProxyConnectObserver` that reports events related to `CONNECT` phase that starts right after `onTransportHandshakeComplete`; - Refactor `PipelinedLBHttpConnectionFactory` to defer invocation of `connectionEstablished`/`multiplexedConnectionEstablished` until after the handshake is complete to make it consistent with non-proxied connections and make sure only one of the "established" methods is invoked; - Removed `ProxyConnectLBHttpConnectionFactoryTest` because it targeted code paths that do not exist anymore. Instead, enhanced `HttpsProxyTest` to cover similar use-cases. - Enhanced `ProxyTunnel` to allow behavior customization; Result: Enhanced observability for proxy tunnels, `ConnectionObserver` behavior is consistent between proxied and non-proxied use-cases.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation:
Proxies that behave like blind forwarding tunnel do not care what protocol will be
used after the tunnel is established. Because we always enforce TLS for such tunnels,
we can rely on ALPN to negotiate expected protocol after the tunnel is established.
This will allow gRPC use cases to operate via tunneling proxies.
Modifications:
ProxyConnectLBHttpConnectionFactory
to take ALPN results into accountbefore finishing connection initialization;
HttpsProxyTest
to validate proxy tunnel works for any combination of theconfigured protocols;
ProxyConnectLBHttpConnectionFactory
to validate new use-cases;GrpcProxyTunnelTest
;Results:
Depends on #2697, review only starting from "Implement HTTP proxy CONNECT with ALPN" commit.