Skip to content

Commit 4aebd29

Browse files
authored
Increase Http2 Header limit size to the MaxFrameSize (#12625)
1 parent e149f9c commit 4aebd29

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/Servers/Kestrel/Core/src/Http2Limits.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) .NET Foundation. All rights reserved.
1+
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using System;
@@ -14,7 +14,7 @@ public class Http2Limits
1414
private int _maxStreamsPerConnection = 100;
1515
private int _headerTableSize = (int)Http2PeerSettings.DefaultHeaderTableSize;
1616
private int _maxFrameSize = (int)Http2PeerSettings.DefaultMaxFrameSize;
17-
private int _maxRequestHeaderFieldSize = 8192;
17+
private int _maxRequestHeaderFieldSize = (int)Http2PeerSettings.DefaultMaxFrameSize;
1818
private int _initialConnectionWindowSize = 1024 * 128; // Larger than the default 64kb, and larger than any one single stream.
1919
private int _initialStreamWindowSize = 1024 * 96; // Larger than the default 64kb
2020

@@ -81,7 +81,7 @@ public int MaxFrameSize
8181
/// <summary>
8282
/// Indicates the size of the maximum allowed size of a request header field sequence. This limit applies to both name and value sequences in their compressed and uncompressed representations.
8383
/// <para>
84-
/// Value must be greater than 0, defaults to 8192
84+
/// Value must be greater than 0, defaults to 2^14 (16,384)
8585
/// </para>
8686
/// </summary>
8787
public int MaxRequestHeaderFieldSize

src/Servers/Kestrel/Core/test/KestrelServerLimitsTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) .NET Foundation. All rights reserved.
1+
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using System;
@@ -343,7 +343,7 @@ public void Http2HeaderTableSizeInvalid(int value)
343343
[Fact]
344344
public void Http2MaxRequestHeaderFieldSizeDefault()
345345
{
346-
Assert.Equal(8192, new KestrelServerLimits().Http2.MaxRequestHeaderFieldSize);
346+
Assert.Equal(16 * 1024, new KestrelServerLimits().Http2.MaxRequestHeaderFieldSize);
347347
}
348348

349349
[Theory]

src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2TestBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
3434
{
3535
public class Http2TestBase : TestApplicationErrorLoggerLoggedTest, IDisposable, IHttpHeadersHandler
3636
{
37-
protected static readonly int MaxRequestHeaderFieldSize = 8192;
37+
protected static readonly int MaxRequestHeaderFieldSize = 16 * 1024;
3838
protected static readonly string _4kHeaderValue = new string('a', 4096);
3939

4040
protected static readonly IEnumerable<KeyValuePair<string, string>> _browserRequestHeaders = new[]

0 commit comments

Comments
 (0)