| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463 |
- commit fbc5b64cd8fee5e966b51ce0dbb9f32fd524fce4
- Author: Chris Ross <[email protected]>
- Date: Fri Mar 16 10:56:36 2018 -0700
- React to new SocketHttpHandler (#434)
- diff --git a/build/dependencies.props b/build/dependencies.props
- index f2976b08b8a..5aaa28edec4 100644
- --- a/build/dependencies.props
- +++ b/build/dependencies.props
- @@ -4,17 +4,17 @@
- </PropertyGroup>
- <PropertyGroup Label="Package Versions">
- <InternalAspNetCoreSdkPackageVersion>2.1.0-preview2-15728</InternalAspNetCoreSdkPackageVersion>
- - <MicrosoftAspNetCoreAuthenticationCorePackageVersion>2.1.0-preview2-30272</MicrosoftAspNetCoreAuthenticationCorePackageVersion>
- - <MicrosoftAspNetCoreHostingPackageVersion>2.1.0-preview2-30272</MicrosoftAspNetCoreHostingPackageVersion>
- - <MicrosoftAspNetCoreTestingPackageVersion>2.1.0-preview2-30272</MicrosoftAspNetCoreTestingPackageVersion>
- - <MicrosoftExtensionsLoggingConsolePackageVersion>2.1.0-preview2-30272</MicrosoftExtensionsLoggingConsolePackageVersion>
- + <MicrosoftAspNetCoreAuthenticationCorePackageVersion>2.1.0-preview2-30301</MicrosoftAspNetCoreAuthenticationCorePackageVersion>
- + <MicrosoftAspNetCoreHostingPackageVersion>2.1.0-preview2-30301</MicrosoftAspNetCoreHostingPackageVersion>
- + <MicrosoftAspNetCoreTestingPackageVersion>2.1.0-preview2-30301</MicrosoftAspNetCoreTestingPackageVersion>
- + <MicrosoftExtensionsLoggingConsolePackageVersion>2.1.0-preview2-30301</MicrosoftExtensionsLoggingConsolePackageVersion>
- <MicrosoftNETCoreApp20PackageVersion>2.0.0</MicrosoftNETCoreApp20PackageVersion>
- - <MicrosoftNETCoreApp21PackageVersion>2.1.0-preview2-26225-03</MicrosoftNETCoreApp21PackageVersion>
- - <MicrosoftNetHttpHeadersPackageVersion>2.1.0-preview2-30272</MicrosoftNetHttpHeadersPackageVersion>
- + <MicrosoftNETCoreApp21PackageVersion>2.1.0-preview2-26308-01</MicrosoftNETCoreApp21PackageVersion>
- + <MicrosoftNetHttpHeadersPackageVersion>2.1.0-preview2-30301</MicrosoftNetHttpHeadersPackageVersion>
- <MicrosoftNETTestSdkPackageVersion>15.6.0</MicrosoftNETTestSdkPackageVersion>
- - <MicrosoftWin32RegistryPackageVersion>4.5.0-preview2-26224-02</MicrosoftWin32RegistryPackageVersion>
- - <SystemNetHttpWinHttpHandlerPackageVersion>4.5.0-preview2-26224-02</SystemNetHttpWinHttpHandlerPackageVersion>
- - <SystemSecurityPrincipalWindowsPackageVersion>4.5.0-preview2-26224-02</SystemSecurityPrincipalWindowsPackageVersion>
- + <MicrosoftWin32RegistryPackageVersion>4.5.0-preview2-26308-02</MicrosoftWin32RegistryPackageVersion>
- + <SystemNetHttpWinHttpHandlerPackageVersion>4.5.0-preview2-26308-02</SystemNetHttpWinHttpHandlerPackageVersion>
- + <SystemSecurityPrincipalWindowsPackageVersion>4.5.0-preview2-26308-02</SystemSecurityPrincipalWindowsPackageVersion>
- <XunitPackageVersion>2.3.1</XunitPackageVersion>
- <XunitRunnerVisualStudioPackageVersion>2.4.0-beta.1.build3945</XunitRunnerVisualStudioPackageVersion>
- </PropertyGroup>
- diff --git a/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RequestStream.cs b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RequestStream.cs
- index 284a3d856ec..6e0cb2ace51 100644
- --- a/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RequestStream.cs
- +++ b/src/Microsoft.AspNetCore.Server.HttpSys/RequestProcessing/RequestStream.cs
- @@ -133,12 +133,10 @@ namespace Microsoft.AspNetCore.Server.HttpSys
- dataRead = _requestContext.Request.GetChunks(ref _dataChunkIndex, ref _dataChunkOffset, buffer, offset, size);
- }
-
- - if (_dataChunkIndex == -1 && dataRead < size)
- + if (_dataChunkIndex == -1 && dataRead == 0)
- {
- uint statusCode = 0;
- uint extraDataRead = 0;
- - offset += (int)dataRead;
- - size -= (int)dataRead;
-
- // the http.sys team recommends that we limit the size to 128kb
- if (size > MaxReadSize)
- @@ -209,72 +207,68 @@ namespace Microsoft.AspNetCore.Server.HttpSys
- {
- dataRead = _requestContext.Request.GetChunks(ref _dataChunkIndex, ref _dataChunkOffset, buffer, offset, size);
-
- - if (_dataChunkIndex != -1 && dataRead == size)
- + if (dataRead > 0)
- {
- asyncResult = new RequestStreamAsyncResult(this, state, callback, buffer, offset, 0);
- asyncResult.Complete((int)dataRead);
- + return asyncResult;
- }
- }
-
- - if (_dataChunkIndex == -1 && dataRead < size)
- - {
- - uint statusCode = 0;
- - offset += (int)dataRead;
- - size -= (int)dataRead;
- + uint statusCode = 0;
-
- - // the http.sys team recommends that we limit the size to 128kb
- - if (size > MaxReadSize)
- - {
- - size = MaxReadSize;
- - }
- + // the http.sys team recommends that we limit the size to 128kb
- + if (size > MaxReadSize)
- + {
- + size = MaxReadSize;
- + }
-
- - asyncResult = new RequestStreamAsyncResult(this, state, callback, buffer, offset, dataRead);
- - uint bytesReturned;
- + asyncResult = new RequestStreamAsyncResult(this, state, callback, buffer, offset, dataRead);
- + uint bytesReturned;
-
- - try
- - {
- - uint flags = 0;
- -
- - statusCode =
- - HttpApi.HttpReceiveRequestEntityBody(
- - RequestQueueHandle,
- - RequestId,
- - flags,
- - asyncResult.PinnedBuffer,
- - (uint)size,
- - out bytesReturned,
- - asyncResult.NativeOverlapped);
- - }
- - catch (Exception e)
- - {
- - LogHelper.LogException(Logger, "BeginRead", e);
- - asyncResult.Dispose();
- - throw;
- - }
- + try
- + {
- + uint flags = 0;
- +
- + statusCode =
- + HttpApi.HttpReceiveRequestEntityBody(
- + RequestQueueHandle,
- + RequestId,
- + flags,
- + asyncResult.PinnedBuffer,
- + (uint)size,
- + out bytesReturned,
- + asyncResult.NativeOverlapped);
- + }
- + catch (Exception e)
- + {
- + LogHelper.LogException(Logger, "BeginRead", e);
- + asyncResult.Dispose();
- + throw;
- + }
-
- - if (statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_IO_PENDING)
- + if (statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_IO_PENDING)
- + {
- + asyncResult.Dispose();
- + if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_HANDLE_EOF)
- {
- - asyncResult.Dispose();
- - if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_HANDLE_EOF)
- - {
- - asyncResult = new RequestStreamAsyncResult(this, state, callback, dataRead);
- - asyncResult.Complete((int)bytesReturned);
- - }
- - else
- - {
- - Exception exception = new IOException(string.Empty, new HttpSysException((int)statusCode));
- - LogHelper.LogException(Logger, "BeginRead", exception);
- - Abort();
- - throw exception;
- - }
- + asyncResult = new RequestStreamAsyncResult(this, state, callback, dataRead);
- + asyncResult.Complete((int)bytesReturned);
- }
- - else if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS &&
- - HttpSysListener.SkipIOCPCallbackOnSuccess)
- + else
- {
- - // IO operation completed synchronously - callback won't be called to signal completion.
- - asyncResult.IOCompleted(statusCode, bytesReturned);
- + Exception exception = new IOException(string.Empty, new HttpSysException((int)statusCode));
- + LogHelper.LogException(Logger, "BeginRead", exception);
- + Abort();
- + throw exception;
- }
- }
- + else if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS &&
- + HttpSysListener.SkipIOCPCallbackOnSuccess)
- + {
- + // IO operation completed synchronously - callback won't be called to signal completion.
- + asyncResult.IOCompleted(statusCode, bytesReturned);
- + }
- return asyncResult;
- }
-
- @@ -322,7 +316,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
- if (_dataChunkIndex != -1)
- {
- dataRead = _requestContext.Request.GetChunks(ref _dataChunkIndex, ref _dataChunkOffset, buffer, offset, size);
- - if (_dataChunkIndex != -1 && dataRead == size)
- + if (dataRead > 0)
- {
- UpdateAfterRead(UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS, dataRead);
- if (TryCheckSizeLimit((int)dataRead, out var exception))
- @@ -334,85 +328,82 @@ namespace Microsoft.AspNetCore.Server.HttpSys
- }
- }
-
- - if (_dataChunkIndex == -1 && dataRead < size)
- - {
- - uint statusCode = 0;
- - offset += (int)dataRead;
- - size -= (int)dataRead;
- + uint statusCode = 0;
- + offset += (int)dataRead;
- + size -= (int)dataRead;
-
- - // the http.sys team recommends that we limit the size to 128kb
- - if (size > MaxReadSize)
- - {
- - size = MaxReadSize;
- - }
- -
- - var cancellationRegistration = default(CancellationTokenRegistration);
- - if (cancellationToken.CanBeCanceled)
- - {
- - cancellationRegistration = RequestContext.RegisterForCancellation(cancellationToken);
- - }
- + // the http.sys team recommends that we limit the size to 128kb
- + if (size > MaxReadSize)
- + {
- + size = MaxReadSize;
- + }
-
- - asyncResult = new RequestStreamAsyncResult(this, null, null, buffer, offset, dataRead, cancellationRegistration);
- - uint bytesReturned;
- + var cancellationRegistration = default(CancellationTokenRegistration);
- + if (cancellationToken.CanBeCanceled)
- + {
- + cancellationRegistration = RequestContext.RegisterForCancellation(cancellationToken);
- + }
-
- - try
- - {
- - uint flags = 0;
- + asyncResult = new RequestStreamAsyncResult(this, null, null, buffer, offset, dataRead, cancellationRegistration);
- + uint bytesReturned;
-
- - statusCode =
- - HttpApi.HttpReceiveRequestEntityBody(
- - RequestQueueHandle,
- - RequestId,
- - flags,
- - asyncResult.PinnedBuffer,
- - (uint)size,
- - out bytesReturned,
- - asyncResult.NativeOverlapped);
- - }
- - catch (Exception e)
- - {
- - asyncResult.Dispose();
- - Abort();
- - LogHelper.LogException(Logger, "ReadAsync", e);
- - throw;
- - }
- + try
- + {
- + uint flags = 0;
- +
- + statusCode =
- + HttpApi.HttpReceiveRequestEntityBody(
- + RequestQueueHandle,
- + RequestId,
- + flags,
- + asyncResult.PinnedBuffer,
- + (uint)size,
- + out bytesReturned,
- + asyncResult.NativeOverlapped);
- + }
- + catch (Exception e)
- + {
- + asyncResult.Dispose();
- + Abort();
- + LogHelper.LogException(Logger, "ReadAsync", e);
- + throw;
- + }
-
- - if (statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_IO_PENDING)
- - {
- - asyncResult.Dispose();
- - if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_HANDLE_EOF)
- - {
- - uint totalRead = dataRead + bytesReturned;
- - UpdateAfterRead(statusCode, totalRead);
- - if (TryCheckSizeLimit((int)totalRead, out var exception))
- - {
- - return Task.FromException<int>(exception);
- - }
- - // TODO: Verbose log totalRead
- - return Task.FromResult<int>((int)totalRead);
- - }
- - else
- - {
- - Exception exception = new IOException(string.Empty, new HttpSysException((int)statusCode));
- - LogHelper.LogException(Logger, "ReadAsync", exception);
- - Abort();
- - throw exception;
- - }
- - }
- - else if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS &&
- - HttpSysListener.SkipIOCPCallbackOnSuccess)
- + if (statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_IO_PENDING)
- + {
- + asyncResult.Dispose();
- + if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_HANDLE_EOF)
- {
- - // IO operation completed synchronously - callback won't be called to signal completion.
- - asyncResult.Dispose();
- uint totalRead = dataRead + bytesReturned;
- UpdateAfterRead(statusCode, totalRead);
- if (TryCheckSizeLimit((int)totalRead, out var exception))
- {
- return Task.FromException<int>(exception);
- }
- - // TODO: Verbose log
- + // TODO: Verbose log totalRead
- return Task.FromResult<int>((int)totalRead);
- }
- + else
- + {
- + Exception exception = new IOException(string.Empty, new HttpSysException((int)statusCode));
- + LogHelper.LogException(Logger, "ReadAsync", exception);
- + Abort();
- + throw exception;
- + }
- + }
- + else if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS &&
- + HttpSysListener.SkipIOCPCallbackOnSuccess)
- + {
- + // IO operation completed synchronously - callback won't be called to signal completion.
- + asyncResult.Dispose();
- + uint totalRead = dataRead + bytesReturned;
- + UpdateAfterRead(statusCode, totalRead);
- + if (TryCheckSizeLimit((int)totalRead, out var exception))
- + {
- + return Task.FromException<int>(exception);
- + }
- + // TODO: Verbose log
- + return Task.FromResult<int>((int)totalRead);
- }
- return asyncResult.Task;
- }
- diff --git a/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/RequestBodyTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/RequestBodyTests.cs
- index 9ea7f4805fd..baec5a82044 100644
- --- a/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/RequestBodyTests.cs
- +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/RequestBodyTests.cs
- @@ -344,7 +344,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
- content.Block.Release();
- context.Dispose();
-
- - await Assert.ThrowsAsync<TaskCanceledException>(async () => await responseTask);
- + await Assert.ThrowsAnyAsync<OperationCanceledException>(async () => await responseTask);
- }
- }
-
- @@ -421,6 +421,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
- protected async override Task SerializeToStreamAsync(Stream stream, TransportContext context)
- {
- await stream.WriteAsync(new byte[5], 0, 5);
- + await stream.FlushAsync();
- await Block.WaitAsync();
- await stream.WriteAsync(new byte[5], 0, 5);
- }
- diff --git a/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseBodyTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseBodyTests.cs
- index ef56e997cb4..0c91833773f 100644
- --- a/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseBodyTests.cs
- +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseBodyTests.cs
- @@ -427,7 +427,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
- var context = await server.AcceptAsync(Utilities.DefaultTimeout);
- // First write sends headers
- cts.Cancel();
- - await Assert.ThrowsAsync<TaskCanceledException>(() => responseTask);
- + await Assert.ThrowsAnyAsync<OperationCanceledException>(() => responseTask);
- Assert.True(context.DisconnectToken.WaitHandle.WaitOne(TimeSpan.FromSeconds(5)));
- Assert.Throws<IOException>(() =>
- {
- @@ -458,7 +458,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
-
- // First write sends headers
- cts.Cancel();
- - await Assert.ThrowsAsync<TaskCanceledException>(() => responseTask);
- + await Assert.ThrowsAnyAsync<OperationCanceledException>(() => responseTask);
-
- Assert.True(context.DisconnectToken.WaitHandle.WaitOne(TimeSpan.FromSeconds(5)));
- await Assert.ThrowsAsync<IOException>(async () =>
- @@ -489,7 +489,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
- var context = await server.AcceptAsync(Utilities.DefaultTimeout);
- // First write sends headers
- cts.Cancel();
- - await Assert.ThrowsAsync<TaskCanceledException>(() => responseTask);
- + await Assert.ThrowsAnyAsync<OperationCanceledException>(() => responseTask);
- Assert.True(context.DisconnectToken.WaitHandle.WaitOne(TimeSpan.FromSeconds(5)));
- // It can take several tries before Write notices the disconnect.
- for (int i = 0; i < Utilities.WriteRetryLimit; i++)
- @@ -512,7 +512,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
- var context = await server.AcceptAsync(Utilities.DefaultTimeout);
- // First write sends headers
- cts.Cancel();
- - await Assert.ThrowsAsync<TaskCanceledException>(() => responseTask);
- + await Assert.ThrowsAnyAsync<OperationCanceledException>(() => responseTask);
- Assert.True(context.DisconnectToken.WaitHandle.WaitOne(TimeSpan.FromSeconds(5)));
- // It can take several tries before Write notices the disconnect.
- for (int i = 0; i < Utilities.WriteRetryLimit; i++)
- diff --git a/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseSendFileTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseSendFileTests.cs
- index 2a962c69f2e..990af071e71 100644
- --- a/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseSendFileTests.cs
- +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseSendFileTests.cs
- @@ -468,7 +468,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
-
- // First write sends headers
- cts.Cancel();
- - await Assert.ThrowsAsync<TaskCanceledException>(() => responseTask);
- + await Assert.ThrowsAnyAsync<OperationCanceledException>(() => responseTask);
-
- Assert.True(context.DisconnectToken.WaitHandle.WaitOne(TimeSpan.FromSeconds(5)));
- await Assert.ThrowsAsync<IOException>(async () =>
- @@ -499,7 +499,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
- var context = await server.AcceptAsync(Utilities.DefaultTimeout);
- // First write sends headers
- cts.Cancel();
- - await Assert.ThrowsAsync<TaskCanceledException>(() => responseTask);
- + await Assert.ThrowsAnyAsync<OperationCanceledException>(() => responseTask);
- Assert.True(context.DisconnectToken.WaitHandle.WaitOne(TimeSpan.FromSeconds(5)));
- // It can take several tries before Send notices the disconnect.
- for (int i = 0; i < Utilities.WriteRetryLimit; i++)
- diff --git a/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ServerTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ServerTests.cs
- index 60c95a94f1c..c15d47fd15a 100644
- --- a/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ServerTests.cs
- +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ServerTests.cs
- @@ -96,7 +96,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
- Assert.True(canceled.WaitOne(interval), "canceled");
- Assert.True(ct.IsCancellationRequested, "IsCancellationRequested");
-
- - await Assert.ThrowsAsync<TaskCanceledException>(() => responseTask);
- + await Assert.ThrowsAnyAsync<OperationCanceledException>(() => responseTask);
-
- context.Dispose();
- }
- @@ -119,7 +119,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
- var context = await server.AcceptAsync(Utilities.DefaultTimeout);
-
- client.CancelPendingRequests();
- - await Assert.ThrowsAsync<TaskCanceledException>(() => responseTask);
- + await Assert.ThrowsAnyAsync<OperationCanceledException>(() => responseTask);
-
- var ct = context.DisconnectToken;
- Assert.True(ct.CanBeCanceled, "CanBeCanceled");
- diff --git a/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/RequestBodyLimitTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/RequestBodyLimitTests.cs
- index ebc0fa9f988..ae203ceab1f 100644
- --- a/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/RequestBodyLimitTests.cs
- +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/RequestBodyLimitTests.cs
- @@ -413,6 +413,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
- protected async override Task SerializeToStreamAsync(Stream stream, TransportContext context)
- {
- await stream.WriteAsync(new byte[10], 0, 10);
- + await stream.FlushAsync();
- Assert.True(await Block.WaitAsync(TimeSpan.FromSeconds(10)));
- await stream.WriteAsync(new byte[10], 0, 10);
- }
- diff --git a/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/RequestBodyTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/RequestBodyTests.cs
- index 1b879201032..b7a18867d9c 100644
- --- a/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/RequestBodyTests.cs
- +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/RequestBodyTests.cs
- @@ -232,7 +232,8 @@ namespace Microsoft.AspNetCore.Server.HttpSys
- protected async override Task SerializeToStreamAsync(Stream stream, TransportContext context)
- {
- await stream.WriteAsync(new byte[5], 0, 5);
- - await Block.WaitAsync();
- + await stream.FlushAsync();
- + Assert.True(await Block.WaitAsync(TimeSpan.FromSeconds(10)));
- await stream.WriteAsync(new byte[5], 0, 5);
- }
-
|