Merge pull request #18369 from dotnet/jkotalik/merge31
Merge 2.1 into 3.1
This commit is contained in:
commit
bc7135c202
|
|
@ -35,7 +35,7 @@ namespace OpenIdConnectSample
|
||||||
|
|
||||||
private void CheckSameSite(HttpContext httpContext, CookieOptions options)
|
private void CheckSameSite(HttpContext httpContext, CookieOptions options)
|
||||||
{
|
{
|
||||||
if (options.SameSite > SameSiteMode.Unspecified)
|
if (options.SameSite == SameSiteMode.None)
|
||||||
{
|
{
|
||||||
var userAgent = httpContext.Request.Headers["User-Agent"];
|
var userAgent = httpContext.Request.Headers["User-Agent"];
|
||||||
// TODO: Use your User Agent library of choice here.
|
// TODO: Use your User Agent library of choice here.
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
@ -440,4 +440,4 @@ namespace Microsoft.AspNetCore.Authentication.WsFederation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// 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.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
namespace System.Threading.Tasks
|
namespace System.Threading.Tasks
|
||||||
{
|
{
|
||||||
internal static class TaskExtensions
|
internal static class TaskExtensions
|
||||||
|
|
@ -21,4 +23,4 @@ namespace System.Threading.Tasks
|
||||||
public void OnCompleted(Action continuation) => _task.GetAwaiter().OnCompleted(continuation);
|
public void OnCompleted(Action continuation) => _task.GetAwaiter().OnCompleted(continuation);
|
||||||
public void UnsafeOnCompleted(Action continuation) => OnCompleted(continuation);
|
public void UnsafeOnCompleted(Action continuation) => OnCompleted(continuation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,24 +40,24 @@ namespace Microsoft.AspNetCore.Http.Connections.Internal.Transports
|
||||||
var result = await _application.ReadAsync(token);
|
var result = await _application.ReadAsync(token);
|
||||||
var buffer = result.Buffer;
|
var buffer = result.Buffer;
|
||||||
|
|
||||||
if (buffer.IsEmpty && (result.IsCompleted || result.IsCanceled))
|
|
||||||
{
|
|
||||||
Log.LongPolling204(_logger);
|
|
||||||
context.Response.ContentType = "text/plain";
|
|
||||||
context.Response.StatusCode = StatusCodes.Status204NoContent;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We're intentionally not checking cancellation here because we need to drain messages we've got so far,
|
|
||||||
// but it's too late to emit the 204 required by being canceled.
|
|
||||||
|
|
||||||
Log.LongPollingWritingMessage(_logger, buffer.Length);
|
|
||||||
|
|
||||||
context.Response.ContentLength = buffer.Length;
|
|
||||||
context.Response.ContentType = "application/octet-stream";
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (buffer.IsEmpty && (result.IsCompleted || result.IsCanceled))
|
||||||
|
{
|
||||||
|
Log.LongPolling204(_logger);
|
||||||
|
context.Response.ContentType = "text/plain";
|
||||||
|
context.Response.StatusCode = StatusCodes.Status204NoContent;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We're intentionally not checking cancellation here because we need to drain messages we've got so far,
|
||||||
|
// but it's too late to emit the 204 required by being canceled.
|
||||||
|
|
||||||
|
Log.LongPollingWritingMessage(_logger, buffer.Length);
|
||||||
|
|
||||||
|
context.Response.ContentLength = buffer.Length;
|
||||||
|
context.Response.ContentType = "application/octet-stream";
|
||||||
|
|
||||||
_connection?.StartSendCancellation();
|
_connection?.StartSendCancellation();
|
||||||
await context.Response.Body.WriteAsync(buffer, _connection?.SendingToken ?? default);
|
await context.Response.Body.WriteAsync(buffer, _connection?.SendingToken ?? default);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1098,7 +1098,6 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
||||||
await _sync.WaitToContinue();
|
await _sync.WaitToContinue();
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
}
|
}
|
||||||
#if NETCOREAPP2_1
|
|
||||||
public override async ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default)
|
public override async ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
if (_isSSE)
|
if (_isSSE)
|
||||||
|
|
@ -1110,7 +1109,6 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
||||||
await _sync.WaitToContinue();
|
await _sync.WaitToContinue();
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,6 @@ namespace System.IO.Pipelines
|
||||||
|
|
||||||
_length += source.Length;
|
_length += source.Length;
|
||||||
var task = _pipeWriter.WriteAsync(source);
|
var task = _pipeWriter.WriteAsync(source);
|
||||||
|
|
||||||
if (task.IsCompletedSuccessfully)
|
if (task.IsCompletedSuccessfully)
|
||||||
{
|
{
|
||||||
// Cancellation can be triggered by PipeWriter.CancelPendingFlush
|
// Cancellation can be triggered by PipeWriter.CancelPendingFlush
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
@ -62,4 +62,4 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -318,6 +318,7 @@ namespace Microsoft.AspNetCore.SignalR
|
||||||
return default;
|
return default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: cancel?
|
||||||
return new ValueTask(TryWritePingSlowAsync());
|
return new ValueTask(TryWritePingSlowAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue