Read to null buffer
Read to null buffer rather than Stream.Null as the CopyToAsync will create a `new byte[]` on each callbc14660885/src/mscorlib/src/System/IO/Stream.cs (L218)of size 81920 bytes!bc14660885/src/mscorlib/src/System/IO/Stream.cs (L48)
This commit is contained in:
parent
c1b21b89d5
commit
4bba074d77
|
|
@ -29,6 +29,7 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
|
|||
private readonly object _onStartingSync = new Object();
|
||||
private readonly object _onCompletedSync = new Object();
|
||||
private readonly FrameRequestHeaders _requestHeaders = new FrameRequestHeaders();
|
||||
private readonly byte[] _nullBuffer = new byte[4096];
|
||||
private readonly FrameResponseHeaders _responseHeaders = new FrameResponseHeaders();
|
||||
|
||||
private List<KeyValuePair<Func<object, Task>, object>> _onStarting;
|
||||
|
|
@ -198,7 +199,10 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
|
|||
await ProduceEnd();
|
||||
|
||||
// Finish reading the request body in case the app did not.
|
||||
await RequestBody.CopyToAsync(Stream.Null);
|
||||
while (await RequestBody.ReadAsync(_nullBuffer, 0, _nullBuffer.Length) != 0)
|
||||
{
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
terminated = !_keepAlive;
|
||||
|
|
|
|||
Loading…
Reference in New Issue