Skip to content
This repository was archived by the owner on May 8, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ public abstract class Http3ConnectionHandler extends ChannelInboundHandlerAdapte
}
Long maxFieldSectionSize = localSettings.get(Http3SettingsFrame.HTTP3_SETTINGS_MAX_FIELD_SECTION_SIZE);
if (maxFieldSectionSize == null) {
// Just use the maximum value we can represent via a Long.
maxFieldSectionSize = Long.MAX_VALUE;
// 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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@
final class EmbeddedQuicChannel extends EmbeddedChannel implements QuicChannel {
private static final AttributeKey<AtomicLong> streamIdGeneratorKey =
valueOf("embedded_channel_stream_id_generator");

/**
* TWO bits reserved for Variable-Length Integer Encoding
* <a href="https://datatracker.ietf.org/doc/html/rfc9000?#name-variable-length-integer-enc">rfc9000</a>
* TWO LSB used for distinguish Client/Server initiated stream & Bi/unidirection
* these are not reserved but part of it
* <a href="https://datatracker.ietf.org/doc/html/rfc9000?#name-stream-types-and-identifier">rfc9000</a>
* so we can max stream per stream type (bi/uni) = (2^62-1)/2
*/
private static final long MAX_PEER_STREAMS_PER_STREAM_TYPE = ((1L << 62) - 1) / 2;

private final Map<QuicStreamType, Long> peerAllowedStreams = new EnumMap<>(QuicStreamType.class);
private final AtomicBoolean closed = new AtomicBoolean();
private final ConcurrentLinkedQueue<Integer> closeErrorCodes = new ConcurrentLinkedQueue<>();
Expand Down Expand Up @@ -140,10 +151,13 @@ public QuicChannel read() {

@Override
public long peerAllowedStreams(QuicStreamType type) {
return peerAllowedStreams.getOrDefault(type, Long.MAX_VALUE);
return peerAllowedStreams.getOrDefault(type, MAX_PEER_STREAMS_PER_STREAM_TYPE);
}

public void peerAllowedStreams(QuicStreamType type, long peerAllowedStreams) {
if (peerAllowedStreams > MAX_PEER_STREAMS_PER_STREAM_TYPE) {
peerAllowedStreams = MAX_PEER_STREAMS_PER_STREAM_TYPE;
}
this.peerAllowedStreams.put(type, peerAllowedStreams);
}

Expand Down
Loading