Skip to content

Commit bc7135c

Browse files
author
John Luo
authored
Merge pull request #18369 from dotnet/jkotalik/merge31
Merge 2.1 into 3.1
2 parents 405e841 + d9ccf23 commit bc7135c

File tree

8 files changed

+22
-22
lines changed

8 files changed

+22
-22
lines changed

src/Security/Authentication/OpenIdConnect/samples/OpenIdConnectSample/Startup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public Startup(IConfiguration config, IWebHostEnvironment env)
3535

3636
private void CheckSameSite(HttpContext httpContext, CookieOptions options)
3737
{
38-
if (options.SameSite > SameSiteMode.Unspecified)
38+
if (options.SameSite == SameSiteMode.None)
3939
{
4040
var userAgent = httpContext.Request.Headers["User-Agent"];
4141
// TODO: Use your User Agent library of choice here.

src/Security/Authentication/test/WsFederation/WsFederationTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) .NET Foundation. All rights reserved.
1+
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using System;
@@ -440,4 +440,4 @@ protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage reques
440440
}
441441
}
442442
}
443-
}
443+
}

src/SignalR/common/Http.Connections/src/Internal/TaskExtensions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
34
using System.Runtime.CompilerServices;
5+
46
namespace System.Threading.Tasks
57
{
68
internal static class TaskExtensions
@@ -21,4 +23,4 @@ public static async Task NoThrow(this Task task)
2123
public void OnCompleted(Action continuation) => _task.GetAwaiter().OnCompleted(continuation);
2224
public void UnsafeOnCompleted(Action continuation) => OnCompleted(continuation);
2325
}
24-
}
26+
}

src/SignalR/common/Http.Connections/src/Internal/Transports/LongPollingServerTransport.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,24 @@ public async Task ProcessRequestAsync(HttpContext context, CancellationToken tok
4040
var result = await _application.ReadAsync(token);
4141
var buffer = result.Buffer;
4242

43-
if (buffer.IsEmpty && (result.IsCompleted || result.IsCanceled))
43+
try
4444
{
45-
Log.LongPolling204(_logger);
46-
context.Response.ContentType = "text/plain";
47-
context.Response.StatusCode = StatusCodes.Status204NoContent;
48-
return;
49-
}
45+
if (buffer.IsEmpty && (result.IsCompleted || result.IsCanceled))
46+
{
47+
Log.LongPolling204(_logger);
48+
context.Response.ContentType = "text/plain";
49+
context.Response.StatusCode = StatusCodes.Status204NoContent;
50+
return;
51+
}
5052

51-
// We're intentionally not checking cancellation here because we need to drain messages we've got so far,
52-
// but it's too late to emit the 204 required by being canceled.
53+
// We're intentionally not checking cancellation here because we need to drain messages we've got so far,
54+
// but it's too late to emit the 204 required by being canceled.
5355

54-
Log.LongPollingWritingMessage(_logger, buffer.Length);
56+
Log.LongPollingWritingMessage(_logger, buffer.Length);
5557

56-
context.Response.ContentLength = buffer.Length;
57-
context.Response.ContentType = "application/octet-stream";
58+
context.Response.ContentLength = buffer.Length;
59+
context.Response.ContentType = "application/octet-stream";
5860

59-
try
60-
{
6161
_connection?.StartSendCancellation();
6262
await context.Response.Body.WriteAsync(buffer, _connection?.SendingToken ?? default);
6363
}

src/SignalR/common/Http.Connections/test/HttpConnectionDispatcherTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,6 @@ public override async Task WriteAsync(byte[] buffer, int offset, int count, Canc
10981098
await _sync.WaitToContinue();
10991099
cancellationToken.ThrowIfCancellationRequested();
11001100
}
1101-
#if NETCOREAPP2_1
11021101
public override async ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default)
11031102
{
11041103
if (_isSSE)
@@ -1110,7 +1109,6 @@ public override async ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, Cancella
11101109
await _sync.WaitToContinue();
11111110
cancellationToken.ThrowIfCancellationRequested();
11121111
}
1113-
#endif
11141112
}
11151113

11161114
[Fact]

src/SignalR/common/Shared/PipeWriterStream.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ private ValueTask WriteCoreAsync(ReadOnlyMemory<byte> source, CancellationToken
7474

7575
_length += source.Length;
7676
var task = _pipeWriter.WriteAsync(source);
77-
7877
if (task.IsCompletedSuccessfully)
7978
{
8079
// Cancellation can be triggered by PipeWriter.CancelPendingFlush

src/SignalR/common/testassets/Tests.Utils/VerifyNoErrorsScope.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) .NET Foundation. All rights reserved.
1+
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using System;
@@ -62,4 +62,4 @@ public void Dispose()
6262
}
6363
}
6464
}
65-
}
65+
}

src/SignalR/server/Core/src/HubConnectionContext.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ private ValueTask TryWritePingAsync()
318318
return default;
319319
}
320320

321+
// TODO: cancel?
321322
return new ValueTask(TryWritePingSlowAsync());
322323
}
323324

0 commit comments

Comments
 (0)