Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
2 changes: 1 addition & 1 deletion src/Servers/Kestrel/Core/src/Http2Limits.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class Http2Limits
private int _maxStreamsPerConnection = 100;
private int _headerTableSize = (int)Http2PeerSettings.DefaultHeaderTableSize;
private int _maxFrameSize = (int)Http2PeerSettings.DefaultMaxFrameSize;
private int _maxRequestHeaderFieldSize = (int)Http2PeerSettings.DefaultMaxFrameSize;
private int _maxRequestHeaderFieldSize = 32 * 1024; // Matches MaxRequestHeadersTotalSize
private int _initialConnectionWindowSize = 1024 * 1024; // Equal to SocketTransportOptions.MaxReadBufferSize and larger than any one single stream.
private int _initialStreamWindowSize = 768 * 1024; // Larger than the default 64kb and able to use most (3/4ths) of the connection window by itself.
private TimeSpan _keepAlivePingDelay = TimeSpan.MaxValue;
Expand Down
4 changes: 1 addition & 3 deletions src/Servers/Kestrel/Core/src/Http3Limits.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core;
/// </summary>
public class Http3Limits
{
internal const int DefaultMaxRequestHeaderFieldSize = 16 * 1024;

private int _headerTableSize;
private int _maxRequestHeaderFieldSize = DefaultMaxRequestHeaderFieldSize;
private int _maxRequestHeaderFieldSize = 32 * 1024; // Matches MaxRequestHeadersTotalSize

/// <summary>
/// Limits the size of the header compression table, in octets, the QPACK decoder on the server can use.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public void Http2HeaderTableSizeInvalid(int value)
[Fact]
public void Http2MaxRequestHeaderFieldSizeDefault()
{
Assert.Equal(16 * 1024, new KestrelServerLimits().Http2.MaxRequestHeaderFieldSize);
Assert.Equal(32 * 1024, new KestrelServerLimits().Http2.MaxRequestHeaderFieldSize);
}

[Theory]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,15 @@ public async Task RequestHeadersMaxRequestHeaderFieldSize_EndsStream()
new KeyValuePair<string, string>(InternalHeaderNames.Path, "/"),
new KeyValuePair<string, string>(InternalHeaderNames.Scheme, "http"),
new KeyValuePair<string, string>(InternalHeaderNames.Authority, "localhost:80"),
new KeyValuePair<string, string>("test", new string('a', 20000))
new KeyValuePair<string, string>("test", new string('a', 1024 * 32 + 1))
};

var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_echoApplication, headers);

await requestStream.WaitForStreamErrorAsync(
Http3ErrorCode.InternalError,
AssertExpectedErrorMessages,
"The HTTP headers length exceeded the set limit of 16384 bytes.");
$"The HTTP headers length exceeded the set limit of {1024 * 32} bytes.");
}

[Fact]
Expand Down