Home / Class/ Http3ConnectionHandler Class — netty Architecture

Http3ConnectionHandler Class — netty Architecture

Architecture documentation for the Http3ConnectionHandler class in Http3ConnectionHandler.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  af90c570_05df_8deb_a124_cbb127170343["Http3ConnectionHandler"]
  ebcb29c7_c327_2266_fa08_f0fce409563b["Http3ConnectionHandler.java"]
  af90c570_05df_8deb_a124_cbb127170343 -->|defined in| ebcb29c7_c327_2266_fa08_f0fce409563b
  567c49b8_a96d_1a53_a323_3ee453b48e16["Http3ConnectionHandler()"]
  af90c570_05df_8deb_a124_cbb127170343 -->|method| 567c49b8_a96d_1a53_a323_3ee453b48e16
  6a2bb6fa_9ef6_0ae2_c7c4_2259ea4acb46["createControlStreamIfNeeded()"]
  af90c570_05df_8deb_a124_cbb127170343 -->|method| 6a2bb6fa_9ef6_0ae2_c7c4_2259ea4acb46
  c5fecbce_3e5a_0f35_550f_ad2d4aa3fa37["isGoAwayReceived()"]
  af90c570_05df_8deb_a124_cbb127170343 -->|method| c5fecbce_3e5a_0f35_550f_ad2d4aa3fa37
  a690aa8d_e8e9_1ae8_cd86_5e1429b0eaaa["ChannelHandler()"]
  af90c570_05df_8deb_a124_cbb127170343 -->|method| a690aa8d_e8e9_1ae8_cd86_5e1429b0eaaa
  05284f03_3eca_8107_a7f6_7c0bd538e030["handlerAdded()"]
  af90c570_05df_8deb_a124_cbb127170343 -->|method| 05284f03_3eca_8107_a7f6_7c0bd538e030
  2716456f_345f_d8c2_eade_f053fcd79034["channelActive()"]
  af90c570_05df_8deb_a124_cbb127170343 -->|method| 2716456f_345f_d8c2_eade_f053fcd79034
  68619ef0_2afd_5c7f_d5ef_008011e6d06f["channelRead()"]
  af90c570_05df_8deb_a124_cbb127170343 -->|method| 68619ef0_2afd_5c7f_d5ef_008011e6d06f
  5c4749c2_20d2_162a_a053_d600c0d86192["initBidirectionalStream()"]
  af90c570_05df_8deb_a124_cbb127170343 -->|method| 5c4749c2_20d2_162a_a053_d600c0d86192
  73fbda0b_513a_c602_5c67_5fc6c4fcfea5["initUnidirectionalStream()"]
  af90c570_05df_8deb_a124_cbb127170343 -->|method| 73fbda0b_513a_c602_5c67_5fc6c4fcfea5
  a12dda90_601f_e0e4_bebe_3eb09497d439["maxTableCapacity()"]
  af90c570_05df_8deb_a124_cbb127170343 -->|method| a12dda90_601f_e0e4_bebe_3eb09497d439
  339a755c_b758_9bbf_f900_b70f70e4cb8d["isSharable()"]
  af90c570_05df_8deb_a124_cbb127170343 -->|method| 339a755c_b758_9bbf_f900_b70f70e4cb8d

Relationship Graph

Source Code

codec-http3/src/main/java/io/netty/handler/codec/http3/Http3ConnectionHandler.java lines 37–220

public abstract class Http3ConnectionHandler extends ChannelInboundHandlerAdapter {
    final Http3FrameCodecFactory codecFactory;
    final LongFunction<ChannelHandler> unknownInboundStreamHandlerFactory;
    final boolean disableQpackDynamicTable;
    final Http3ControlStreamInboundHandler localControlStreamHandler;
    final Http3ControlStreamOutboundHandler remoteControlStreamHandler;
    final QpackDecoder qpackDecoder;
    final QpackEncoder qpackEncoder;
    final Http3Settings.NonStandardHttp3SettingsValidator nonStandardSettingsValidator;
    private boolean controlStreamCreationInProgress;

    final long maxTableCapacity;

    /**
     * Create a new instance.
     * @param server                                {@code true} if server-side, {@code false} otherwise.
     * @param inboundControlStreamHandler           the {@link ChannelHandler} which will be notified about
     *                                              {@link Http3RequestStreamFrame}s or {@code null} if the user is not
     *                                              interested in these.
     * @param unknownInboundStreamHandlerFactory    the {@link LongFunction} that will provide a custom
     *                                              {@link ChannelHandler} for unknown inbound stream types or
     *                                              {@code null} if no special handling should be done.
     * @param localSettings                         the local {@link Http3SettingsFrame} that should be sent to the
     *                                              remote peer or {@code null} if the default settings should be used.
     * @param disableQpackDynamicTable              If QPACK dynamic table should be disabled.
     */
    Http3ConnectionHandler(boolean server, @Nullable ChannelHandler inboundControlStreamHandler,
                           @Nullable LongFunction<ChannelHandler> unknownInboundStreamHandlerFactory,
                           @Nullable Http3SettingsFrame localSettings, boolean disableQpackDynamicTable,
                           @Nullable Http3Settings.NonStandardHttp3SettingsValidator nonStandardSettingsValidator) {
        this.unknownInboundStreamHandlerFactory = unknownInboundStreamHandlerFactory;
        this.disableQpackDynamicTable = disableQpackDynamicTable;
        if (nonStandardSettingsValidator != null) {
            this.nonStandardSettingsValidator = nonStandardSettingsValidator;
        } else {
            this.nonStandardSettingsValidator = (id, value) -> false;
        }
        if (localSettings == null) {
            localSettings = new DefaultHttp3SettingsFrame();
        } else {
            localSettings = DefaultHttp3SettingsFrame.copyOf(localSettings);
        }
        Long maxFieldSectionSize = localSettings.get(Http3SettingsFrame.HTTP3_SETTINGS_MAX_FIELD_SECTION_SIZE);
        if (maxFieldSectionSize == null) {
             // Default value in rfc is unlimited
             // but Quic can have max 2^62-1 max value as TWO bits reserved for Variable-Length Integer Encoding
            maxFieldSectionSize = (1L << 62) - 1;
        }
        this.maxTableCapacity = localSettings.getOrDefault(HTTP3_SETTINGS_QPACK_MAX_TABLE_CAPACITY, 0);
        int maxBlockedStreams = toIntExact(localSettings.getOrDefault(HTTP3_SETTINGS_QPACK_BLOCKED_STREAMS, 0));
        qpackDecoder = new QpackDecoder(maxTableCapacity, maxBlockedStreams);
        qpackEncoder = new QpackEncoder();
        codecFactory = Http3FrameCodec.newFactory(qpackDecoder, maxFieldSectionSize, qpackEncoder);
        remoteControlStreamHandler =  new Http3ControlStreamOutboundHandler(server, localSettings,
                codecFactory.newCodec(Http3FrameTypeValidator.NO_VALIDATION, NO_STATE, NO_STATE,
                        this.nonStandardSettingsValidator));
        localControlStreamHandler = new Http3ControlStreamInboundHandler(server, inboundControlStreamHandler,
                qpackEncoder, remoteControlStreamHandler);
    }

    private void createControlStreamIfNeeded(ChannelHandlerContext ctx) {
        if (!controlStreamCreationInProgress && Http3.getLocalControlStream(ctx.channel()) == null) {
            controlStreamCreationInProgress = true;
            QuicChannel channel = (QuicChannel) ctx.channel();
            // Once the channel became active we need to create an unidirectional stream and write the
            // Http3SettingsFrame to it. This needs to be the first frame on this stream.
            // https://tools.ietf.org/html/draft-ietf-quic-http-32#section-6.2.1.
            channel.createStream(QuicStreamType.UNIDIRECTIONAL, remoteControlStreamHandler)
                    .addListener(f -> {
                        if (!f.isSuccess()) {
                            ctx.fireExceptionCaught(new Http3Exception(Http3ErrorCode.H3_STREAM_CREATION_ERROR,
                                    "Unable to open control stream", f.cause()));
                            ctx.close();
                        } else {
                            Http3.setLocalControlStream(channel, (QuicStreamChannel) f.getNow());
                        }
                    });
        }
    }

    /**

Frequently Asked Questions

What is the Http3ConnectionHandler class?
Http3ConnectionHandler is a class in the netty codebase, defined in codec-http3/src/main/java/io/netty/handler/codec/http3/Http3ConnectionHandler.java.
Where is Http3ConnectionHandler defined?
Http3ConnectionHandler is defined in codec-http3/src/main/java/io/netty/handler/codec/http3/Http3ConnectionHandler.java at line 37.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free