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

Code before:
package io.netty.handler.codec.http3;

import org.jetbrains.annotations.Nullable;

import java.util.Map;

/**
 * See <a href="https://tools.ietf.org/html/draft-ietf-quic-http-32#section-7.2.4">SETTINGS</a>.
 */
public interface Http3SettingsFrame extends Http3ControlStreamFrame, Iterable<Map.Entry<Long, Long>> {

    /**
     * See <a href="https://tools.ietf.org/html/draft-ietf-quic-qpack-19#section-5">
     *     SETTINGS_QPACK_MAX_TABLE_CAPACITY</a>.
     */
    long HTTP3_SETTINGS_QPACK_MAX_TABLE_CAPACITY = 0x1;
    /**
     * See <a href="https://tools.ietf.org/html/draft-ietf-quic-qpack-19#section-5">
     *     SETTINGS_QPACK_BLOCKED_STREAMS</a>.
     */
    long HTTP3_SETTINGS_QPACK_BLOCKED_STREAMS = 0x7;
    /**
     * See <a href="https://tools.ietf.org/html/draft-ietf-quic-http-32#section-7.2.4.1">
     *     SETTINGS_MAX_FIELD_SECTION_SIZE</a>.
     */
    long HTTP3_SETTINGS_MAX_FIELD_SECTION_SIZE = 0x6;

    @Override
    default long type() {
        return Http3CodecUtils.HTTP3_SETTINGS_FRAME_TYPE;
    }

    /**
     * Get a setting from the frame.
     *
     * @param key   the key of the setting.
     * @return      the value of the setting or {@code null} if none was found with the given key.
     */
    @Nullable
    Long get(long key);

    /**
     * Get a setting from the frame.
     *
     * @param key   the key of the setting.
     * @param defaultValue If the setting does not exist.
     * @return the value of the setting or {@code defaultValue} if none was found with the given key.
     */
    default Long getOrDefault(long key, long defaultValue) {
        final Long val = get(key);
        return val == null ? defaultValue : val;

Review comment (refactor):
@normanmaurer 
The current Http3SettingsFrame interface assumes that all setting values are of type long. However, some settings (for example, enable_connect_protocol) are effectively boolean — they can only be 0 or 1.
Should we consider representing these as boolean values (similar to how it’s handled in Http2SettingsFrame), or should we continue to treat everything as long and handle boolean conversion at the usage sites?
For reference, I looked at [Http2SettingsFrame](https://github.com/netty/netty/blob/4.2/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2SettingsFrame.java) and [Http2Settings](https://github.com/netty/netty/blob/4.2/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2Settings.java) in Netty, and it uses a more type-specific approach.
If we decide to align with that model, we’ll also need to update related classes like Http3ConnectionHandler, etc.
Could you please clarify if there’s any specific reason for keeping the long type here, or if it would be acceptable to refactor this to follow the HTTP/2 design?

Code after:
package io.netty.handler.codec.http3;

import org.jetbrains.annotations.Nullable;

import java.util.Map;

/**
 * See <a href="https://tools.ietf.org/html/draft-ietf-quic-http-32#section-7.2.4">SETTINGS</a>.
 */
public interface Http3SettingsFrame extends Http3ControlStreamFrame, Iterable<Map.Entry<Long, Long>> {

    /**
     * See <a href="https://tools.ietf.org/html/draft-ietf-quic-qpack-19#section-5">
     *     SETTINGS_QPACK_MAX_TABLE_CAPACITY</a>.
     */
    long HTTP3_SETTINGS_QPACK_MAX_TABLE_CAPACITY = 0x1;
    /**
     * See <a href="https://tools.ietf.org/html/draft-ietf-quic-qpack-19#section-5">
     *     SETTINGS_QPACK_BLOCKED_STREAMS</a>.
     */
    long HTTP3_SETTINGS_QPACK_BLOCKED_STREAMS = 0x7;
    /**
     * See <a href="https://www.rfc-editor.org/rfc/rfc9220.html#section-5">
     *     SETTINGS_ENABLE_CONNECT_PROTOCOL</a>.
     */
    long HTTP3_SETTINGS_ENABLE_CONNECT_PROTOCOL = 0x8;
    /**
     * See <a href="https://tools.ietf.org/html/draft-ietf-quic-http-32#section-7.2.4.1">
     *     SETTINGS_MAX_FIELD_SECTION_SIZE</a>.
     */
    long HTTP3_SETTINGS_MAX_FIELD_SECTION_SIZE = 0x6;

    @Override
    default long type() {
        return Http3CodecUtils.HTTP3_SETTINGS_FRAME_TYPE;
    }

    /**
     * Get a setting from the frame.
     *
     * @param key   the key of the setting.
     * @return      the value of the setting or {@code null} if none was found with the given key.
     */
    @Nullable
    Long get(long key);

    /**
     * Get a setting from the frame.
     *
     * @param key   the key of the setting.
     * @param defaultValue If the setting does not exist.