Skip to content

Commit 3ce33a2

Browse files
committed
PR feedback
1 parent 79a1338 commit 3ce33a2

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/Servers/Kestrel/Core/src/Internal/Http3/Http3FrameWriter.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ public Http3FrameWriter(PipeWriter output, ConnectionContext connectionContext,
6262
_headerEncodingBuffer = new byte[_maxFrameSize];
6363
_qpackEncoder = new QPackEncoder();
6464

65-
// TODO(JamesNK): QPack encoder doesn't react to settings change during a stream
65+
// Note that QPack encoder doesn't react to settings change during a stream.
66+
// Unlikely to be a problem in practice:
67+
// - Settings rarely change after the start of a connection.
68+
// - Response header size limits are a best-effort requirement in the spec.
6669
_qpackEncoder.MaxTotalHeaderSize = clientPeerSettings.MaxRequestHeaderFieldSectionSize > int.MaxValue
6770
? int.MaxValue
6871
: (int)clientPeerSettings.MaxRequestHeaderFieldSectionSize;

src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3StreamTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2451,7 +2451,7 @@ await requestStream.SendHeadersAsync(new[]
24512451
new KeyValuePair<string, string>(HeaderNames.Authority, "localhost:80"),
24522452
}, endStream: true);
24532453

2454-
await requestStream.WaitForStreamErrorAsync(Http3ErrorCode.InternalError, "Total header size exceeds the maximum size allowed by peer.");
2454+
await requestStream.WaitForStreamErrorAsync(Http3ErrorCode.InternalError, "The encoded HTTP headers length exceeds the limit specified by the peer of 100 bytes.");
24552455
}
24562456
}
24572457
}

src/Shared/runtime/Http3/QPack/QPackEncoder.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,10 +469,11 @@ private bool Encode(Span<byte> buffer, bool throwIfNoneEncoded, out int length)
469469
return false;
470470
}
471471

472+
// https://quicwg.org/base-drafts/draft-ietf-quic-http.html#section-4.1.1.3
472473
_currentTotalHeaderSize += HeaderField.GetLength(key.Length, value.Length);
473474
if (_currentTotalHeaderSize > MaxTotalHeaderSize)
474475
{
475-
throw new QPackEncodingException("Total header size exceeds the maximum size allowed by peer.");
476+
throw new QPackEncodingException($"The encoded HTTP headers length exceeds the limit specified by the peer of {MaxTotalHeaderSize} bytes.");
476477
}
477478

478479
length += headerLength;

0 commit comments

Comments
 (0)