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
7 changes: 4 additions & 3 deletions src/Servers/IIS/IIS/src/Core/IISHttpContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ namespace Microsoft.AspNetCore.Server.IIS.Core
internal abstract partial class IISHttpContext : NativeRequestContext, IThreadPoolWorkItem, IDisposable
{
private const int MinAllocBufferSize = 2048;
private const int PauseWriterThreshold = 65536;
private const int ResumeWriterTheshold = PauseWriterThreshold / 2;


protected readonly NativeSafeHandle _requestNativeHandle;

private readonly IISServerOptions _options;
Expand Down Expand Up @@ -93,6 +91,9 @@ internal unsafe IISHttpContext(
((IHttpBodyControlFeature)this).AllowSynchronousIO = _options.AllowSynchronousIO;
}

private int PauseWriterThreshold => _options.MaxRequestBodyBufferSize;
private int ResumeWriterTheshold => PauseWriterThreshold / 2;

public Version HttpVersion { get; set; } = default!;
public string Scheme { get; set; } = default!;
public string Method { get; set; } = default!;
Expand Down
8 changes: 8 additions & 0 deletions src/Servers/IIS/IIS/src/IISServerOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ public class IISServerOptions
/// </summary>
public string? AuthenticationDisplayName { get; set; }

/// <summary>
/// Gets or sets the maximum unconsumed incoming bytes the server will buffer for incoming request body.
/// </summary>
/// <value>
/// Defaults to 1 MB.
/// </value>
public int MaxRequestBodyBufferSize { get; set; } = 1024 * 1024; // Matches kestrel (sorta)

/// <summary>
/// Used to indicate if the authentication handler should be registered. This is only done if ANCM indicates
/// IIS has a non-anonymous authentication enabled, or for back compat with ANCMs that did not provide this information.
Expand Down
2 changes: 2 additions & 0 deletions src/Servers/IIS/IIS/src/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
*REMOVED*~override Microsoft.AspNetCore.Server.IIS.Core.WriteOnlyStream.ReadAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<int>
*REMOVED*~static Microsoft.AspNetCore.Hosting.WebHostBuilderIISExtensions.UseIIS(this Microsoft.AspNetCore.Hosting.IWebHostBuilder hostBuilder) -> Microsoft.AspNetCore.Hosting.IWebHostBuilder
*REMOVED*~static Microsoft.AspNetCore.Server.IIS.HttpContextExtensions.GetIISServerVariable(this Microsoft.AspNetCore.Http.HttpContext context, string variableName) -> string
Microsoft.AspNetCore.Builder.IISServerOptions.MaxRequestBodyBufferSize.get -> int
Microsoft.AspNetCore.Builder.IISServerOptions.MaxRequestBodyBufferSize.set -> void
Microsoft.AspNetCore.Http.Features.IServerVariablesFeature.this[string! variableName].get -> string? (forwarded, contained in Microsoft.AspNetCore.Http.Features)
Microsoft.AspNetCore.Builder.IISServerOptions.AuthenticationDisplayName.get -> string?
Microsoft.AspNetCore.Builder.IISServerOptions.AuthenticationDisplayName.set -> void
Expand Down