Closed
Description
Background and Motivation
As part of #30863, we're doing zero byte reads as a way to save memory. In some cases it might be better for performance (like in HTTPs based benchmarks), if we don't do a zero byte read before the actual read. Note, this isn't as big a deal as in the transport layer because it's not a real sys call we're making. We're calling into an in memory implementation.
Proposed API
namespace Microsoft.AspNetCore.Server.Kestrel.Https
{
public class HttpsConnectionAdapterOptions
{
+ public bool WaitForDataBeforeAllocatingBuffer { get; set; }
}
Usage Examples
var host = new HostBuilder()
.ConfigureWebHost(webHostBuilder =>
{
webHostBuilder
.UseKestrel(options =>
{
options.Listen(IPAddress.Loopback, 5001, o => o.UseHttps(https => https.WaitForDataBeforeAllocatingBuffer = true ));
})
.UseStartup<Startup>();
})
.Build();
await host.RunAsync();
Risks
None.