-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
) Motivation: Currently, HTTP proxy `CONNECT` logic is prepended before user-defined `ConnectionFactoryFilter`s. Because user filters can wrap `FilterableStreamingHttpConnection`: 1. It makes it hard to upgrade the connection if ALPN agrees on a different protocol. 2. `ProxyConnectConnectionFactoryFilter` can not access Netty's `Channel` to trigger TLS handshake. Modifications: - Create `ProxyConnectLBHttpConnectionFactory` as an alternative to `PipelinedLBHttpConnectionFactory` that makes HTTP proxy `CONNECT` request after `PipelinedStreamingHttpConnection` is created; - Keep `ProxyConnectConnectionFactoryFilter` only for the purpose of propagating `HTTP_TARGET_ADDRESS_BEHIND_PROXY` key upstream; - Add internal `NettyFilterableStreamingHttpConnection` to get access to Netty `Channel` without type cast; - Enhance `StacklessClosedChannelException` to carry a message; - Rename `ProxyConnectConnectionFactoryFilterTest` to `ProxyConnectLBHttpConnectionFactoryTest`, adjust for testing `processConnect` method; Result: 1. No need to worry that HTTP CONNECT won't work if users wrapped `FilterableStreamingHttpConnection` in their `ConnectionFactoryFilter`s. 2. Makes it possible to change protocol based on ALPN (will be done in follow-up PRs). Behavior change: - Because user-defined `ConnectionFactoryFilter`s can not intercept HTTP `CONNECT` requests anymore, they lose ability to alter the request (for example, to set auth or debug headers). Follow-up PRs will add new API to let users intercept such requests.
- Loading branch information
1 parent
df33744
commit 07a41d5
Showing
11 changed files
with
440 additions
and
247 deletions.
There are no files selected for viewing
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
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
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
33 changes: 33 additions & 0 deletions
33
...netty/src/main/java/io/servicetalk/http/netty/NettyFilterableStreamingHttpConnection.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright © 2023 Apple Inc. and the ServiceTalk project authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.servicetalk.http.netty; | ||
|
||
import io.servicetalk.http.api.FilterableStreamingHttpConnection; | ||
|
||
import io.netty.channel.Channel; | ||
|
||
/** | ||
* {@link FilterableStreamingHttpConnection} that also gives access to Netty {@link Channel}. | ||
*/ | ||
interface NettyFilterableStreamingHttpConnection extends FilterableStreamingHttpConnection { | ||
|
||
/** | ||
* Return the Netty {@link Channel} backing this connection. | ||
* | ||
* @return the Netty {@link Channel} backing this connection. | ||
*/ | ||
Channel nettyChannel(); | ||
} |
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
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
Oops, something went wrong.