Increase Http2 Header limit size to the MaxFrameSize (#12625)

This commit is contained in:
Justin Kotalik 2019-07-26 14:31:48 -07:00 committed by GitHub
parent e149f9c0aa
commit 4aebd29abc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core
private int _maxStreamsPerConnection = 100; private int _maxStreamsPerConnection = 100;
private int _headerTableSize = (int)Http2PeerSettings.DefaultHeaderTableSize; private int _headerTableSize = (int)Http2PeerSettings.DefaultHeaderTableSize;
private int _maxFrameSize = (int)Http2PeerSettings.DefaultMaxFrameSize; private int _maxFrameSize = (int)Http2PeerSettings.DefaultMaxFrameSize;
private int _maxRequestHeaderFieldSize = 8192; private int _maxRequestHeaderFieldSize = (int)Http2PeerSettings.DefaultMaxFrameSize;
private int _initialConnectionWindowSize = 1024 * 128; // Larger than the default 64kb, and larger than any one single stream. private int _initialConnectionWindowSize = 1024 * 128; // Larger than the default 64kb, and larger than any one single stream.
private int _initialStreamWindowSize = 1024 * 96; // Larger than the default 64kb private int _initialStreamWindowSize = 1024 * 96; // Larger than the default 64kb
@ -81,7 +81,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core
/// <summary> /// <summary>
/// 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. /// 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.
/// <para> /// <para>
/// Value must be greater than 0, defaults to 8192 /// Value must be greater than 0, defaults to 2^14 (16,384)
/// </para> /// </para>
/// </summary> /// </summary>
public int MaxRequestHeaderFieldSize public int MaxRequestHeaderFieldSize

View File

@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
@ -343,7 +343,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
[Fact] [Fact]
public void Http2MaxRequestHeaderFieldSizeDefault() public void Http2MaxRequestHeaderFieldSizeDefault()
{ {
Assert.Equal(8192, new KestrelServerLimits().Http2.MaxRequestHeaderFieldSize); Assert.Equal(16 * 1024, new KestrelServerLimits().Http2.MaxRequestHeaderFieldSize);
} }
[Theory] [Theory]

View File

@ -34,7 +34,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
{ {
public class Http2TestBase : TestApplicationErrorLoggerLoggedTest, IDisposable, IHttpHeadersHandler public class Http2TestBase : TestApplicationErrorLoggerLoggedTest, IDisposable, IHttpHeadersHandler
{ {
protected static readonly int MaxRequestHeaderFieldSize = 8192; protected static readonly int MaxRequestHeaderFieldSize = 16 * 1024;
protected static readonly string _4kHeaderValue = new string('a', 4096); protected static readonly string _4kHeaderValue = new string('a', 4096);
protected static readonly IEnumerable<KeyValuePair<string, string>> _browserRequestHeaders = new[] protected static readonly IEnumerable<KeyValuePair<string, string>> _browserRequestHeaders = new[]