413531 - Introduce pluggable transports for HttpClient.
Merge of the branch 'http_client_transport' is now complete, and the implementation is sound for the HTTP transport. A basic implementation for the SPDY transport exists, but needs improvements.
This commit is contained in:
parent
86d51f057d
commit
d0f0dedf20
|
@ -914,22 +914,6 @@ public class HttpClient extends ContainerLifeCycle
|
|||
dump(out, indent, getBeans(), destinations.values());
|
||||
}
|
||||
|
||||
protected Connection tunnel(Connection connection)
|
||||
{
|
||||
// TODO
|
||||
/*
|
||||
HttpConnection httpConnection = (HttpConnection)connection;
|
||||
HttpDestination destination = httpConnection.getHttpDestination();
|
||||
SslConnection sslConnection = createSslConnection(destination, httpConnection.getEndPoint());
|
||||
Connection result = (Connection)sslConnection.getDecryptedEndPoint().getConnection();
|
||||
selectorManager.connectionClosed(httpConnection);
|
||||
selectorManager.connectionOpened(sslConnection);
|
||||
LOG.debug("Tunnelled {} over {}", connection, result);
|
||||
return result;
|
||||
*/
|
||||
return connection;
|
||||
}
|
||||
|
||||
private class ContentDecoderFactorySet implements Set<ContentDecoder.Factory>
|
||||
{
|
||||
private final Set<ContentDecoder.Factory> set = new HashSet<>();
|
||||
|
|
|
@ -30,4 +30,6 @@ public interface HttpClientTransport
|
|||
HttpDestination newHttpDestination(HttpClient httpClient, String scheme, String host, int port);
|
||||
|
||||
void connect(HttpDestination destination, SocketAddress address, Promise<Connection> promise);
|
||||
|
||||
Connection tunnel(Connection connection);
|
||||
}
|
||||
|
|
|
@ -330,7 +330,7 @@ public abstract class HttpDestination implements Destination, Closeable, Dumpabl
|
|||
if (response.getStatus() == 200)
|
||||
{
|
||||
// Wrap the connection with TLS
|
||||
Connection tunnel = client.tunnel(connection);
|
||||
Connection tunnel = client.getTransport().tunnel(connection);
|
||||
delegate.succeeded(tunnel);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -107,6 +107,19 @@ public class HttpClientTransportOverHTTP extends ContainerLifeCycle implements H
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.eclipse.jetty.client.api.Connection tunnel(org.eclipse.jetty.client.api.Connection connection)
|
||||
{
|
||||
HttpConnectionOverHTTP httpConnection = (HttpConnectionOverHTTP)connection;
|
||||
HttpDestination destination = httpConnection.getHttpDestination();
|
||||
SslConnection sslConnection = createSslConnection(destination, httpConnection.getEndPoint());
|
||||
HttpConnectionOverHTTP result = (HttpConnectionOverHTTP)sslConnection.getDecryptedEndPoint().getConnection();
|
||||
selectorManager.connectionClosed(httpConnection);
|
||||
selectorManager.connectionOpened(sslConnection);
|
||||
LOG.debug("Tunnelled {} over {}", connection, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
protected void configure(HttpClient client, SocketChannel channel) throws SocketException
|
||||
{
|
||||
channel.socket().setTcpNoDelay(client.isTCPNoDelay());
|
||||
|
|
|
@ -87,4 +87,10 @@ public class HttpClientTransportOverSPDY implements HttpClientTransport
|
|||
}
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Connection tunnel(Connection connection)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue