use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelPipeline in project reactor-netty by reactor.
the class ProxyProvider method addProxyHandler.
public void addProxyHandler(Channel channel) {
Objects.requireNonNull(channel, "channel");
ChannelPipeline pipeline = channel.pipeline();
pipeline.addFirst(NettyPipeline.ProxyHandler, newProxyHandler());
if (pipeline.get(NettyPipeline.LoggingHandler) != null) {
pipeline.addBefore(NettyPipeline.ProxyHandler, NettyPipeline.ProxyLoggingHandler, LOGGING_HANDLER);
}
}
use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelPipeline in project reactor-netty by reactor.
the class SslProvider method addSslHandler.
public void addSslHandler(Channel channel, @Nullable SocketAddress remoteAddress, boolean sslDebug, boolean enableTracing) {
Objects.requireNonNull(channel, "channel");
if (sniProvider != null) {
sniProvider.addSniHandler(channel, sslDebug, enableTracing);
return;
}
SslHandler sslHandler;
if (remoteAddress instanceof InetSocketAddress) {
InetSocketAddress sniInfo = (InetSocketAddress) remoteAddress;
sslHandler = getSslContext().newHandler(channel.alloc(), sniInfo.getHostString(), sniInfo.getPort());
if (log.isDebugEnabled()) {
log.debug(format(channel, "SSL enabled using engine {} and SNI {}"), sslHandler.engine(), sniInfo);
}
} else {
sslHandler = getSslContext().newHandler(channel.alloc());
if (log.isDebugEnabled()) {
log.debug(format(channel, "SSL enabled using engine {}"), sslHandler.engine());
}
}
configure(sslHandler);
ChannelPipeline pipeline = channel.pipeline();
if (pipeline.get(NettyPipeline.ProxyHandler) != null) {
pipeline.addAfter(NettyPipeline.ProxyHandler, NettyPipeline.SslHandler, sslHandler);
} else if (pipeline.get(NettyPipeline.NonSslRedirectDetector) != null) {
pipeline.addAfter(NettyPipeline.NonSslRedirectDetector, NettyPipeline.SslHandler, sslHandler);
} else {
pipeline.addFirst(NettyPipeline.SslHandler, sslHandler);
}
addSslReadHandler(pipeline, sslDebug, remoteAddress == null, enableTracing);
}
use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelPipeline in project reactor-netty by reactor.
the class HttpServerConfig method addStreamHandlers.
static void addStreamHandlers(Channel ch, boolean accessLogEnabled, @Nullable Function<AccessLogArgProvider, AccessLog> accessLog, @Nullable BiPredicate<HttpServerRequest, HttpServerResponse> compressPredicate, ServerCookieDecoder decoder, ServerCookieEncoder encoder, HttpServerFormDecoderProvider formDecoderProvider, @Nullable BiFunction<ConnectionInfo, HttpRequest, ConnectionInfo> forwardedHeaderHandler, ConnectionObserver listener, @Nullable BiFunction<? super Mono<Void>, ? super Connection, ? extends Mono<Void>> mapHandle, int minCompressionSize, ChannelOperations.OnSetup opsFactory) {
ChannelPipeline pipeline = ch.pipeline();
if (accessLogEnabled) {
pipeline.addLast(NettyPipeline.AccessLogHandler, AccessLogHandlerFactory.H2.create(accessLog));
}
pipeline.addLast(NettyPipeline.H2ToHttp11Codec, new Http2StreamFrameToHttpObjectCodec(true)).addLast(NettyPipeline.HttpTrafficHandler, new Http2StreamBridgeServerHandler(compressPredicate, decoder, encoder, formDecoderProvider, forwardedHeaderHandler, listener, mapHandle));
boolean alwaysCompress = compressPredicate == null && minCompressionSize == 0;
if (alwaysCompress) {
pipeline.addLast(NettyPipeline.CompressionHandler, new SimpleCompressionHandler());
}
ChannelOperations.addReactiveBridge(ch, opsFactory, listener);
if (log.isDebugEnabled()) {
log.debug(format(ch, "Initialized HTTP/2 stream pipeline {}"), pipeline);
}
}
use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelPipeline in project reactor-netty by reactor.
the class NonSslRedirectDetector method decode.
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) {
if (in.readableBytes() < SSL_RECORD_HEADER_LENGTH) {
return;
}
ChannelPipeline pipeline = ctx.pipeline();
if (SslHandler.isEncrypted(in)) {
sslProvider.addSslHandler(ctx.channel(), remoteAddress, sslDebug);
} else {
pipeline.addBefore(NettyPipeline.ReactiveBridge, NettyPipeline.NonSslRedirectHandler, new NonSslRedirectHandler());
}
pipeline.remove(this);
}
use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelPipeline in project apollo by apollo-rsps.
the class ServiceChannelInitializer method initChannel.
@Override
protected void initChannel(SocketChannel ch) throws Exception {
ChannelPipeline pipeline = ch.pipeline();
pipeline.addLast("handshakeDecoder", new HandshakeDecoder());
pipeline.addLast("timeout", new IdleStateHandler(NetworkConstants.IDLE_TIME, 0, 0));
pipeline.addLast("handler", handler);
}
Aggregations