diff options
author | Chris Ross <Tratcher@Outlook.com> | 2022-10-27 21:28:35 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-27 21:28:35 +0300 |
commit | d5629a0534ced8534226e321bfefff475160963e (patch) | |
tree | 372fffca1604bda34abe53ec821664490ae3b05e | |
parent | 90802f2befcba3673833d3d27b94b6deca12c1e1 (diff) |
Raise field size limit to 32kb #12213 (#44689)
4 files changed, 5 insertions, 7 deletions
diff --git a/src/Servers/Kestrel/Core/src/Http2Limits.cs b/src/Servers/Kestrel/Core/src/Http2Limits.cs index 1f5877e812..63bcaf6f22 100644 --- a/src/Servers/Kestrel/Core/src/Http2Limits.cs +++ b/src/Servers/Kestrel/Core/src/Http2Limits.cs @@ -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; diff --git a/src/Servers/Kestrel/Core/src/Http3Limits.cs b/src/Servers/Kestrel/Core/src/Http3Limits.cs index ba335a595c..0d7801e48b 100644 --- a/src/Servers/Kestrel/Core/src/Http3Limits.cs +++ b/src/Servers/Kestrel/Core/src/Http3Limits.cs @@ -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. diff --git a/src/Servers/Kestrel/Core/test/KestrelServerLimitsTests.cs b/src/Servers/Kestrel/Core/test/KestrelServerLimitsTests.cs index f0fe7e1f9a..bcd2045611 100644 --- a/src/Servers/Kestrel/Core/test/KestrelServerLimitsTests.cs +++ b/src/Servers/Kestrel/Core/test/KestrelServerLimitsTests.cs @@ -341,7 +341,7 @@ public class KestrelServerLimitsTests [Fact] public void Http2MaxRequestHeaderFieldSizeDefault() { - Assert.Equal(16 * 1024, new KestrelServerLimits().Http2.MaxRequestHeaderFieldSize); + Assert.Equal(32 * 1024, new KestrelServerLimits().Http2.MaxRequestHeaderFieldSize); } [Theory] diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3StreamTests.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3StreamTests.cs index 79d0668d13..728bc3458b 100644 --- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3StreamTests.cs +++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3StreamTests.cs @@ -135,7 +135,7 @@ public class Http3StreamTests : Http3TestBase 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); @@ -143,7 +143,7 @@ public class Http3StreamTests : Http3TestBase 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] |