Repository: netty/netty
File: codec-http3/src/main/java/io/netty/handler/codec/http3/Http3ClientConnectionHandler.java (Java)

Code before:
     * @param nonStandardSettingsValidator          the {@link Http3Settings.NonStandardHttp3SettingsValidator} to use
     *                                              when validating settings that are non-standard.
     */
    public Http3ClientConnectionHandler(@Nullable ChannelHandler inboundControlStreamHandler,
                                        @Nullable LongFunction<ChannelHandler> pushStreamHandlerFactory,
                                        @Nullable LongFunction<ChannelHandler> unknownInboundStreamHandlerFactory,
                                        @Nullable Http3SettingsFrame localSettings, boolean disableQpackDynamicTable,
                                        @Nullable Http3Settings.NonStandardHttp3SettingsValidator
                                                nonStandardSettingsValidator) {
        super(false, inboundControlStreamHandler, unknownInboundStreamHandlerFactory, localSettings,
                disableQpackDynamicTable, nonStandardSettingsValidator);
        this.pushStreamHandlerFactory = pushStreamHandlerFactory;
    }

    @Override
    void initBidirectionalStream(ChannelHandlerContext ctx, QuicStreamChannel channel) {
        // See https://tools.ietf.org/html/draft-ietf-quic-http-32#section-6.1
        Http3CodecUtils.connectionError(ctx, Http3ErrorCode.H3_STREAM_CREATION_ERROR,
                "Server initiated bidirectional streams are not allowed", true);
    }

    @Override
    void initUnidirectionalStream(ChannelHandlerContext ctx, QuicStreamChannel streamChannel) {
        final long maxTableCapacity = maxTableCapacity();
        streamChannel.pipeline().addLast(
                new Http3UnidirectionalStreamInboundClientHandler(codecFactory, (id, v) -> false,
                        localControlStreamHandler, remoteControlStreamHandler,
                        unknownInboundStreamHandlerFactory, pushStreamHandlerFactory,
                        () -> new QpackEncoderHandler(maxTableCapacity, qpackDecoder),
                        () -> new QpackDecoderHandler(qpackEncoder)));
    }
}


Review comment (suggestion):
@normanmaurer I hope it is intentional `(id, v) -> false` or `nonStandardSettingsValidator` here as well

Code after:
     * @param nonStandardSettingsValidator          the {@link Http3Settings.NonStandardHttp3SettingsValidator} to use
     *                                              when validating settings that are non-standard.
     */
    public Http3ClientConnectionHandler(@Nullable ChannelHandler inboundControlStreamHandler,
                                        @Nullable LongFunction<ChannelHandler> pushStreamHandlerFactory,
                                        @Nullable LongFunction<ChannelHandler> unknownInboundStreamHandlerFactory,
                                        @Nullable Http3SettingsFrame localSettings, boolean disableQpackDynamicTable,
                                        @Nullable Http3Settings.NonStandardHttp3SettingsValidator
                                                nonStandardSettingsValidator) {
        super(false, inboundControlStreamHandler, unknownInboundStreamHandlerFactory, localSettings,
                disableQpackDynamicTable, nonStandardSettingsValidator);
        this.pushStreamHandlerFactory = pushStreamHandlerFactory;
    }

    @Override
    void initBidirectionalStream(ChannelHandlerContext ctx, QuicStreamChannel channel) {
        // See https://tools.ietf.org/html/draft-ietf-quic-http-32#section-6.1
        Http3CodecUtils.connectionError(ctx, Http3ErrorCode.H3_STREAM_CREATION_ERROR,
                "Server initiated bidirectional streams are not allowed", true);
    }

    @Override
    void initUnidirectionalStream(ChannelHandlerContext ctx, QuicStreamChannel streamChannel) {
        final long maxTableCapacity = maxTableCapacity();
        streamChannel.pipeline().addLast(
                new Http3UnidirectionalStreamInboundClientHandler(codecFactory, nonStandardSettingsValidator,
                        localControlStreamHandler, remoteControlStreamHandler,
                        unknownInboundStreamHandlerFactory, pushStreamHandlerFactory,
                        () -> new QpackEncoderHandler(maxTableCapacity, qpackDecoder),
                        () -> new QpackDecoderHandler(qpackEncoder)));
    }
}