Skip to content
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

Introduce carriers for HttpClient transports #6109

Closed
sbordet opened this issue Mar 26, 2021 · 1 comment
Closed

Introduce carriers for HttpClient transports #6109

sbordet opened this issue Mar 26, 2021 · 1 comment
Assignees

Comments

@sbordet
Copy link
Contributor

sbordet commented Mar 26, 2021

Jetty version
10.0.x

Description
Java 16 introduced UnixDomain support (#6043).
HTTP3 over QUIC is another option.

We need a way to "carry" protocol-specific bytes (e.g. HTTP/1.1 bytes or HTTP/2 bytes or HTTP/3 bytes) using different "carriers", i.e. via TCP, UnixDomain, or QUIC (over UDP).

A proposal is the following:

ClientConnector clientConnector = new CompositeClientConnector();
clientConnector.add(new UnixDomainClientConnector("/path8080", "localhost:*"));
clientConnector.add(new QUICClientConnector("quic.cloudflare.com:443"));
clientConnector.add(new TCPClientConnector("*"));

HttpClient httpClient = new HttpClient(new HttpClientTransportDynamic(clientConnector));
httpClient.start();

The idea is that when we need to open a new carrier endpoint, we call ClientConnector.connect(SocketAddress, Map).
The CompositeClientConnector will do a match on the carriers it manages to see which one matches best (so there must be some "weight" or partial ordering to pick one among many that match).

In this way, all the other concepts will work (e.g. SOCKS4 proxying, as well as HTTP proxying) because they will be orthogonal to the carriers.
Only at the moment that you have to physically establish a carrier endpoing, we go to the ClientConnector, that will decide what type of carrier creates the endpoint.

@sbordet sbordet self-assigned this Apr 1, 2021
sbordet added a commit that referenced this issue Apr 1, 2021
Introduced org.eclipse.jetty.io.Connectable.
Retrofitted HttpClientTransport implementation to take a Connectable
instead of ClientConnector.

In future, a different Connectable implementation can be passed to
HttpClientTransport implementation so that it may delegate to concrete
ClientConnector implementation that use TCP, or Unix Domain sockets,
or QUIC over UDP.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@sbordet sbordet linked a pull request Apr 1, 2021 that will close this issue
@sbordet sbordet added this to To do in Jetty 10.0.3/11.0.3 via automation Apr 1, 2021
@joakime joakime moved this from To do to Review in progress in Jetty 10.0.3/11.0.3 Apr 2, 2021
@sbordet sbordet removed this from Review in progress in Jetty 10.0.3/11.0.3 May 19, 2021
@sbordet
Copy link
Contributor Author

sbordet commented Nov 12, 2021

Closing as this mechanism has been incorporated in the work done in #6765.

@sbordet sbordet closed this as completed Nov 12, 2021
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 a pull request may close this issue.

1 participant