From 6157a0bdfb42a537b71d4d7abb519ccc0d31151b Mon Sep 17 00:00:00 2001 From: Juan Barahona Date: Thu, 8 Apr 2021 20:33:07 -0400 Subject: [PATCH 01/12] Adding initial refactor to improve perfromance on ChunkingCookieManager --- .../Http.Features/src/IResponseCookies.cs | 9 ++ .../Http.Features/src/PublicAPI.Shipped.txt | 1 + src/Http/Http/src/Internal/ResponseCookies.cs | 51 ++++++++++ .../src/ResponseCookiesWrapper.cs | 28 ++++++ .../CookiePolicy/test/CookieChunkingTests.cs | 44 +++++++++ .../CookiePolicy/test/CookiePolicyTests.cs | 6 ++ .../ChunkingCookieManagerBenchmark.cs | 63 ++++++++++++ ...AspNetCore.Security.Microbenchmarks.csproj | 3 +- .../ChunkingCookieManager.cs | 96 +++++++++++-------- 9 files changed, 260 insertions(+), 41 deletions(-) create mode 100644 src/Security/perf/Microbenchmarks/ChunkingCookieManagerBenchmark.cs diff --git a/src/Http/Http.Features/src/IResponseCookies.cs b/src/Http/Http.Features/src/IResponseCookies.cs index 9c8c3b42bab9..cfa2267110e7 100644 --- a/src/Http/Http.Features/src/IResponseCookies.cs +++ b/src/Http/Http.Features/src/IResponseCookies.cs @@ -1,6 +1,8 @@ // 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. +using System.Collections.Generic; + namespace Microsoft.AspNetCore.Http { /// @@ -23,6 +25,13 @@ public interface IResponseCookies /// included in the new cookie setting. void Append(string key, string value, CookieOptions options); + /// + /// Add elements of specified dictionary as cookies. + /// + /// Key value pair collections whose elements will be added as cookies. + /// included in new cookie settings. + void Append(IDictionary keyValuePairs, CookieOptions options); + /// /// Sets an expired cookie. /// diff --git a/src/Http/Http.Features/src/PublicAPI.Shipped.txt b/src/Http/Http.Features/src/PublicAPI.Shipped.txt index f97bf2426e2e..e6e2c3735f89 100644 --- a/src/Http/Http.Features/src/PublicAPI.Shipped.txt +++ b/src/Http/Http.Features/src/PublicAPI.Shipped.txt @@ -222,6 +222,7 @@ Microsoft.AspNetCore.Http.IRequestCookieCollection.this[string! key].get -> stri Microsoft.AspNetCore.Http.IResponseCookies Microsoft.AspNetCore.Http.IResponseCookies.Append(string! key, string! value) -> void Microsoft.AspNetCore.Http.IResponseCookies.Append(string! key, string! value, Microsoft.AspNetCore.Http.CookieOptions! options) -> void +Microsoft.AspNetCore.Http.IResponseCookies.Append(System.Collections.Generic.IDictionary! keyValuePairs, Microsoft.AspNetCore.Http.CookieOptions! options) -> void Microsoft.AspNetCore.Http.IResponseCookies.Delete(string! key) -> void Microsoft.AspNetCore.Http.IResponseCookies.Delete(string! key, Microsoft.AspNetCore.Http.CookieOptions! options) -> void Microsoft.AspNetCore.Http.ISession diff --git a/src/Http/Http/src/Internal/ResponseCookies.cs b/src/Http/Http/src/Internal/ResponseCookies.cs index 4a34b055d604..25c905647d8f 100644 --- a/src/Http/Http/src/Internal/ResponseCookies.cs +++ b/src/Http/Http/src/Internal/ResponseCookies.cs @@ -88,6 +88,57 @@ public void Append(string key, string value, CookieOptions options) Headers[HeaderNames.SetCookie] = StringValues.Concat(Headers[HeaderNames.SetCookie], cookieValue); } + /// + public void Append(IDictionary keyValuePairs, CookieOptions options) + { + if (options == null) + { + throw new ArgumentNullException(nameof(options)); + } + + // SameSite=None cookies must be marked as Secure. + if (!options.Secure && options.SameSite == SameSiteMode.None) + { + if (_logger == null) + { + var services = _features.Get()?.RequestServices; + _logger = services?.GetService>(); + } + + if (_logger != null) + { + foreach (var keyValuePair in keyValuePairs) + { + Log.SameSiteCookieNotSecure(_logger, keyValuePair.Key); + } + } + } + + var setCookieHeaderValue = new SetCookieHeaderValue(string.Empty) + { + Domain = options.Domain, + Path = options.Path, + Expires = options.Expires, + MaxAge = options.MaxAge, + Secure = options.Secure, + SameSite = (Net.Http.Headers.SameSiteMode)options.SameSite, + HttpOnly = options.HttpOnly + }; + + var cookierHeaderValue = setCookieHeaderValue.ToString()[1..]; + var cookies = new string[keyValuePairs.Count]; + var position = 0; + + foreach (var keyValuePair in keyValuePairs) + { + cookies[position] = $"{keyValuePair.Key}={keyValuePair.Value}{cookierHeaderValue}"; + position++; + } + + Headers.Append(HeaderNames.SetCookie, cookies); + + } + /// public void Delete(string key) { diff --git a/src/Security/CookiePolicy/src/ResponseCookiesWrapper.cs b/src/Security/CookiePolicy/src/ResponseCookiesWrapper.cs index 4a3dc976646e..513536262810 100644 --- a/src/Security/CookiePolicy/src/ResponseCookiesWrapper.cs +++ b/src/Security/CookiePolicy/src/ResponseCookiesWrapper.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Collections.Generic; using System.Diagnostics; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; @@ -152,6 +153,33 @@ public void Append(string key, string value, CookieOptions options) } } + public void Append(IDictionary keyValuePairs, CookieOptions options) + { + if (options == null) + { + throw new ArgumentNullException(nameof(options)); + } + + var nonSuppressedValues = new Dictionary(); + + foreach (var keyValuePair in keyValuePairs) + { + var key = keyValuePair.Key; + var value = keyValuePair.Value; + + if (ApplyAppendPolicy(ref key, ref value, options)) + { + nonSuppressedValues.Add(key, value); + } + else + { + _logger.CookieSuppressed(keyValuePair.Key); + } + } + + Cookies.Append(nonSuppressedValues, options); + } + private bool ApplyAppendPolicy(ref string key, ref string value, CookieOptions options) { var issueCookie = CanTrack || options.IsEssential; diff --git a/src/Security/CookiePolicy/test/CookieChunkingTests.cs b/src/Security/CookiePolicy/test/CookieChunkingTests.cs index 4b65df4073b5..dd4541b58d17 100644 --- a/src/Security/CookiePolicy/test/CookieChunkingTests.cs +++ b/src/Security/CookiePolicy/test/CookieChunkingTests.cs @@ -3,6 +3,7 @@ using System; using Microsoft.AspNetCore.Http; +using Microsoft.Net.Http.Headers; using Xunit; namespace Microsoft.AspNetCore.Internal @@ -145,5 +146,48 @@ public void DeleteChunkedCookieWithOptions_AllDeleted() "TestCookieC7=; expires=Thu, 01 Jan 1970 00:00:00 GMT; domain=foo.com; path=/; secure", }, cookies); } + + + + [Fact] + public void DeleteChunkedCookieWithOptionsAndResponseCookies_AllDeleted() + { + var chunkingCookieManager = new ChunkingCookieManager(); + HttpContext httpContext = new DefaultHttpContext(); + + httpContext.Request.Headers["Cookie"] = new[] + { + "TestCookie=chunks-7; domain=foo.com; path=/; secure", + "TestCookieC1=abcdefghi; domain=foo.com; path=/; secure", + "TestCookieC2=jklmnopqr; domain=foo.com; path=/; secure", + "TestCookieC3=stuvwxyz0; domain=foo.com; path=/; secure", + "TestCookieC4=123456789; domain=foo.com; path=/; secure", + "TestCookieC5=ABCDEFGHI; domain=foo.com; path=/; secure", + "TestCookieC6=JKLMNOPQR; domain=foo.com; path=/; secure", + "TestCookieC7=STUVWXYZ; domain=foo.com; path=/; secure" + }; + + var cookieOptions = new CookieOptions() + { + Domain = "foo.com", + Path = "/", + Secure = true + }; + + httpContext.Response.Headers[HeaderNames.SetCookie] = new[] + { + "TestCookie=chunks-7; domain=foo.com; path=/; secure", + "TestCookieC1=abcdefghi; domain=foo.com; path=/; secure", + "TestCookieC2=jklmnopqr; domain=foo.com; path=/; secure", + "TestCookieC3=stuvwxyz0; domain=foo.com; path=/; secure", + "TestCookieC4=123456789; domain=foo.com; path=/; secure", + "TestCookieC5=ABCDEFGHI; domain=foo.com; path=/; secure", + "TestCookieC6=JKLMNOPQR; domain=foo.com; path=/; secure", + "TestCookieC7=STUVWXYZ; domain=foo.com; path=/; secure" + }; + + chunkingCookieManager.DeleteCookie(httpContext, "TestCookie", cookieOptions); + Assert.Equal(8, httpContext.Response.Headers[HeaderNames.SetCookie].Count); + } } } diff --git a/src/Security/CookiePolicy/test/CookiePolicyTests.cs b/src/Security/CookiePolicy/test/CookiePolicyTests.cs index 6f5c940c7d9e..1eeee43afd8d 100644 --- a/src/Security/CookiePolicy/test/CookiePolicyTests.cs +++ b/src/Security/CookiePolicy/test/CookiePolicyTests.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Collections.Generic; using System.Security.Claims; using System.Security.Principal; using System.Threading.Tasks; @@ -485,6 +486,11 @@ public void Append(string key, string value, CookieOptions options) throw new NotImplementedException(); } + public void Append(IDictionary keyValuePairs, CookieOptions options) + { + throw new NotImplementedException(); + } + public void Delete(string key) { throw new NotImplementedException(); diff --git a/src/Security/perf/Microbenchmarks/ChunkingCookieManagerBenchmark.cs b/src/Security/perf/Microbenchmarks/ChunkingCookieManagerBenchmark.cs new file mode 100644 index 000000000000..fc1829c7cc91 --- /dev/null +++ b/src/Security/perf/Microbenchmarks/ChunkingCookieManagerBenchmark.cs @@ -0,0 +1,63 @@ +using BenchmarkDotNet.Attributes; +using Microsoft.AspNetCore.Authentication.Cookies; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Primitives; +using Microsoft.Net.Http.Headers; + +namespace Microsoft.AspNetCore.Security +{ + public class ChunkingCookieManagerBenchmark + { + private ChunkingCookieManager _chunkingCookieManager; + private HttpContext _httpContext; + private CookieOptions _cookieOptions; + private string _stringToAdd; + + [GlobalSetup] + public void GlobalSetup() + { + _chunkingCookieManager = new ChunkingCookieManager() + { + ChunkSize = 86 + }; + + _httpContext = new DefaultHttpContext(); + + _cookieOptions = new CookieOptions() + { + Domain = "foo.com", + Path = "/", + Secure = true + }; + + _httpContext.Request.Headers["Cookie"] = new[] + { + "TestCookie=chunks-7; domain=foo.com; path=/; secure", + "TestCookieC1=abcdefghi; domain=foo.com; path=/; secure", + "TestCookieC2=jklmnopqr; domain=foo.com; path=/; secure", + "TestCookieC3=stuvwxyz0; domain=foo.com; path=/; secure", + "TestCookieC4=123456789; domain=foo.com; path=/; secure", + "TestCookieC5=ABCDEFGHI; domain=foo.com; path=/; secure", + "TestCookieC6=JKLMNOPQR; domain=foo.com; path=/; secure", + "TestCookieC7=STUVWXYZ; domain=foo.com; path=/; secure" + }; + + _stringToAdd = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + } + + + [Benchmark] + public void AppendCookies() + { + _chunkingCookieManager.AppendResponseCookie(_httpContext, "TestCookie1", _stringToAdd, _cookieOptions); + _httpContext.Response.Headers[HeaderNames.SetCookie] = StringValues.Empty; + } + + [Benchmark] + public void DeleteCookies() + { + _chunkingCookieManager.DeleteCookie(_httpContext, "TestCookie", _cookieOptions); + _httpContext.Response.Headers[HeaderNames.SetCookie] = StringValues.Empty; + } + } +} diff --git a/src/Security/perf/Microbenchmarks/Microsoft.AspNetCore.Security.Microbenchmarks.csproj b/src/Security/perf/Microbenchmarks/Microsoft.AspNetCore.Security.Microbenchmarks.csproj index 0e1fd48c208e..eb286d326646 100644 --- a/src/Security/perf/Microbenchmarks/Microsoft.AspNetCore.Security.Microbenchmarks.csproj +++ b/src/Security/perf/Microbenchmarks/Microsoft.AspNetCore.Security.Microbenchmarks.csproj @@ -1,4 +1,4 @@ - + $(DefaultNetCoreTargetFramework) @@ -14,6 +14,7 @@ + diff --git a/src/Shared/ChunkingCookieManager/ChunkingCookieManager.cs b/src/Shared/ChunkingCookieManager/ChunkingCookieManager.cs index 05f51180b093..cdeee679d5b2 100644 --- a/src/Shared/ChunkingCookieManager/ChunkingCookieManager.cs +++ b/src/Shared/ChunkingCookieManager/ChunkingCookieManager.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; +using System.Text; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Primitives; using Microsoft.Net.Http.Headers; @@ -164,6 +165,14 @@ public void AppendResponseCookie(HttpContext context, string key, string? value, throw new ArgumentNullException(nameof(options)); } + var responseCookies = context.Response.Cookies; + + if (string.IsNullOrEmpty(value)) + { + responseCookies.Append(key, string.Empty, options); + return; + } + var template = new SetCookieHeaderValue(key) { Domain = options.Domain, @@ -177,10 +186,7 @@ public void AppendResponseCookie(HttpContext context, string key, string? value, var templateLength = template.ToString().Length; - value = value ?? string.Empty; - // Normal cookie - var responseCookies = context.Response.Cookies; if (!ChunkSize.HasValue || ChunkSize.Value > templateLength + value.Length) { responseCookies.Append(key, value, options); @@ -202,7 +208,11 @@ public void AppendResponseCookie(HttpContext context, string key, string? value, var dataSizePerCookie = ChunkSize.Value - templateLength - 3; // Budget 3 chars for the chunkid. var cookieChunkCount = (int)Math.Ceiling(value.Length * 1.0 / dataSizePerCookie); - responseCookies.Append(key, ChunkCountPrefix + cookieChunkCount.ToString(CultureInfo.InvariantCulture), options); + IDictionary keyValuePairs = new Dictionary(cookieChunkCount) + { + [key] = ChunkCountPrefix + cookieChunkCount.ToString(CultureInfo.InvariantCulture) + }; + var offset = 0; for (var chunkId = 1; chunkId <= cookieChunkCount; chunkId++) @@ -211,9 +221,10 @@ public void AppendResponseCookie(HttpContext context, string key, string? value, var length = Math.Min(dataSizePerCookie, remainingLength); var segment = value.Substring(offset, length); offset += length; - - responseCookies.Append(key + ChunkKeySuffix + chunkId.ToString(CultureInfo.InvariantCulture), segment, options); + keyValuePairs.Add(key + ChunkKeySuffix + chunkId.ToString(CultureInfo.InvariantCulture), segment); } + + responseCookies.Append(keyValuePairs, options); } } @@ -241,14 +252,16 @@ public void DeleteCookie(HttpContext context, string key, CookieOptions options) throw new ArgumentNullException(nameof(options)); } - var keys = new List(); - keys.Add(key + "="); + var keys = new List + { + key + "=" + }; var requestCookie = context.Request.Cookies[key]; var chunks = ParseChunksCount(requestCookie); if (chunks > 0) { - for (int i = 1; i <= chunks + 1; i++) + for (var i = 1; i <= chunks + 1; i++) { var subkey = key + ChunkKeySuffix + i.ToString(CultureInfo.InvariantCulture); keys.Add(subkey + "="); @@ -275,43 +288,46 @@ public void DeleteCookie(HttpContext context, string key, CookieOptions options) var responseHeaders = context.Response.Headers; var existingValues = responseHeaders[HeaderNames.SetCookie]; + if (!StringValues.IsNullOrEmpty(existingValues)) { - responseHeaders[HeaderNames.SetCookie] = existingValues.Where(value => !rejectPredicate(value)).ToArray(); - } + var values = existingValues.ToArray(); + var newValues = new List(); - AppendResponseCookie( - context, - key, - string.Empty, - new CookieOptions() + for (var i = 0; i < values.Length; i++) { - Path = options.Path, - Domain = options.Domain, - SameSite = options.SameSite, - Secure = options.Secure, - IsEssential = options.IsEssential, - Expires = DateTimeOffset.UnixEpoch, - HttpOnly = options.HttpOnly, - }); - - for (int i = 1; i <= chunks; i++) - { - AppendResponseCookie( - context, - key + "C" + i.ToString(CultureInfo.InvariantCulture), - string.Empty, - new CookieOptions() + if (!rejectPredicate(values[i])) { - Path = options.Path, - Domain = options.Domain, - SameSite = options.SameSite, - Secure = options.Secure, - IsEssential = options.IsEssential, - Expires = DateTimeOffset.UnixEpoch, - HttpOnly = options.HttpOnly, - }); + newValues.Add(values[i]); + } + } + + responseHeaders[HeaderNames.SetCookie] = new StringValues(newValues.ToArray()); } + + var responseCookies = context.Response.Cookies; + + + IDictionary keyValuePairs = new Dictionary(chunks) + { + [key] = string.Empty + }; + + for (var i = 1; i <= chunks; i++) + { + keyValuePairs.Add(key + "C" + i.ToString(CultureInfo.InvariantCulture), string.Empty); + } + + responseCookies.Append(keyValuePairs, new CookieOptions() + { + Path = options.Path, + Domain = options.Domain, + SameSite = options.SameSite, + Secure = options.Secure, + IsEssential = options.IsEssential, + Expires = DateTimeOffset.UnixEpoch, + HttpOnly = options.HttpOnly, + }); } } } From 7922591713ed0a2c7598fde169bda9c111d3d66c Mon Sep 17 00:00:00 2001 From: Juan Barahona Date: Thu, 8 Apr 2021 21:17:30 -0400 Subject: [PATCH 02/12] Moving new API to correct file --- src/Http/Http.Features/src/PublicAPI.Shipped.txt | 1 - src/Http/Http.Features/src/PublicAPI.Unshipped.txt | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Http/Http.Features/src/PublicAPI.Shipped.txt b/src/Http/Http.Features/src/PublicAPI.Shipped.txt index e6e2c3735f89..f97bf2426e2e 100644 --- a/src/Http/Http.Features/src/PublicAPI.Shipped.txt +++ b/src/Http/Http.Features/src/PublicAPI.Shipped.txt @@ -222,7 +222,6 @@ Microsoft.AspNetCore.Http.IRequestCookieCollection.this[string! key].get -> stri Microsoft.AspNetCore.Http.IResponseCookies Microsoft.AspNetCore.Http.IResponseCookies.Append(string! key, string! value) -> void Microsoft.AspNetCore.Http.IResponseCookies.Append(string! key, string! value, Microsoft.AspNetCore.Http.CookieOptions! options) -> void -Microsoft.AspNetCore.Http.IResponseCookies.Append(System.Collections.Generic.IDictionary! keyValuePairs, Microsoft.AspNetCore.Http.CookieOptions! options) -> void Microsoft.AspNetCore.Http.IResponseCookies.Delete(string! key) -> void Microsoft.AspNetCore.Http.IResponseCookies.Delete(string! key, Microsoft.AspNetCore.Http.CookieOptions! options) -> void Microsoft.AspNetCore.Http.ISession diff --git a/src/Http/Http.Features/src/PublicAPI.Unshipped.txt b/src/Http/Http.Features/src/PublicAPI.Unshipped.txt index 5b914c27b50f..731be38c5005 100644 --- a/src/Http/Http.Features/src/PublicAPI.Unshipped.txt +++ b/src/Http/Http.Features/src/PublicAPI.Unshipped.txt @@ -14,4 +14,5 @@ Microsoft.AspNetCore.Http.Features.IFeatureCollection.Get() -> TFeatur Microsoft.AspNetCore.Http.Features.IFeatureCollection.Set(TFeature? instance) -> void Microsoft.AspNetCore.Http.Features.IServerVariablesFeature.this[string! variableName].get -> string? Microsoft.AspNetCore.Http.ISession.TryGetValue(string! key, out byte[]? value) -> bool -Microsoft.AspNetCore.Http.Features.FeatureCollection.FeatureCollection(int initialCapacity) -> void \ No newline at end of file +Microsoft.AspNetCore.Http.Features.FeatureCollection.FeatureCollection(int initialCapacity) -> void +Microsoft.AspNetCore.Http.IResponseCookies.Append(System.Collections.Generic.IDictionary! keyValuePairs, Microsoft.AspNetCore.Http.CookieOptions! options) -> void From 5f811cdf04157879d6510f1ad6070868f6c81335 Mon Sep 17 00:00:00 2001 From: Juan Barahona Date: Thu, 8 Apr 2021 21:58:59 -0400 Subject: [PATCH 03/12] Adding some interface implementation for tests --- .../test/DefaultAntiforgeryTokenStoreTest.cs | 5 +++++ .../test/CookieTempDataProviderTest.cs | 17 +++++++++++++++-- .../CookiePolicy/test/CookieChunkingTests.cs | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/Antiforgery/test/DefaultAntiforgeryTokenStoreTest.cs b/src/Antiforgery/test/DefaultAntiforgeryTokenStoreTest.cs index 8456ee318ad1..68f663f5d54f 100644 --- a/src/Antiforgery/test/DefaultAntiforgeryTokenStoreTest.cs +++ b/src/Antiforgery/test/DefaultAntiforgeryTokenStoreTest.cs @@ -491,6 +491,11 @@ public void Append(string key, string value) throw new NotImplementedException(); } + public void Append(IDictionary keyValuePairs, CookieOptions options) + { + throw new NotImplementedException(); + } + public void Delete(string key, CookieOptions options) { throw new NotImplementedException(); diff --git a/src/Mvc/Mvc.ViewFeatures/test/CookieTempDataProviderTest.cs b/src/Mvc/Mvc.ViewFeatures/test/CookieTempDataProviderTest.cs index 892c6f114671..722ab129ec94 100644 --- a/src/Mvc/Mvc.ViewFeatures/test/CookieTempDataProviderTest.cs +++ b/src/Mvc/Mvc.ViewFeatures/test/CookieTempDataProviderTest.cs @@ -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. using System; @@ -416,6 +416,19 @@ IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } + + public void Append(IDictionary keyValuePairs, CookieOptions options) + { + foreach (var keyValuePair in keyValuePairs) + { + _cookies[keyValuePair.Key] = new CookieInfo() + { + Key = keyValuePair.Key, + Value = keyValuePair.Value, + Options = options + }; + } + } } private CookieTempDataProvider GetProvider(IDataProtector dataProtector = null, CookieTempDataProviderOptions options = null) @@ -501,4 +514,4 @@ public override byte[] Serialize(IDictionary values) } } } -} \ No newline at end of file +} diff --git a/src/Security/CookiePolicy/test/CookieChunkingTests.cs b/src/Security/CookiePolicy/test/CookieChunkingTests.cs index dd4541b58d17..d2bc0d4ef1a4 100644 --- a/src/Security/CookiePolicy/test/CookieChunkingTests.cs +++ b/src/Security/CookiePolicy/test/CookieChunkingTests.cs @@ -31,7 +31,7 @@ public void AppendLargeCookie_WithOptions_Appended() { Domain = "foo.com", HttpOnly = true, - SameSite = SameSiteMode.Strict, + SameSite = Http.SameSiteMode.Strict, Path = "/bar", Secure = true, Expires = now.AddMinutes(5), From 57a9b65ebfaeaa52ff9a2e986b3ac1eadba6fe35 Mon Sep 17 00:00:00 2001 From: Juan Barahona Date: Fri, 9 Apr 2021 20:24:15 -0400 Subject: [PATCH 04/12] Addressing feedback given by asp.net team --- .../test/DefaultAntiforgeryTokenStoreTest.cs | 2 +- src/Http/Http.Features/src/IResponseCookies.cs | 2 +- src/Http/Http.Features/src/PublicAPI.Unshipped.txt | 2 +- src/Http/Http/src/Internal/ResponseCookies.cs | 9 +++++---- .../test/CookieTempDataProviderTest.cs | 2 +- .../CookiePolicy/src/ResponseCookiesWrapper.cs | 2 +- .../CookiePolicy/test/CookiePolicyTests.cs | 2 +- .../ChunkingCookieManager/ChunkingCookieManager.cs | 14 ++++++-------- 8 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/Antiforgery/test/DefaultAntiforgeryTokenStoreTest.cs b/src/Antiforgery/test/DefaultAntiforgeryTokenStoreTest.cs index 68f663f5d54f..2bca817f0cef 100644 --- a/src/Antiforgery/test/DefaultAntiforgeryTokenStoreTest.cs +++ b/src/Antiforgery/test/DefaultAntiforgeryTokenStoreTest.cs @@ -491,7 +491,7 @@ public void Append(string key, string value) throw new NotImplementedException(); } - public void Append(IDictionary keyValuePairs, CookieOptions options) + public void Append(IEnumerable> keyValuePairs, CookieOptions options) { throw new NotImplementedException(); } diff --git a/src/Http/Http.Features/src/IResponseCookies.cs b/src/Http/Http.Features/src/IResponseCookies.cs index cfa2267110e7..d729c6b843ae 100644 --- a/src/Http/Http.Features/src/IResponseCookies.cs +++ b/src/Http/Http.Features/src/IResponseCookies.cs @@ -30,7 +30,7 @@ public interface IResponseCookies /// /// Key value pair collections whose elements will be added as cookies. /// included in new cookie settings. - void Append(IDictionary keyValuePairs, CookieOptions options); + void Append(IEnumerable> keyValuePairs, CookieOptions options); /// /// Sets an expired cookie. diff --git a/src/Http/Http.Features/src/PublicAPI.Unshipped.txt b/src/Http/Http.Features/src/PublicAPI.Unshipped.txt index 731be38c5005..75bb40387cdd 100644 --- a/src/Http/Http.Features/src/PublicAPI.Unshipped.txt +++ b/src/Http/Http.Features/src/PublicAPI.Unshipped.txt @@ -15,4 +15,4 @@ Microsoft.AspNetCore.Http.Features.IFeatureCollection.Set(TFeature? in Microsoft.AspNetCore.Http.Features.IServerVariablesFeature.this[string! variableName].get -> string? Microsoft.AspNetCore.Http.ISession.TryGetValue(string! key, out byte[]? value) -> bool Microsoft.AspNetCore.Http.Features.FeatureCollection.FeatureCollection(int initialCapacity) -> void -Microsoft.AspNetCore.Http.IResponseCookies.Append(System.Collections.Generic.IDictionary! keyValuePairs, Microsoft.AspNetCore.Http.CookieOptions! options) -> void +Microsoft.AspNetCore.Http.IResponseCookies.Append(System.Collections.Generic.IEnumerable>! keyValuePairs, Microsoft.AspNetCore.Http.CookieOptions! options) -> void diff --git a/src/Http/Http/src/Internal/ResponseCookies.cs b/src/Http/Http/src/Internal/ResponseCookies.cs index 25c905647d8f..7672ed88ed1b 100644 --- a/src/Http/Http/src/Internal/ResponseCookies.cs +++ b/src/Http/Http/src/Internal/ResponseCookies.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Linq; using Microsoft.AspNetCore.Http.Features; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -89,7 +90,7 @@ public void Append(string key, string value, CookieOptions options) } /// - public void Append(IDictionary keyValuePairs, CookieOptions options) + public void Append(IEnumerable> keyValuePairs, CookieOptions options) { if (options == null) { @@ -126,17 +127,17 @@ public void Append(IDictionary keyValuePairs, CookieOptions opti }; var cookierHeaderValue = setCookieHeaderValue.ToString()[1..]; - var cookies = new string[keyValuePairs.Count]; + var cookies = new string[keyValuePairs.Count()]; var position = 0; foreach (var keyValuePair in keyValuePairs) { - cookies[position] = $"{keyValuePair.Key}={keyValuePair.Value}{cookierHeaderValue}"; + + cookies[position] = string.Concat(_enableCookieNameEncoding ? Uri.EscapeDataString(keyValuePair.Key) : keyValuePair.Key, "=", Uri.EscapeDataString(keyValuePair.Value), cookierHeaderValue); position++; } Headers.Append(HeaderNames.SetCookie, cookies); - } /// diff --git a/src/Mvc/Mvc.ViewFeatures/test/CookieTempDataProviderTest.cs b/src/Mvc/Mvc.ViewFeatures/test/CookieTempDataProviderTest.cs index 722ab129ec94..bbd157790a96 100644 --- a/src/Mvc/Mvc.ViewFeatures/test/CookieTempDataProviderTest.cs +++ b/src/Mvc/Mvc.ViewFeatures/test/CookieTempDataProviderTest.cs @@ -417,7 +417,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetEnumerator(); } - public void Append(IDictionary keyValuePairs, CookieOptions options) + public void Append(IEnumerable> keyValuePairs, CookieOptions options) { foreach (var keyValuePair in keyValuePairs) { diff --git a/src/Security/CookiePolicy/src/ResponseCookiesWrapper.cs b/src/Security/CookiePolicy/src/ResponseCookiesWrapper.cs index 513536262810..d6e62ed5a76f 100644 --- a/src/Security/CookiePolicy/src/ResponseCookiesWrapper.cs +++ b/src/Security/CookiePolicy/src/ResponseCookiesWrapper.cs @@ -153,7 +153,7 @@ public void Append(string key, string value, CookieOptions options) } } - public void Append(IDictionary keyValuePairs, CookieOptions options) + public void Append(IEnumerable> keyValuePairs, CookieOptions options) { if (options == null) { diff --git a/src/Security/CookiePolicy/test/CookiePolicyTests.cs b/src/Security/CookiePolicy/test/CookiePolicyTests.cs index 1eeee43afd8d..306468ca6b13 100644 --- a/src/Security/CookiePolicy/test/CookiePolicyTests.cs +++ b/src/Security/CookiePolicy/test/CookiePolicyTests.cs @@ -486,7 +486,7 @@ public void Append(string key, string value, CookieOptions options) throw new NotImplementedException(); } - public void Append(IDictionary keyValuePairs, CookieOptions options) + public void Append(IEnumerable> keyValuePairs, CookieOptions options) { throw new NotImplementedException(); } diff --git a/src/Shared/ChunkingCookieManager/ChunkingCookieManager.cs b/src/Shared/ChunkingCookieManager/ChunkingCookieManager.cs index cdeee679d5b2..bd8746d9577e 100644 --- a/src/Shared/ChunkingCookieManager/ChunkingCookieManager.cs +++ b/src/Shared/ChunkingCookieManager/ChunkingCookieManager.cs @@ -208,12 +208,11 @@ public void AppendResponseCookie(HttpContext context, string key, string? value, var dataSizePerCookie = ChunkSize.Value - templateLength - 3; // Budget 3 chars for the chunkid. var cookieChunkCount = (int)Math.Ceiling(value.Length * 1.0 / dataSizePerCookie); - IDictionary keyValuePairs = new Dictionary(cookieChunkCount) + List> keyValuePairs = new(cookieChunkCount) { - [key] = ChunkCountPrefix + cookieChunkCount.ToString(CultureInfo.InvariantCulture) + KeyValuePair.Create(key, ChunkCountPrefix + cookieChunkCount.ToString(CultureInfo.InvariantCulture)) }; - var offset = 0; for (var chunkId = 1; chunkId <= cookieChunkCount; chunkId++) { @@ -221,7 +220,7 @@ public void AppendResponseCookie(HttpContext context, string key, string? value, var length = Math.Min(dataSizePerCookie, remainingLength); var segment = value.Substring(offset, length); offset += length; - keyValuePairs.Add(key + ChunkKeySuffix + chunkId.ToString(CultureInfo.InvariantCulture), segment); + keyValuePairs.Add(KeyValuePair.Create(string.Concat(key, ChunkKeySuffix, chunkId.ToString(CultureInfo.InvariantCulture)), segment)); } responseCookies.Append(keyValuePairs, options); @@ -307,15 +306,14 @@ public void DeleteCookie(HttpContext context, string key, CookieOptions options) var responseCookies = context.Response.Cookies; - - IDictionary keyValuePairs = new Dictionary(chunks) + List> keyValuePairs = new(chunks) { - [key] = string.Empty + KeyValuePair.Create(key, string.Empty) }; for (var i = 1; i <= chunks; i++) { - keyValuePairs.Add(key + "C" + i.ToString(CultureInfo.InvariantCulture), string.Empty); + keyValuePairs.Add(KeyValuePair.Create(string.Concat(key, "C", i.ToString(CultureInfo.InvariantCulture)), string.Empty)); } responseCookies.Append(keyValuePairs, new CookieOptions() From 9a5538162a903dc16d9de37585696a45ca4ce32d Mon Sep 17 00:00:00 2001 From: Juan Barahona Date: Fri, 9 Apr 2021 20:44:57 -0400 Subject: [PATCH 05/12] Remove spaces --- src/Http/Http/src/Internal/ResponseCookies.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Http/Http/src/Internal/ResponseCookies.cs b/src/Http/Http/src/Internal/ResponseCookies.cs index 7672ed88ed1b..ebf84897fe18 100644 --- a/src/Http/Http/src/Internal/ResponseCookies.cs +++ b/src/Http/Http/src/Internal/ResponseCookies.cs @@ -132,7 +132,6 @@ public void Append(IEnumerable> keyValuePairs, Cook foreach (var keyValuePair in keyValuePairs) { - cookies[position] = string.Concat(_enableCookieNameEncoding ? Uri.EscapeDataString(keyValuePair.Key) : keyValuePair.Key, "=", Uri.EscapeDataString(keyValuePair.Value), cookierHeaderValue); position++; } From 2a2d15ada23737575e71be4931fb4fbc35e4b79b Mon Sep 17 00:00:00 2001 From: Juan Barahona Date: Mon, 12 Apr 2021 16:28:33 -0400 Subject: [PATCH 06/12] Changing to use readonlyspan --- .../test/DefaultAntiforgeryTokenStoreTest.cs | 2 +- .../Http.Features/src/IResponseCookies.cs | 3 ++- .../Http.Features/src/PublicAPI.Unshipped.txt | 2 +- src/Http/Http/src/Internal/ResponseCookies.cs | 5 ++--- .../test/CookieTempDataProviderTest.cs | 2 +- .../src/ResponseCookiesWrapper.cs | 8 ++++---- .../CookiePolicy/test/CookiePolicyTests.cs | 2 +- .../ChunkingCookieManager.cs | 20 ++++++++----------- 8 files changed, 20 insertions(+), 24 deletions(-) diff --git a/src/Antiforgery/test/DefaultAntiforgeryTokenStoreTest.cs b/src/Antiforgery/test/DefaultAntiforgeryTokenStoreTest.cs index 2bca817f0cef..e54fbb536b25 100644 --- a/src/Antiforgery/test/DefaultAntiforgeryTokenStoreTest.cs +++ b/src/Antiforgery/test/DefaultAntiforgeryTokenStoreTest.cs @@ -491,7 +491,7 @@ public void Append(string key, string value) throw new NotImplementedException(); } - public void Append(IEnumerable> keyValuePairs, CookieOptions options) + public void Append(ReadOnlySpan> keyValuePairs, CookieOptions options) { throw new NotImplementedException(); } diff --git a/src/Http/Http.Features/src/IResponseCookies.cs b/src/Http/Http.Features/src/IResponseCookies.cs index d729c6b843ae..b7fe9f26c677 100644 --- a/src/Http/Http.Features/src/IResponseCookies.cs +++ b/src/Http/Http.Features/src/IResponseCookies.cs @@ -1,6 +1,7 @@ // 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. +using System; using System.Collections.Generic; namespace Microsoft.AspNetCore.Http @@ -30,7 +31,7 @@ public interface IResponseCookies /// /// Key value pair collections whose elements will be added as cookies. /// included in new cookie settings. - void Append(IEnumerable> keyValuePairs, CookieOptions options); + void Append(ReadOnlySpan> keyValuePairs, CookieOptions options); /// /// Sets an expired cookie. diff --git a/src/Http/Http.Features/src/PublicAPI.Unshipped.txt b/src/Http/Http.Features/src/PublicAPI.Unshipped.txt index 75bb40387cdd..1298da03ad35 100644 --- a/src/Http/Http.Features/src/PublicAPI.Unshipped.txt +++ b/src/Http/Http.Features/src/PublicAPI.Unshipped.txt @@ -15,4 +15,4 @@ Microsoft.AspNetCore.Http.Features.IFeatureCollection.Set(TFeature? in Microsoft.AspNetCore.Http.Features.IServerVariablesFeature.this[string! variableName].get -> string? Microsoft.AspNetCore.Http.ISession.TryGetValue(string! key, out byte[]? value) -> bool Microsoft.AspNetCore.Http.Features.FeatureCollection.FeatureCollection(int initialCapacity) -> void -Microsoft.AspNetCore.Http.IResponseCookies.Append(System.Collections.Generic.IEnumerable>! keyValuePairs, Microsoft.AspNetCore.Http.CookieOptions! options) -> void +Microsoft.AspNetCore.Http.IResponseCookies.Append(System.ReadOnlySpan> keyValuePairs, Microsoft.AspNetCore.Http.CookieOptions! options) -> void diff --git a/src/Http/Http/src/Internal/ResponseCookies.cs b/src/Http/Http/src/Internal/ResponseCookies.cs index ebf84897fe18..af7a4fc4b6a4 100644 --- a/src/Http/Http/src/Internal/ResponseCookies.cs +++ b/src/Http/Http/src/Internal/ResponseCookies.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Linq; using Microsoft.AspNetCore.Http.Features; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -90,7 +89,7 @@ public void Append(string key, string value, CookieOptions options) } /// - public void Append(IEnumerable> keyValuePairs, CookieOptions options) + public void Append(ReadOnlySpan> keyValuePairs, CookieOptions options) { if (options == null) { @@ -127,7 +126,7 @@ public void Append(IEnumerable> keyValuePairs, Cook }; var cookierHeaderValue = setCookieHeaderValue.ToString()[1..]; - var cookies = new string[keyValuePairs.Count()]; + var cookies = new string[keyValuePairs.Length]; var position = 0; foreach (var keyValuePair in keyValuePairs) diff --git a/src/Mvc/Mvc.ViewFeatures/test/CookieTempDataProviderTest.cs b/src/Mvc/Mvc.ViewFeatures/test/CookieTempDataProviderTest.cs index bbd157790a96..15f8cc81ff62 100644 --- a/src/Mvc/Mvc.ViewFeatures/test/CookieTempDataProviderTest.cs +++ b/src/Mvc/Mvc.ViewFeatures/test/CookieTempDataProviderTest.cs @@ -417,7 +417,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetEnumerator(); } - public void Append(IEnumerable> keyValuePairs, CookieOptions options) + public void Append(ReadOnlySpan> keyValuePairs, CookieOptions options) { foreach (var keyValuePair in keyValuePairs) { diff --git a/src/Security/CookiePolicy/src/ResponseCookiesWrapper.cs b/src/Security/CookiePolicy/src/ResponseCookiesWrapper.cs index d6e62ed5a76f..c4e908b3df72 100644 --- a/src/Security/CookiePolicy/src/ResponseCookiesWrapper.cs +++ b/src/Security/CookiePolicy/src/ResponseCookiesWrapper.cs @@ -153,14 +153,14 @@ public void Append(string key, string value, CookieOptions options) } } - public void Append(IEnumerable> keyValuePairs, CookieOptions options) + public void Append(ReadOnlySpan> keyValuePairs, CookieOptions options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } - var nonSuppressedValues = new Dictionary(); + var nonSuppressedValues = new List>(); foreach (var keyValuePair in keyValuePairs) { @@ -169,7 +169,7 @@ public void Append(IEnumerable> keyValuePairs, Cook if (ApplyAppendPolicy(ref key, ref value, options)) { - nonSuppressedValues.Add(key, value); + nonSuppressedValues.Add(KeyValuePair.Create(key, value)); } else { @@ -177,7 +177,7 @@ public void Append(IEnumerable> keyValuePairs, Cook } } - Cookies.Append(nonSuppressedValues, options); + Cookies.Append(nonSuppressedValues.ToArray(), options); } private bool ApplyAppendPolicy(ref string key, ref string value, CookieOptions options) diff --git a/src/Security/CookiePolicy/test/CookiePolicyTests.cs b/src/Security/CookiePolicy/test/CookiePolicyTests.cs index 306468ca6b13..15447a02fbb1 100644 --- a/src/Security/CookiePolicy/test/CookiePolicyTests.cs +++ b/src/Security/CookiePolicy/test/CookiePolicyTests.cs @@ -486,7 +486,7 @@ public void Append(string key, string value, CookieOptions options) throw new NotImplementedException(); } - public void Append(IEnumerable> keyValuePairs, CookieOptions options) + public void Append(ReadOnlySpan> keyValuePairs, CookieOptions options) { throw new NotImplementedException(); } diff --git a/src/Shared/ChunkingCookieManager/ChunkingCookieManager.cs b/src/Shared/ChunkingCookieManager/ChunkingCookieManager.cs index bd8746d9577e..5702cf5729ea 100644 --- a/src/Shared/ChunkingCookieManager/ChunkingCookieManager.cs +++ b/src/Shared/ChunkingCookieManager/ChunkingCookieManager.cs @@ -208,11 +208,9 @@ public void AppendResponseCookie(HttpContext context, string key, string? value, var dataSizePerCookie = ChunkSize.Value - templateLength - 3; // Budget 3 chars for the chunkid. var cookieChunkCount = (int)Math.Ceiling(value.Length * 1.0 / dataSizePerCookie); - List> keyValuePairs = new(cookieChunkCount) - { - KeyValuePair.Create(key, ChunkCountPrefix + cookieChunkCount.ToString(CultureInfo.InvariantCulture)) - }; - + var keyValuePairs = new KeyValuePair[cookieChunkCount + 1]; + keyValuePairs[0] = KeyValuePair.Create(key, ChunkCountPrefix + cookieChunkCount.ToString(CultureInfo.InvariantCulture)); + var offset = 0; for (var chunkId = 1; chunkId <= cookieChunkCount; chunkId++) { @@ -220,7 +218,7 @@ public void AppendResponseCookie(HttpContext context, string key, string? value, var length = Math.Min(dataSizePerCookie, remainingLength); var segment = value.Substring(offset, length); offset += length; - keyValuePairs.Add(KeyValuePair.Create(string.Concat(key, ChunkKeySuffix, chunkId.ToString(CultureInfo.InvariantCulture)), segment)); + keyValuePairs[chunkId] = KeyValuePair.Create(string.Concat(key, ChunkKeySuffix, chunkId.ToString(CultureInfo.InvariantCulture)), segment); } responseCookies.Append(keyValuePairs, options); @@ -306,14 +304,12 @@ public void DeleteCookie(HttpContext context, string key, CookieOptions options) var responseCookies = context.Response.Cookies; - List> keyValuePairs = new(chunks) - { - KeyValuePair.Create(key, string.Empty) - }; - + var keyValuePairs = new KeyValuePair[chunks + 1]; + keyValuePairs[0] = KeyValuePair.Create(key, string.Empty); + for (var i = 1; i <= chunks; i++) { - keyValuePairs.Add(KeyValuePair.Create(string.Concat(key, "C", i.ToString(CultureInfo.InvariantCulture)), string.Empty)); + keyValuePairs[i] = KeyValuePair.Create(string.Concat(key, "C", i.ToString(CultureInfo.InvariantCulture)), string.Empty); } responseCookies.Append(keyValuePairs, new CookieOptions() From df9ee2fa8ef44dac544ebafc0ee7079c328f0267 Mon Sep 17 00:00:00 2001 From: Juan Barahona Date: Fri, 16 Apr 2021 21:06:55 -0400 Subject: [PATCH 07/12] Adding DIM as discussion point --- src/Http/Http.Features/src/IResponseCookies.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Http/Http.Features/src/IResponseCookies.cs b/src/Http/Http.Features/src/IResponseCookies.cs index b7fe9f26c677..f59a42d949a0 100644 --- a/src/Http/Http.Features/src/IResponseCookies.cs +++ b/src/Http/Http.Features/src/IResponseCookies.cs @@ -1,8 +1,10 @@ // 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. +#if NET6_0 using System; using System.Collections.Generic; +#endif namespace Microsoft.AspNetCore.Http { @@ -26,12 +28,20 @@ public interface IResponseCookies /// included in the new cookie setting. void Append(string key, string value, CookieOptions options); +#if NET6_0 /// /// Add elements of specified dictionary as cookies. /// /// Key value pair collections whose elements will be added as cookies. /// included in new cookie settings. - void Append(ReadOnlySpan> keyValuePairs, CookieOptions options); + void Append(ReadOnlySpan> keyValuePairs, CookieOptions options) + { + foreach (var keyValuePair in keyValuePairs) + { + Append(keyValuePair.Key, keyValuePair.Value, options); + } + } +#endif /// /// Sets an expired cookie. From 771023023893e399afd0c151e8039833f9207457 Mon Sep 17 00:00:00 2001 From: Juan Barahona Date: Fri, 16 Apr 2021 21:08:31 -0400 Subject: [PATCH 08/12] CollectionMarshal --- src/Security/CookiePolicy/src/ResponseCookiesWrapper.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Security/CookiePolicy/src/ResponseCookiesWrapper.cs b/src/Security/CookiePolicy/src/ResponseCookiesWrapper.cs index c4e908b3df72..74cc9b7ba3a9 100644 --- a/src/Security/CookiePolicy/src/ResponseCookiesWrapper.cs +++ b/src/Security/CookiePolicy/src/ResponseCookiesWrapper.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Runtime.InteropServices; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; @@ -177,7 +178,7 @@ public void Append(ReadOnlySpan> keyValuePairs, Coo } } - Cookies.Append(nonSuppressedValues.ToArray(), options); + Cookies.Append(CollectionsMarshal.AsSpan(nonSuppressedValues), options); } private bool ApplyAppendPolicy(ref string key, ref string value, CookieOptions options) From ffb399b306dc652b06a4208a283d105f823e5c98 Mon Sep 17 00:00:00 2001 From: Juan Barahona Date: Sat, 17 Apr 2021 21:30:09 -0400 Subject: [PATCH 09/12] Removing unnecesary implementations and fixing public api --- .../test/DefaultAntiforgeryTokenStoreTest.cs | 5 ----- src/Http/Http.Features/src/IResponseCookies.cs | 4 ++-- src/Http/Http.Features/src/PublicAPI.Unshipped.txt | 2 ++ .../test/CookieTempDataProviderTest.cs | 13 ------------- src/Security/CookiePolicy/test/CookiePolicyTests.cs | 5 ----- 5 files changed, 4 insertions(+), 25 deletions(-) diff --git a/src/Antiforgery/test/DefaultAntiforgeryTokenStoreTest.cs b/src/Antiforgery/test/DefaultAntiforgeryTokenStoreTest.cs index e54fbb536b25..8456ee318ad1 100644 --- a/src/Antiforgery/test/DefaultAntiforgeryTokenStoreTest.cs +++ b/src/Antiforgery/test/DefaultAntiforgeryTokenStoreTest.cs @@ -491,11 +491,6 @@ public void Append(string key, string value) throw new NotImplementedException(); } - public void Append(ReadOnlySpan> keyValuePairs, CookieOptions options) - { - throw new NotImplementedException(); - } - public void Delete(string key, CookieOptions options) { throw new NotImplementedException(); diff --git a/src/Http/Http.Features/src/IResponseCookies.cs b/src/Http/Http.Features/src/IResponseCookies.cs index f59a42d949a0..5a7233005eda 100644 --- a/src/Http/Http.Features/src/IResponseCookies.cs +++ b/src/Http/Http.Features/src/IResponseCookies.cs @@ -1,7 +1,7 @@ // 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. -#if NET6_0 +#if NET6_0_OR_GREATER using System; using System.Collections.Generic; #endif @@ -28,7 +28,7 @@ public interface IResponseCookies /// included in the new cookie setting. void Append(string key, string value, CookieOptions options); -#if NET6_0 +#if NET6_0_OR_GREATER /// /// Add elements of specified dictionary as cookies. /// diff --git a/src/Http/Http.Features/src/PublicAPI.Unshipped.txt b/src/Http/Http.Features/src/PublicAPI.Unshipped.txt index 1298da03ad35..b2bba1b1184b 100644 --- a/src/Http/Http.Features/src/PublicAPI.Unshipped.txt +++ b/src/Http/Http.Features/src/PublicAPI.Unshipped.txt @@ -15,4 +15,6 @@ Microsoft.AspNetCore.Http.Features.IFeatureCollection.Set(TFeature? in Microsoft.AspNetCore.Http.Features.IServerVariablesFeature.this[string! variableName].get -> string? Microsoft.AspNetCore.Http.ISession.TryGetValue(string! key, out byte[]? value) -> bool Microsoft.AspNetCore.Http.Features.FeatureCollection.FeatureCollection(int initialCapacity) -> void +#if NET6_0_OR_GREATER Microsoft.AspNetCore.Http.IResponseCookies.Append(System.ReadOnlySpan> keyValuePairs, Microsoft.AspNetCore.Http.CookieOptions! options) -> void +#endif diff --git a/src/Mvc/Mvc.ViewFeatures/test/CookieTempDataProviderTest.cs b/src/Mvc/Mvc.ViewFeatures/test/CookieTempDataProviderTest.cs index 15f8cc81ff62..a1ee55c5449d 100644 --- a/src/Mvc/Mvc.ViewFeatures/test/CookieTempDataProviderTest.cs +++ b/src/Mvc/Mvc.ViewFeatures/test/CookieTempDataProviderTest.cs @@ -416,19 +416,6 @@ IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } - - public void Append(ReadOnlySpan> keyValuePairs, CookieOptions options) - { - foreach (var keyValuePair in keyValuePairs) - { - _cookies[keyValuePair.Key] = new CookieInfo() - { - Key = keyValuePair.Key, - Value = keyValuePair.Value, - Options = options - }; - } - } } private CookieTempDataProvider GetProvider(IDataProtector dataProtector = null, CookieTempDataProviderOptions options = null) diff --git a/src/Security/CookiePolicy/test/CookiePolicyTests.cs b/src/Security/CookiePolicy/test/CookiePolicyTests.cs index 15447a02fbb1..677fc2a08501 100644 --- a/src/Security/CookiePolicy/test/CookiePolicyTests.cs +++ b/src/Security/CookiePolicy/test/CookiePolicyTests.cs @@ -486,11 +486,6 @@ public void Append(string key, string value, CookieOptions options) throw new NotImplementedException(); } - public void Append(ReadOnlySpan> keyValuePairs, CookieOptions options) - { - throw new NotImplementedException(); - } - public void Delete(string key) { throw new NotImplementedException(); From 3a119504a52d8482201428b43ca0b2ea60cee8e6 Mon Sep 17 00:00:00 2001 From: Juan Barahona Date: Sun, 18 Apr 2021 13:52:12 -0400 Subject: [PATCH 10/12] Fixing public api for different targets --- .../Microsoft.AspNetCore.Http.Features.csproj | 10 +- .../net461}/PublicAPI.Shipped.txt | 0 .../PublicAPI/net461/PublicAPI.Unshipped.txt | 17 ++ .../PublicAPI/net6.0/PublicAPI.Shipped.txt | 247 ++++++++++++++++++ .../net6.0}/PublicAPI.Unshipped.txt | 2 - .../netstandard2.0/PublicAPI.Shipped.txt | 247 ++++++++++++++++++ .../netstandard2.0/PublicAPI.Unshipped.txt | 17 ++ 7 files changed, 535 insertions(+), 5 deletions(-) rename src/Http/Http.Features/src/{ => PublicAPI/net461}/PublicAPI.Shipped.txt (100%) create mode 100644 src/Http/Http.Features/src/PublicAPI/net461/PublicAPI.Unshipped.txt create mode 100644 src/Http/Http.Features/src/PublicAPI/net6.0/PublicAPI.Shipped.txt rename src/Http/Http.Features/src/{ => PublicAPI/net6.0}/PublicAPI.Unshipped.txt (98%) create mode 100644 src/Http/Http.Features/src/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt create mode 100644 src/Http/Http.Features/src/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt diff --git a/src/Http/Http.Features/src/Microsoft.AspNetCore.Http.Features.csproj b/src/Http/Http.Features/src/Microsoft.AspNetCore.Http.Features.csproj index 29f075d6dc70..dc05abb5cd73 100644 --- a/src/Http/Http.Features/src/Microsoft.AspNetCore.Http.Features.csproj +++ b/src/Http/Http.Features/src/Microsoft.AspNetCore.Http.Features.csproj @@ -1,4 +1,4 @@ - + ASP.NET Core HTTP feature interface definitions. @@ -10,10 +10,14 @@ enable - - + + + + + + diff --git a/src/Http/Http.Features/src/PublicAPI.Shipped.txt b/src/Http/Http.Features/src/PublicAPI/net461/PublicAPI.Shipped.txt similarity index 100% rename from src/Http/Http.Features/src/PublicAPI.Shipped.txt rename to src/Http/Http.Features/src/PublicAPI/net461/PublicAPI.Shipped.txt diff --git a/src/Http/Http.Features/src/PublicAPI/net461/PublicAPI.Unshipped.txt b/src/Http/Http.Features/src/PublicAPI/net461/PublicAPI.Unshipped.txt new file mode 100644 index 000000000000..4cc6095ff65a --- /dev/null +++ b/src/Http/Http.Features/src/PublicAPI/net461/PublicAPI.Unshipped.txt @@ -0,0 +1,17 @@ +#nullable enable +*REMOVED*Microsoft.AspNetCore.Http.Features.FeatureCollection.Set(TFeature instance) -> void +*REMOVED*Microsoft.AspNetCore.Http.Features.IFeatureCollection.Get() -> TFeature +*REMOVED*Microsoft.AspNetCore.Http.Features.IFeatureCollection.Set(TFeature instance) -> void +*REMOVED*Microsoft.AspNetCore.Http.Features.IHttpBufferingFeature +*REMOVED*Microsoft.AspNetCore.Http.Features.IHttpBufferingFeature.DisableRequestBuffering() -> void +*REMOVED*Microsoft.AspNetCore.Http.Features.IHttpBufferingFeature.DisableResponseBuffering() -> void +*REMOVED*Microsoft.AspNetCore.Http.Features.IHttpSendFileFeature +*REMOVED*Microsoft.AspNetCore.Http.Features.IHttpSendFileFeature.SendFileAsync(string! path, long offset, long? count, System.Threading.CancellationToken cancellation) -> System.Threading.Tasks.Task! +*REMOVED*Microsoft.AspNetCore.Http.Features.IServerVariablesFeature.this[string! variableName].get -> string! +*REMOVED*Microsoft.AspNetCore.Http.ISession.TryGetValue(string! key, out byte[]! value) -> bool +Microsoft.AspNetCore.Http.Features.FeatureCollection.Set(TFeature? instance) -> void +Microsoft.AspNetCore.Http.Features.IFeatureCollection.Get() -> TFeature? +Microsoft.AspNetCore.Http.Features.IFeatureCollection.Set(TFeature? instance) -> void +Microsoft.AspNetCore.Http.Features.IServerVariablesFeature.this[string! variableName].get -> string? +Microsoft.AspNetCore.Http.ISession.TryGetValue(string! key, out byte[]? value) -> bool +Microsoft.AspNetCore.Http.Features.FeatureCollection.FeatureCollection(int initialCapacity) -> void diff --git a/src/Http/Http.Features/src/PublicAPI/net6.0/PublicAPI.Shipped.txt b/src/Http/Http.Features/src/PublicAPI/net6.0/PublicAPI.Shipped.txt new file mode 100644 index 000000000000..f97bf2426e2e --- /dev/null +++ b/src/Http/Http.Features/src/PublicAPI/net6.0/PublicAPI.Shipped.txt @@ -0,0 +1,247 @@ +#nullable enable +Microsoft.AspNetCore.Http.CookieOptions +Microsoft.AspNetCore.Http.CookieOptions.CookieOptions() -> void +Microsoft.AspNetCore.Http.CookieOptions.Domain.get -> string? +Microsoft.AspNetCore.Http.CookieOptions.Domain.set -> void +Microsoft.AspNetCore.Http.CookieOptions.Expires.get -> System.DateTimeOffset? +Microsoft.AspNetCore.Http.CookieOptions.Expires.set -> void +Microsoft.AspNetCore.Http.CookieOptions.HttpOnly.get -> bool +Microsoft.AspNetCore.Http.CookieOptions.HttpOnly.set -> void +Microsoft.AspNetCore.Http.CookieOptions.IsEssential.get -> bool +Microsoft.AspNetCore.Http.CookieOptions.IsEssential.set -> void +Microsoft.AspNetCore.Http.CookieOptions.MaxAge.get -> System.TimeSpan? +Microsoft.AspNetCore.Http.CookieOptions.MaxAge.set -> void +Microsoft.AspNetCore.Http.CookieOptions.Path.get -> string? +Microsoft.AspNetCore.Http.CookieOptions.Path.set -> void +Microsoft.AspNetCore.Http.CookieOptions.SameSite.get -> Microsoft.AspNetCore.Http.SameSiteMode +Microsoft.AspNetCore.Http.CookieOptions.SameSite.set -> void +Microsoft.AspNetCore.Http.CookieOptions.Secure.get -> bool +Microsoft.AspNetCore.Http.CookieOptions.Secure.set -> void +Microsoft.AspNetCore.Http.Features.Authentication.IHttpAuthenticationFeature +Microsoft.AspNetCore.Http.Features.Authentication.IHttpAuthenticationFeature.User.get -> System.Security.Claims.ClaimsPrincipal? +Microsoft.AspNetCore.Http.Features.Authentication.IHttpAuthenticationFeature.User.set -> void +Microsoft.AspNetCore.Http.Features.FeatureCollection +Microsoft.AspNetCore.Http.Features.FeatureCollection.FeatureCollection() -> void +Microsoft.AspNetCore.Http.Features.FeatureCollection.FeatureCollection(Microsoft.AspNetCore.Http.Features.IFeatureCollection! defaults) -> void +Microsoft.AspNetCore.Http.Features.FeatureCollection.Get() -> TFeature? +Microsoft.AspNetCore.Http.Features.FeatureCollection.GetEnumerator() -> System.Collections.Generic.IEnumerator>! +Microsoft.AspNetCore.Http.Features.FeatureCollection.IsReadOnly.get -> bool +Microsoft.AspNetCore.Http.Features.FeatureCollection.Set(TFeature instance) -> void +Microsoft.AspNetCore.Http.Features.FeatureCollection.this[System.Type! key].get -> object? +Microsoft.AspNetCore.Http.Features.FeatureCollection.this[System.Type! key].set -> void +Microsoft.AspNetCore.Http.Features.FeatureReference +Microsoft.AspNetCore.Http.Features.FeatureReference.Fetch(Microsoft.AspNetCore.Http.Features.IFeatureCollection! features) -> T? +Microsoft.AspNetCore.Http.Features.FeatureReference.Update(Microsoft.AspNetCore.Http.Features.IFeatureCollection! features, T feature) -> T +Microsoft.AspNetCore.Http.Features.FeatureReferences +Microsoft.AspNetCore.Http.Features.FeatureReferences.Cache -> TCache? +Microsoft.AspNetCore.Http.Features.FeatureReferences.Collection.get -> Microsoft.AspNetCore.Http.Features.IFeatureCollection! +Microsoft.AspNetCore.Http.Features.FeatureReferences.FeatureReferences(Microsoft.AspNetCore.Http.Features.IFeatureCollection! collection) -> void +Microsoft.AspNetCore.Http.Features.FeatureReferences.Fetch(ref TFeature? cached, TState state, System.Func! factory) -> TFeature? +Microsoft.AspNetCore.Http.Features.FeatureReferences.Fetch(ref TFeature? cached, System.Func! factory) -> TFeature? +Microsoft.AspNetCore.Http.Features.FeatureReferences.Initalize(Microsoft.AspNetCore.Http.Features.IFeatureCollection! collection) -> void +Microsoft.AspNetCore.Http.Features.FeatureReferences.Initalize(Microsoft.AspNetCore.Http.Features.IFeatureCollection! collection, int revision) -> void +Microsoft.AspNetCore.Http.Features.FeatureReferences.Revision.get -> int +Microsoft.AspNetCore.Http.Features.HttpsCompressionMode +Microsoft.AspNetCore.Http.Features.HttpsCompressionMode.Compress = 2 -> Microsoft.AspNetCore.Http.Features.HttpsCompressionMode +Microsoft.AspNetCore.Http.Features.HttpsCompressionMode.Default = 0 -> Microsoft.AspNetCore.Http.Features.HttpsCompressionMode +Microsoft.AspNetCore.Http.Features.HttpsCompressionMode.DoNotCompress = 1 -> Microsoft.AspNetCore.Http.Features.HttpsCompressionMode +Microsoft.AspNetCore.Http.Features.IFeatureCollection +Microsoft.AspNetCore.Http.Features.IFeatureCollection.Get() -> TFeature +Microsoft.AspNetCore.Http.Features.IFeatureCollection.IsReadOnly.get -> bool +Microsoft.AspNetCore.Http.Features.IFeatureCollection.Revision.get -> int +Microsoft.AspNetCore.Http.Features.IFeatureCollection.Set(TFeature instance) -> void +Microsoft.AspNetCore.Http.Features.IFeatureCollection.this[System.Type! key].get -> object? +Microsoft.AspNetCore.Http.Features.IFeatureCollection.this[System.Type! key].set -> void +Microsoft.AspNetCore.Http.Features.IFormFeature +Microsoft.AspNetCore.Http.Features.IFormFeature.Form.get -> Microsoft.AspNetCore.Http.IFormCollection? +Microsoft.AspNetCore.Http.Features.IFormFeature.Form.set -> void +Microsoft.AspNetCore.Http.Features.IFormFeature.HasFormContentType.get -> bool +Microsoft.AspNetCore.Http.Features.IFormFeature.ReadForm() -> Microsoft.AspNetCore.Http.IFormCollection! +Microsoft.AspNetCore.Http.Features.IFormFeature.ReadFormAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Http.Features.IHttpBodyControlFeature +Microsoft.AspNetCore.Http.Features.IHttpBodyControlFeature.AllowSynchronousIO.get -> bool +Microsoft.AspNetCore.Http.Features.IHttpBodyControlFeature.AllowSynchronousIO.set -> void +Microsoft.AspNetCore.Http.Features.IHttpBufferingFeature +Microsoft.AspNetCore.Http.Features.IHttpBufferingFeature.DisableRequestBuffering() -> void +Microsoft.AspNetCore.Http.Features.IHttpBufferingFeature.DisableResponseBuffering() -> void +Microsoft.AspNetCore.Http.Features.IHttpConnectionFeature +Microsoft.AspNetCore.Http.Features.IHttpConnectionFeature.ConnectionId.get -> string! +Microsoft.AspNetCore.Http.Features.IHttpConnectionFeature.ConnectionId.set -> void +Microsoft.AspNetCore.Http.Features.IHttpConnectionFeature.LocalIpAddress.get -> System.Net.IPAddress? +Microsoft.AspNetCore.Http.Features.IHttpConnectionFeature.LocalIpAddress.set -> void +Microsoft.AspNetCore.Http.Features.IHttpConnectionFeature.LocalPort.get -> int +Microsoft.AspNetCore.Http.Features.IHttpConnectionFeature.LocalPort.set -> void +Microsoft.AspNetCore.Http.Features.IHttpConnectionFeature.RemoteIpAddress.get -> System.Net.IPAddress? +Microsoft.AspNetCore.Http.Features.IHttpConnectionFeature.RemoteIpAddress.set -> void +Microsoft.AspNetCore.Http.Features.IHttpConnectionFeature.RemotePort.get -> int +Microsoft.AspNetCore.Http.Features.IHttpConnectionFeature.RemotePort.set -> void +Microsoft.AspNetCore.Http.Features.IHttpMaxRequestBodySizeFeature +Microsoft.AspNetCore.Http.Features.IHttpMaxRequestBodySizeFeature.IsReadOnly.get -> bool +Microsoft.AspNetCore.Http.Features.IHttpMaxRequestBodySizeFeature.MaxRequestBodySize.get -> long? +Microsoft.AspNetCore.Http.Features.IHttpMaxRequestBodySizeFeature.MaxRequestBodySize.set -> void +Microsoft.AspNetCore.Http.Features.IHttpRequestBodyDetectionFeature +Microsoft.AspNetCore.Http.Features.IHttpRequestBodyDetectionFeature.CanHaveBody.get -> bool +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.Body.get -> System.IO.Stream! +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.Body.set -> void +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.Headers.get -> Microsoft.AspNetCore.Http.IHeaderDictionary! +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.Headers.set -> void +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.Method.get -> string! +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.Method.set -> void +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.Path.get -> string! +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.Path.set -> void +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.PathBase.get -> string! +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.PathBase.set -> void +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.Protocol.get -> string! +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.Protocol.set -> void +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.QueryString.get -> string! +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.QueryString.set -> void +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.RawTarget.get -> string! +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.RawTarget.set -> void +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.Scheme.get -> string! +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.Scheme.set -> void +Microsoft.AspNetCore.Http.Features.IHttpRequestIdentifierFeature +Microsoft.AspNetCore.Http.Features.IHttpRequestIdentifierFeature.TraceIdentifier.get -> string! +Microsoft.AspNetCore.Http.Features.IHttpRequestIdentifierFeature.TraceIdentifier.set -> void +Microsoft.AspNetCore.Http.Features.IHttpRequestLifetimeFeature +Microsoft.AspNetCore.Http.Features.IHttpRequestLifetimeFeature.Abort() -> void +Microsoft.AspNetCore.Http.Features.IHttpRequestLifetimeFeature.RequestAborted.get -> System.Threading.CancellationToken +Microsoft.AspNetCore.Http.Features.IHttpRequestLifetimeFeature.RequestAborted.set -> void +Microsoft.AspNetCore.Http.Features.IHttpRequestTrailersFeature +Microsoft.AspNetCore.Http.Features.IHttpRequestTrailersFeature.Available.get -> bool +Microsoft.AspNetCore.Http.Features.IHttpRequestTrailersFeature.Trailers.get -> Microsoft.AspNetCore.Http.IHeaderDictionary! +Microsoft.AspNetCore.Http.Features.IHttpResetFeature +Microsoft.AspNetCore.Http.Features.IHttpResetFeature.Reset(int errorCode) -> void +Microsoft.AspNetCore.Http.Features.IHttpResponseBodyFeature +Microsoft.AspNetCore.Http.Features.IHttpResponseBodyFeature.CompleteAsync() -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Http.Features.IHttpResponseBodyFeature.DisableBuffering() -> void +Microsoft.AspNetCore.Http.Features.IHttpResponseBodyFeature.SendFileAsync(string! path, long offset, long? count, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Http.Features.IHttpResponseBodyFeature.StartAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Http.Features.IHttpResponseBodyFeature.Stream.get -> System.IO.Stream! +Microsoft.AspNetCore.Http.Features.IHttpResponseBodyFeature.Writer.get -> System.IO.Pipelines.PipeWriter! +Microsoft.AspNetCore.Http.Features.IHttpResponseFeature +Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.Body.get -> System.IO.Stream! +Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.Body.set -> void +Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.HasStarted.get -> bool +Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.Headers.get -> Microsoft.AspNetCore.Http.IHeaderDictionary! +Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.Headers.set -> void +Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.OnCompleted(System.Func! callback, object! state) -> void +Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.OnStarting(System.Func! callback, object! state) -> void +Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.ReasonPhrase.get -> string? +Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.ReasonPhrase.set -> void +Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.StatusCode.get -> int +Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.StatusCode.set -> void +Microsoft.AspNetCore.Http.Features.IHttpResponseTrailersFeature +Microsoft.AspNetCore.Http.Features.IHttpResponseTrailersFeature.Trailers.get -> Microsoft.AspNetCore.Http.IHeaderDictionary! +Microsoft.AspNetCore.Http.Features.IHttpResponseTrailersFeature.Trailers.set -> void +Microsoft.AspNetCore.Http.Features.IHttpSendFileFeature +Microsoft.AspNetCore.Http.Features.IHttpSendFileFeature.SendFileAsync(string! path, long offset, long? count, System.Threading.CancellationToken cancellation) -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Http.Features.IHttpUpgradeFeature +Microsoft.AspNetCore.Http.Features.IHttpUpgradeFeature.IsUpgradableRequest.get -> bool +Microsoft.AspNetCore.Http.Features.IHttpUpgradeFeature.UpgradeAsync() -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Http.Features.IHttpWebSocketFeature +Microsoft.AspNetCore.Http.Features.IHttpWebSocketFeature.AcceptAsync(Microsoft.AspNetCore.Http.WebSocketAcceptContext! context) -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Http.Features.IHttpWebSocketFeature.IsWebSocketRequest.get -> bool +Microsoft.AspNetCore.Http.Features.IHttpsCompressionFeature +Microsoft.AspNetCore.Http.Features.IHttpsCompressionFeature.Mode.get -> Microsoft.AspNetCore.Http.Features.HttpsCompressionMode +Microsoft.AspNetCore.Http.Features.IHttpsCompressionFeature.Mode.set -> void +Microsoft.AspNetCore.Http.Features.IItemsFeature +Microsoft.AspNetCore.Http.Features.IItemsFeature.Items.get -> System.Collections.Generic.IDictionary! +Microsoft.AspNetCore.Http.Features.IItemsFeature.Items.set -> void +Microsoft.AspNetCore.Http.Features.IQueryFeature +Microsoft.AspNetCore.Http.Features.IQueryFeature.Query.get -> Microsoft.AspNetCore.Http.IQueryCollection! +Microsoft.AspNetCore.Http.Features.IQueryFeature.Query.set -> void +Microsoft.AspNetCore.Http.Features.IRequestBodyPipeFeature +Microsoft.AspNetCore.Http.Features.IRequestBodyPipeFeature.Reader.get -> System.IO.Pipelines.PipeReader! +Microsoft.AspNetCore.Http.Features.IRequestCookiesFeature +Microsoft.AspNetCore.Http.Features.IRequestCookiesFeature.Cookies.get -> Microsoft.AspNetCore.Http.IRequestCookieCollection! +Microsoft.AspNetCore.Http.Features.IRequestCookiesFeature.Cookies.set -> void +Microsoft.AspNetCore.Http.Features.IResponseCookiesFeature +Microsoft.AspNetCore.Http.Features.IResponseCookiesFeature.Cookies.get -> Microsoft.AspNetCore.Http.IResponseCookies! +Microsoft.AspNetCore.Http.Features.IServerVariablesFeature +Microsoft.AspNetCore.Http.Features.IServerVariablesFeature.this[string! variableName].get -> string! +Microsoft.AspNetCore.Http.Features.IServerVariablesFeature.this[string! variableName].set -> void +Microsoft.AspNetCore.Http.Features.IServiceProvidersFeature +Microsoft.AspNetCore.Http.Features.IServiceProvidersFeature.RequestServices.get -> System.IServiceProvider! +Microsoft.AspNetCore.Http.Features.IServiceProvidersFeature.RequestServices.set -> void +Microsoft.AspNetCore.Http.Features.ISessionFeature +Microsoft.AspNetCore.Http.Features.ISessionFeature.Session.get -> Microsoft.AspNetCore.Http.ISession! +Microsoft.AspNetCore.Http.Features.ISessionFeature.Session.set -> void +Microsoft.AspNetCore.Http.Features.ITlsConnectionFeature +Microsoft.AspNetCore.Http.Features.ITlsConnectionFeature.ClientCertificate.get -> System.Security.Cryptography.X509Certificates.X509Certificate2? +Microsoft.AspNetCore.Http.Features.ITlsConnectionFeature.ClientCertificate.set -> void +Microsoft.AspNetCore.Http.Features.ITlsConnectionFeature.GetClientCertificateAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Http.Features.ITlsTokenBindingFeature +Microsoft.AspNetCore.Http.Features.ITlsTokenBindingFeature.GetProvidedTokenBindingId() -> byte[]! +Microsoft.AspNetCore.Http.Features.ITlsTokenBindingFeature.GetReferredTokenBindingId() -> byte[]! +Microsoft.AspNetCore.Http.Features.ITrackingConsentFeature +Microsoft.AspNetCore.Http.Features.ITrackingConsentFeature.CanTrack.get -> bool +Microsoft.AspNetCore.Http.Features.ITrackingConsentFeature.CreateConsentCookie() -> string! +Microsoft.AspNetCore.Http.Features.ITrackingConsentFeature.GrantConsent() -> void +Microsoft.AspNetCore.Http.Features.ITrackingConsentFeature.HasConsent.get -> bool +Microsoft.AspNetCore.Http.Features.ITrackingConsentFeature.IsConsentNeeded.get -> bool +Microsoft.AspNetCore.Http.Features.ITrackingConsentFeature.WithdrawConsent() -> void +Microsoft.AspNetCore.Http.IFormCollection +Microsoft.AspNetCore.Http.IFormCollection.ContainsKey(string! key) -> bool +Microsoft.AspNetCore.Http.IFormCollection.Count.get -> int +Microsoft.AspNetCore.Http.IFormCollection.Files.get -> Microsoft.AspNetCore.Http.IFormFileCollection! +Microsoft.AspNetCore.Http.IFormCollection.Keys.get -> System.Collections.Generic.ICollection! +Microsoft.AspNetCore.Http.IFormCollection.TryGetValue(string! key, out Microsoft.Extensions.Primitives.StringValues value) -> bool +Microsoft.AspNetCore.Http.IFormCollection.this[string! key].get -> Microsoft.Extensions.Primitives.StringValues +Microsoft.AspNetCore.Http.IFormFile +Microsoft.AspNetCore.Http.IFormFile.ContentDisposition.get -> string! +Microsoft.AspNetCore.Http.IFormFile.ContentType.get -> string! +Microsoft.AspNetCore.Http.IFormFile.CopyTo(System.IO.Stream! target) -> void +Microsoft.AspNetCore.Http.IFormFile.CopyToAsync(System.IO.Stream! target, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Http.IFormFile.FileName.get -> string! +Microsoft.AspNetCore.Http.IFormFile.Headers.get -> Microsoft.AspNetCore.Http.IHeaderDictionary! +Microsoft.AspNetCore.Http.IFormFile.Length.get -> long +Microsoft.AspNetCore.Http.IFormFile.Name.get -> string! +Microsoft.AspNetCore.Http.IFormFile.OpenReadStream() -> System.IO.Stream! +Microsoft.AspNetCore.Http.IFormFileCollection +Microsoft.AspNetCore.Http.IFormFileCollection.GetFile(string! name) -> Microsoft.AspNetCore.Http.IFormFile? +Microsoft.AspNetCore.Http.IFormFileCollection.GetFiles(string! name) -> System.Collections.Generic.IReadOnlyList! +Microsoft.AspNetCore.Http.IFormFileCollection.this[string! name].get -> Microsoft.AspNetCore.Http.IFormFile? +Microsoft.AspNetCore.Http.IHeaderDictionary +Microsoft.AspNetCore.Http.IHeaderDictionary.ContentLength.get -> long? +Microsoft.AspNetCore.Http.IHeaderDictionary.ContentLength.set -> void +Microsoft.AspNetCore.Http.IHeaderDictionary.this[string! key].get -> Microsoft.Extensions.Primitives.StringValues +Microsoft.AspNetCore.Http.IHeaderDictionary.this[string! key].set -> void +Microsoft.AspNetCore.Http.IQueryCollection +Microsoft.AspNetCore.Http.IQueryCollection.ContainsKey(string! key) -> bool +Microsoft.AspNetCore.Http.IQueryCollection.Count.get -> int +Microsoft.AspNetCore.Http.IQueryCollection.Keys.get -> System.Collections.Generic.ICollection! +Microsoft.AspNetCore.Http.IQueryCollection.TryGetValue(string! key, out Microsoft.Extensions.Primitives.StringValues value) -> bool +Microsoft.AspNetCore.Http.IQueryCollection.this[string! key].get -> Microsoft.Extensions.Primitives.StringValues +Microsoft.AspNetCore.Http.IRequestCookieCollection +Microsoft.AspNetCore.Http.IRequestCookieCollection.ContainsKey(string! key) -> bool +Microsoft.AspNetCore.Http.IRequestCookieCollection.Count.get -> int +Microsoft.AspNetCore.Http.IRequestCookieCollection.Keys.get -> System.Collections.Generic.ICollection! +Microsoft.AspNetCore.Http.IRequestCookieCollection.TryGetValue(string! key, out string? value) -> bool +Microsoft.AspNetCore.Http.IRequestCookieCollection.this[string! key].get -> string? +Microsoft.AspNetCore.Http.IResponseCookies +Microsoft.AspNetCore.Http.IResponseCookies.Append(string! key, string! value) -> void +Microsoft.AspNetCore.Http.IResponseCookies.Append(string! key, string! value, Microsoft.AspNetCore.Http.CookieOptions! options) -> void +Microsoft.AspNetCore.Http.IResponseCookies.Delete(string! key) -> void +Microsoft.AspNetCore.Http.IResponseCookies.Delete(string! key, Microsoft.AspNetCore.Http.CookieOptions! options) -> void +Microsoft.AspNetCore.Http.ISession +Microsoft.AspNetCore.Http.ISession.Clear() -> void +Microsoft.AspNetCore.Http.ISession.CommitAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Http.ISession.Id.get -> string! +Microsoft.AspNetCore.Http.ISession.IsAvailable.get -> bool +Microsoft.AspNetCore.Http.ISession.Keys.get -> System.Collections.Generic.IEnumerable! +Microsoft.AspNetCore.Http.ISession.LoadAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Http.ISession.Remove(string! key) -> void +Microsoft.AspNetCore.Http.ISession.Set(string! key, byte[]! value) -> void +Microsoft.AspNetCore.Http.ISession.TryGetValue(string! key, out byte[]! value) -> bool +Microsoft.AspNetCore.Http.SameSiteMode +Microsoft.AspNetCore.Http.SameSiteMode.Lax = 1 -> Microsoft.AspNetCore.Http.SameSiteMode +Microsoft.AspNetCore.Http.SameSiteMode.None = 0 -> Microsoft.AspNetCore.Http.SameSiteMode +Microsoft.AspNetCore.Http.SameSiteMode.Strict = 2 -> Microsoft.AspNetCore.Http.SameSiteMode +Microsoft.AspNetCore.Http.SameSiteMode.Unspecified = -1 -> Microsoft.AspNetCore.Http.SameSiteMode +Microsoft.AspNetCore.Http.WebSocketAcceptContext +Microsoft.AspNetCore.Http.WebSocketAcceptContext.WebSocketAcceptContext() -> void +static readonly Microsoft.AspNetCore.Http.Features.FeatureReference.Default -> Microsoft.AspNetCore.Http.Features.FeatureReference +virtual Microsoft.AspNetCore.Http.Features.FeatureCollection.Revision.get -> int +virtual Microsoft.AspNetCore.Http.WebSocketAcceptContext.SubProtocol.get -> string? +virtual Microsoft.AspNetCore.Http.WebSocketAcceptContext.SubProtocol.set -> void diff --git a/src/Http/Http.Features/src/PublicAPI.Unshipped.txt b/src/Http/Http.Features/src/PublicAPI/net6.0/PublicAPI.Unshipped.txt similarity index 98% rename from src/Http/Http.Features/src/PublicAPI.Unshipped.txt rename to src/Http/Http.Features/src/PublicAPI/net6.0/PublicAPI.Unshipped.txt index b2bba1b1184b..1298da03ad35 100644 --- a/src/Http/Http.Features/src/PublicAPI.Unshipped.txt +++ b/src/Http/Http.Features/src/PublicAPI/net6.0/PublicAPI.Unshipped.txt @@ -15,6 +15,4 @@ Microsoft.AspNetCore.Http.Features.IFeatureCollection.Set(TFeature? in Microsoft.AspNetCore.Http.Features.IServerVariablesFeature.this[string! variableName].get -> string? Microsoft.AspNetCore.Http.ISession.TryGetValue(string! key, out byte[]? value) -> bool Microsoft.AspNetCore.Http.Features.FeatureCollection.FeatureCollection(int initialCapacity) -> void -#if NET6_0_OR_GREATER Microsoft.AspNetCore.Http.IResponseCookies.Append(System.ReadOnlySpan> keyValuePairs, Microsoft.AspNetCore.Http.CookieOptions! options) -> void -#endif diff --git a/src/Http/Http.Features/src/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt b/src/Http/Http.Features/src/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt new file mode 100644 index 000000000000..f97bf2426e2e --- /dev/null +++ b/src/Http/Http.Features/src/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt @@ -0,0 +1,247 @@ +#nullable enable +Microsoft.AspNetCore.Http.CookieOptions +Microsoft.AspNetCore.Http.CookieOptions.CookieOptions() -> void +Microsoft.AspNetCore.Http.CookieOptions.Domain.get -> string? +Microsoft.AspNetCore.Http.CookieOptions.Domain.set -> void +Microsoft.AspNetCore.Http.CookieOptions.Expires.get -> System.DateTimeOffset? +Microsoft.AspNetCore.Http.CookieOptions.Expires.set -> void +Microsoft.AspNetCore.Http.CookieOptions.HttpOnly.get -> bool +Microsoft.AspNetCore.Http.CookieOptions.HttpOnly.set -> void +Microsoft.AspNetCore.Http.CookieOptions.IsEssential.get -> bool +Microsoft.AspNetCore.Http.CookieOptions.IsEssential.set -> void +Microsoft.AspNetCore.Http.CookieOptions.MaxAge.get -> System.TimeSpan? +Microsoft.AspNetCore.Http.CookieOptions.MaxAge.set -> void +Microsoft.AspNetCore.Http.CookieOptions.Path.get -> string? +Microsoft.AspNetCore.Http.CookieOptions.Path.set -> void +Microsoft.AspNetCore.Http.CookieOptions.SameSite.get -> Microsoft.AspNetCore.Http.SameSiteMode +Microsoft.AspNetCore.Http.CookieOptions.SameSite.set -> void +Microsoft.AspNetCore.Http.CookieOptions.Secure.get -> bool +Microsoft.AspNetCore.Http.CookieOptions.Secure.set -> void +Microsoft.AspNetCore.Http.Features.Authentication.IHttpAuthenticationFeature +Microsoft.AspNetCore.Http.Features.Authentication.IHttpAuthenticationFeature.User.get -> System.Security.Claims.ClaimsPrincipal? +Microsoft.AspNetCore.Http.Features.Authentication.IHttpAuthenticationFeature.User.set -> void +Microsoft.AspNetCore.Http.Features.FeatureCollection +Microsoft.AspNetCore.Http.Features.FeatureCollection.FeatureCollection() -> void +Microsoft.AspNetCore.Http.Features.FeatureCollection.FeatureCollection(Microsoft.AspNetCore.Http.Features.IFeatureCollection! defaults) -> void +Microsoft.AspNetCore.Http.Features.FeatureCollection.Get() -> TFeature? +Microsoft.AspNetCore.Http.Features.FeatureCollection.GetEnumerator() -> System.Collections.Generic.IEnumerator>! +Microsoft.AspNetCore.Http.Features.FeatureCollection.IsReadOnly.get -> bool +Microsoft.AspNetCore.Http.Features.FeatureCollection.Set(TFeature instance) -> void +Microsoft.AspNetCore.Http.Features.FeatureCollection.this[System.Type! key].get -> object? +Microsoft.AspNetCore.Http.Features.FeatureCollection.this[System.Type! key].set -> void +Microsoft.AspNetCore.Http.Features.FeatureReference +Microsoft.AspNetCore.Http.Features.FeatureReference.Fetch(Microsoft.AspNetCore.Http.Features.IFeatureCollection! features) -> T? +Microsoft.AspNetCore.Http.Features.FeatureReference.Update(Microsoft.AspNetCore.Http.Features.IFeatureCollection! features, T feature) -> T +Microsoft.AspNetCore.Http.Features.FeatureReferences +Microsoft.AspNetCore.Http.Features.FeatureReferences.Cache -> TCache? +Microsoft.AspNetCore.Http.Features.FeatureReferences.Collection.get -> Microsoft.AspNetCore.Http.Features.IFeatureCollection! +Microsoft.AspNetCore.Http.Features.FeatureReferences.FeatureReferences(Microsoft.AspNetCore.Http.Features.IFeatureCollection! collection) -> void +Microsoft.AspNetCore.Http.Features.FeatureReferences.Fetch(ref TFeature? cached, TState state, System.Func! factory) -> TFeature? +Microsoft.AspNetCore.Http.Features.FeatureReferences.Fetch(ref TFeature? cached, System.Func! factory) -> TFeature? +Microsoft.AspNetCore.Http.Features.FeatureReferences.Initalize(Microsoft.AspNetCore.Http.Features.IFeatureCollection! collection) -> void +Microsoft.AspNetCore.Http.Features.FeatureReferences.Initalize(Microsoft.AspNetCore.Http.Features.IFeatureCollection! collection, int revision) -> void +Microsoft.AspNetCore.Http.Features.FeatureReferences.Revision.get -> int +Microsoft.AspNetCore.Http.Features.HttpsCompressionMode +Microsoft.AspNetCore.Http.Features.HttpsCompressionMode.Compress = 2 -> Microsoft.AspNetCore.Http.Features.HttpsCompressionMode +Microsoft.AspNetCore.Http.Features.HttpsCompressionMode.Default = 0 -> Microsoft.AspNetCore.Http.Features.HttpsCompressionMode +Microsoft.AspNetCore.Http.Features.HttpsCompressionMode.DoNotCompress = 1 -> Microsoft.AspNetCore.Http.Features.HttpsCompressionMode +Microsoft.AspNetCore.Http.Features.IFeatureCollection +Microsoft.AspNetCore.Http.Features.IFeatureCollection.Get() -> TFeature +Microsoft.AspNetCore.Http.Features.IFeatureCollection.IsReadOnly.get -> bool +Microsoft.AspNetCore.Http.Features.IFeatureCollection.Revision.get -> int +Microsoft.AspNetCore.Http.Features.IFeatureCollection.Set(TFeature instance) -> void +Microsoft.AspNetCore.Http.Features.IFeatureCollection.this[System.Type! key].get -> object? +Microsoft.AspNetCore.Http.Features.IFeatureCollection.this[System.Type! key].set -> void +Microsoft.AspNetCore.Http.Features.IFormFeature +Microsoft.AspNetCore.Http.Features.IFormFeature.Form.get -> Microsoft.AspNetCore.Http.IFormCollection? +Microsoft.AspNetCore.Http.Features.IFormFeature.Form.set -> void +Microsoft.AspNetCore.Http.Features.IFormFeature.HasFormContentType.get -> bool +Microsoft.AspNetCore.Http.Features.IFormFeature.ReadForm() -> Microsoft.AspNetCore.Http.IFormCollection! +Microsoft.AspNetCore.Http.Features.IFormFeature.ReadFormAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Http.Features.IHttpBodyControlFeature +Microsoft.AspNetCore.Http.Features.IHttpBodyControlFeature.AllowSynchronousIO.get -> bool +Microsoft.AspNetCore.Http.Features.IHttpBodyControlFeature.AllowSynchronousIO.set -> void +Microsoft.AspNetCore.Http.Features.IHttpBufferingFeature +Microsoft.AspNetCore.Http.Features.IHttpBufferingFeature.DisableRequestBuffering() -> void +Microsoft.AspNetCore.Http.Features.IHttpBufferingFeature.DisableResponseBuffering() -> void +Microsoft.AspNetCore.Http.Features.IHttpConnectionFeature +Microsoft.AspNetCore.Http.Features.IHttpConnectionFeature.ConnectionId.get -> string! +Microsoft.AspNetCore.Http.Features.IHttpConnectionFeature.ConnectionId.set -> void +Microsoft.AspNetCore.Http.Features.IHttpConnectionFeature.LocalIpAddress.get -> System.Net.IPAddress? +Microsoft.AspNetCore.Http.Features.IHttpConnectionFeature.LocalIpAddress.set -> void +Microsoft.AspNetCore.Http.Features.IHttpConnectionFeature.LocalPort.get -> int +Microsoft.AspNetCore.Http.Features.IHttpConnectionFeature.LocalPort.set -> void +Microsoft.AspNetCore.Http.Features.IHttpConnectionFeature.RemoteIpAddress.get -> System.Net.IPAddress? +Microsoft.AspNetCore.Http.Features.IHttpConnectionFeature.RemoteIpAddress.set -> void +Microsoft.AspNetCore.Http.Features.IHttpConnectionFeature.RemotePort.get -> int +Microsoft.AspNetCore.Http.Features.IHttpConnectionFeature.RemotePort.set -> void +Microsoft.AspNetCore.Http.Features.IHttpMaxRequestBodySizeFeature +Microsoft.AspNetCore.Http.Features.IHttpMaxRequestBodySizeFeature.IsReadOnly.get -> bool +Microsoft.AspNetCore.Http.Features.IHttpMaxRequestBodySizeFeature.MaxRequestBodySize.get -> long? +Microsoft.AspNetCore.Http.Features.IHttpMaxRequestBodySizeFeature.MaxRequestBodySize.set -> void +Microsoft.AspNetCore.Http.Features.IHttpRequestBodyDetectionFeature +Microsoft.AspNetCore.Http.Features.IHttpRequestBodyDetectionFeature.CanHaveBody.get -> bool +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.Body.get -> System.IO.Stream! +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.Body.set -> void +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.Headers.get -> Microsoft.AspNetCore.Http.IHeaderDictionary! +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.Headers.set -> void +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.Method.get -> string! +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.Method.set -> void +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.Path.get -> string! +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.Path.set -> void +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.PathBase.get -> string! +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.PathBase.set -> void +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.Protocol.get -> string! +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.Protocol.set -> void +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.QueryString.get -> string! +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.QueryString.set -> void +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.RawTarget.get -> string! +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.RawTarget.set -> void +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.Scheme.get -> string! +Microsoft.AspNetCore.Http.Features.IHttpRequestFeature.Scheme.set -> void +Microsoft.AspNetCore.Http.Features.IHttpRequestIdentifierFeature +Microsoft.AspNetCore.Http.Features.IHttpRequestIdentifierFeature.TraceIdentifier.get -> string! +Microsoft.AspNetCore.Http.Features.IHttpRequestIdentifierFeature.TraceIdentifier.set -> void +Microsoft.AspNetCore.Http.Features.IHttpRequestLifetimeFeature +Microsoft.AspNetCore.Http.Features.IHttpRequestLifetimeFeature.Abort() -> void +Microsoft.AspNetCore.Http.Features.IHttpRequestLifetimeFeature.RequestAborted.get -> System.Threading.CancellationToken +Microsoft.AspNetCore.Http.Features.IHttpRequestLifetimeFeature.RequestAborted.set -> void +Microsoft.AspNetCore.Http.Features.IHttpRequestTrailersFeature +Microsoft.AspNetCore.Http.Features.IHttpRequestTrailersFeature.Available.get -> bool +Microsoft.AspNetCore.Http.Features.IHttpRequestTrailersFeature.Trailers.get -> Microsoft.AspNetCore.Http.IHeaderDictionary! +Microsoft.AspNetCore.Http.Features.IHttpResetFeature +Microsoft.AspNetCore.Http.Features.IHttpResetFeature.Reset(int errorCode) -> void +Microsoft.AspNetCore.Http.Features.IHttpResponseBodyFeature +Microsoft.AspNetCore.Http.Features.IHttpResponseBodyFeature.CompleteAsync() -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Http.Features.IHttpResponseBodyFeature.DisableBuffering() -> void +Microsoft.AspNetCore.Http.Features.IHttpResponseBodyFeature.SendFileAsync(string! path, long offset, long? count, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Http.Features.IHttpResponseBodyFeature.StartAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Http.Features.IHttpResponseBodyFeature.Stream.get -> System.IO.Stream! +Microsoft.AspNetCore.Http.Features.IHttpResponseBodyFeature.Writer.get -> System.IO.Pipelines.PipeWriter! +Microsoft.AspNetCore.Http.Features.IHttpResponseFeature +Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.Body.get -> System.IO.Stream! +Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.Body.set -> void +Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.HasStarted.get -> bool +Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.Headers.get -> Microsoft.AspNetCore.Http.IHeaderDictionary! +Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.Headers.set -> void +Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.OnCompleted(System.Func! callback, object! state) -> void +Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.OnStarting(System.Func! callback, object! state) -> void +Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.ReasonPhrase.get -> string? +Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.ReasonPhrase.set -> void +Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.StatusCode.get -> int +Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.StatusCode.set -> void +Microsoft.AspNetCore.Http.Features.IHttpResponseTrailersFeature +Microsoft.AspNetCore.Http.Features.IHttpResponseTrailersFeature.Trailers.get -> Microsoft.AspNetCore.Http.IHeaderDictionary! +Microsoft.AspNetCore.Http.Features.IHttpResponseTrailersFeature.Trailers.set -> void +Microsoft.AspNetCore.Http.Features.IHttpSendFileFeature +Microsoft.AspNetCore.Http.Features.IHttpSendFileFeature.SendFileAsync(string! path, long offset, long? count, System.Threading.CancellationToken cancellation) -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Http.Features.IHttpUpgradeFeature +Microsoft.AspNetCore.Http.Features.IHttpUpgradeFeature.IsUpgradableRequest.get -> bool +Microsoft.AspNetCore.Http.Features.IHttpUpgradeFeature.UpgradeAsync() -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Http.Features.IHttpWebSocketFeature +Microsoft.AspNetCore.Http.Features.IHttpWebSocketFeature.AcceptAsync(Microsoft.AspNetCore.Http.WebSocketAcceptContext! context) -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Http.Features.IHttpWebSocketFeature.IsWebSocketRequest.get -> bool +Microsoft.AspNetCore.Http.Features.IHttpsCompressionFeature +Microsoft.AspNetCore.Http.Features.IHttpsCompressionFeature.Mode.get -> Microsoft.AspNetCore.Http.Features.HttpsCompressionMode +Microsoft.AspNetCore.Http.Features.IHttpsCompressionFeature.Mode.set -> void +Microsoft.AspNetCore.Http.Features.IItemsFeature +Microsoft.AspNetCore.Http.Features.IItemsFeature.Items.get -> System.Collections.Generic.IDictionary! +Microsoft.AspNetCore.Http.Features.IItemsFeature.Items.set -> void +Microsoft.AspNetCore.Http.Features.IQueryFeature +Microsoft.AspNetCore.Http.Features.IQueryFeature.Query.get -> Microsoft.AspNetCore.Http.IQueryCollection! +Microsoft.AspNetCore.Http.Features.IQueryFeature.Query.set -> void +Microsoft.AspNetCore.Http.Features.IRequestBodyPipeFeature +Microsoft.AspNetCore.Http.Features.IRequestBodyPipeFeature.Reader.get -> System.IO.Pipelines.PipeReader! +Microsoft.AspNetCore.Http.Features.IRequestCookiesFeature +Microsoft.AspNetCore.Http.Features.IRequestCookiesFeature.Cookies.get -> Microsoft.AspNetCore.Http.IRequestCookieCollection! +Microsoft.AspNetCore.Http.Features.IRequestCookiesFeature.Cookies.set -> void +Microsoft.AspNetCore.Http.Features.IResponseCookiesFeature +Microsoft.AspNetCore.Http.Features.IResponseCookiesFeature.Cookies.get -> Microsoft.AspNetCore.Http.IResponseCookies! +Microsoft.AspNetCore.Http.Features.IServerVariablesFeature +Microsoft.AspNetCore.Http.Features.IServerVariablesFeature.this[string! variableName].get -> string! +Microsoft.AspNetCore.Http.Features.IServerVariablesFeature.this[string! variableName].set -> void +Microsoft.AspNetCore.Http.Features.IServiceProvidersFeature +Microsoft.AspNetCore.Http.Features.IServiceProvidersFeature.RequestServices.get -> System.IServiceProvider! +Microsoft.AspNetCore.Http.Features.IServiceProvidersFeature.RequestServices.set -> void +Microsoft.AspNetCore.Http.Features.ISessionFeature +Microsoft.AspNetCore.Http.Features.ISessionFeature.Session.get -> Microsoft.AspNetCore.Http.ISession! +Microsoft.AspNetCore.Http.Features.ISessionFeature.Session.set -> void +Microsoft.AspNetCore.Http.Features.ITlsConnectionFeature +Microsoft.AspNetCore.Http.Features.ITlsConnectionFeature.ClientCertificate.get -> System.Security.Cryptography.X509Certificates.X509Certificate2? +Microsoft.AspNetCore.Http.Features.ITlsConnectionFeature.ClientCertificate.set -> void +Microsoft.AspNetCore.Http.Features.ITlsConnectionFeature.GetClientCertificateAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Http.Features.ITlsTokenBindingFeature +Microsoft.AspNetCore.Http.Features.ITlsTokenBindingFeature.GetProvidedTokenBindingId() -> byte[]! +Microsoft.AspNetCore.Http.Features.ITlsTokenBindingFeature.GetReferredTokenBindingId() -> byte[]! +Microsoft.AspNetCore.Http.Features.ITrackingConsentFeature +Microsoft.AspNetCore.Http.Features.ITrackingConsentFeature.CanTrack.get -> bool +Microsoft.AspNetCore.Http.Features.ITrackingConsentFeature.CreateConsentCookie() -> string! +Microsoft.AspNetCore.Http.Features.ITrackingConsentFeature.GrantConsent() -> void +Microsoft.AspNetCore.Http.Features.ITrackingConsentFeature.HasConsent.get -> bool +Microsoft.AspNetCore.Http.Features.ITrackingConsentFeature.IsConsentNeeded.get -> bool +Microsoft.AspNetCore.Http.Features.ITrackingConsentFeature.WithdrawConsent() -> void +Microsoft.AspNetCore.Http.IFormCollection +Microsoft.AspNetCore.Http.IFormCollection.ContainsKey(string! key) -> bool +Microsoft.AspNetCore.Http.IFormCollection.Count.get -> int +Microsoft.AspNetCore.Http.IFormCollection.Files.get -> Microsoft.AspNetCore.Http.IFormFileCollection! +Microsoft.AspNetCore.Http.IFormCollection.Keys.get -> System.Collections.Generic.ICollection! +Microsoft.AspNetCore.Http.IFormCollection.TryGetValue(string! key, out Microsoft.Extensions.Primitives.StringValues value) -> bool +Microsoft.AspNetCore.Http.IFormCollection.this[string! key].get -> Microsoft.Extensions.Primitives.StringValues +Microsoft.AspNetCore.Http.IFormFile +Microsoft.AspNetCore.Http.IFormFile.ContentDisposition.get -> string! +Microsoft.AspNetCore.Http.IFormFile.ContentType.get -> string! +Microsoft.AspNetCore.Http.IFormFile.CopyTo(System.IO.Stream! target) -> void +Microsoft.AspNetCore.Http.IFormFile.CopyToAsync(System.IO.Stream! target, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Http.IFormFile.FileName.get -> string! +Microsoft.AspNetCore.Http.IFormFile.Headers.get -> Microsoft.AspNetCore.Http.IHeaderDictionary! +Microsoft.AspNetCore.Http.IFormFile.Length.get -> long +Microsoft.AspNetCore.Http.IFormFile.Name.get -> string! +Microsoft.AspNetCore.Http.IFormFile.OpenReadStream() -> System.IO.Stream! +Microsoft.AspNetCore.Http.IFormFileCollection +Microsoft.AspNetCore.Http.IFormFileCollection.GetFile(string! name) -> Microsoft.AspNetCore.Http.IFormFile? +Microsoft.AspNetCore.Http.IFormFileCollection.GetFiles(string! name) -> System.Collections.Generic.IReadOnlyList! +Microsoft.AspNetCore.Http.IFormFileCollection.this[string! name].get -> Microsoft.AspNetCore.Http.IFormFile? +Microsoft.AspNetCore.Http.IHeaderDictionary +Microsoft.AspNetCore.Http.IHeaderDictionary.ContentLength.get -> long? +Microsoft.AspNetCore.Http.IHeaderDictionary.ContentLength.set -> void +Microsoft.AspNetCore.Http.IHeaderDictionary.this[string! key].get -> Microsoft.Extensions.Primitives.StringValues +Microsoft.AspNetCore.Http.IHeaderDictionary.this[string! key].set -> void +Microsoft.AspNetCore.Http.IQueryCollection +Microsoft.AspNetCore.Http.IQueryCollection.ContainsKey(string! key) -> bool +Microsoft.AspNetCore.Http.IQueryCollection.Count.get -> int +Microsoft.AspNetCore.Http.IQueryCollection.Keys.get -> System.Collections.Generic.ICollection! +Microsoft.AspNetCore.Http.IQueryCollection.TryGetValue(string! key, out Microsoft.Extensions.Primitives.StringValues value) -> bool +Microsoft.AspNetCore.Http.IQueryCollection.this[string! key].get -> Microsoft.Extensions.Primitives.StringValues +Microsoft.AspNetCore.Http.IRequestCookieCollection +Microsoft.AspNetCore.Http.IRequestCookieCollection.ContainsKey(string! key) -> bool +Microsoft.AspNetCore.Http.IRequestCookieCollection.Count.get -> int +Microsoft.AspNetCore.Http.IRequestCookieCollection.Keys.get -> System.Collections.Generic.ICollection! +Microsoft.AspNetCore.Http.IRequestCookieCollection.TryGetValue(string! key, out string? value) -> bool +Microsoft.AspNetCore.Http.IRequestCookieCollection.this[string! key].get -> string? +Microsoft.AspNetCore.Http.IResponseCookies +Microsoft.AspNetCore.Http.IResponseCookies.Append(string! key, string! value) -> void +Microsoft.AspNetCore.Http.IResponseCookies.Append(string! key, string! value, Microsoft.AspNetCore.Http.CookieOptions! options) -> void +Microsoft.AspNetCore.Http.IResponseCookies.Delete(string! key) -> void +Microsoft.AspNetCore.Http.IResponseCookies.Delete(string! key, Microsoft.AspNetCore.Http.CookieOptions! options) -> void +Microsoft.AspNetCore.Http.ISession +Microsoft.AspNetCore.Http.ISession.Clear() -> void +Microsoft.AspNetCore.Http.ISession.CommitAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Http.ISession.Id.get -> string! +Microsoft.AspNetCore.Http.ISession.IsAvailable.get -> bool +Microsoft.AspNetCore.Http.ISession.Keys.get -> System.Collections.Generic.IEnumerable! +Microsoft.AspNetCore.Http.ISession.LoadAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Http.ISession.Remove(string! key) -> void +Microsoft.AspNetCore.Http.ISession.Set(string! key, byte[]! value) -> void +Microsoft.AspNetCore.Http.ISession.TryGetValue(string! key, out byte[]! value) -> bool +Microsoft.AspNetCore.Http.SameSiteMode +Microsoft.AspNetCore.Http.SameSiteMode.Lax = 1 -> Microsoft.AspNetCore.Http.SameSiteMode +Microsoft.AspNetCore.Http.SameSiteMode.None = 0 -> Microsoft.AspNetCore.Http.SameSiteMode +Microsoft.AspNetCore.Http.SameSiteMode.Strict = 2 -> Microsoft.AspNetCore.Http.SameSiteMode +Microsoft.AspNetCore.Http.SameSiteMode.Unspecified = -1 -> Microsoft.AspNetCore.Http.SameSiteMode +Microsoft.AspNetCore.Http.WebSocketAcceptContext +Microsoft.AspNetCore.Http.WebSocketAcceptContext.WebSocketAcceptContext() -> void +static readonly Microsoft.AspNetCore.Http.Features.FeatureReference.Default -> Microsoft.AspNetCore.Http.Features.FeatureReference +virtual Microsoft.AspNetCore.Http.Features.FeatureCollection.Revision.get -> int +virtual Microsoft.AspNetCore.Http.WebSocketAcceptContext.SubProtocol.get -> string? +virtual Microsoft.AspNetCore.Http.WebSocketAcceptContext.SubProtocol.set -> void diff --git a/src/Http/Http.Features/src/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt b/src/Http/Http.Features/src/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt new file mode 100644 index 000000000000..4cc6095ff65a --- /dev/null +++ b/src/Http/Http.Features/src/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt @@ -0,0 +1,17 @@ +#nullable enable +*REMOVED*Microsoft.AspNetCore.Http.Features.FeatureCollection.Set(TFeature instance) -> void +*REMOVED*Microsoft.AspNetCore.Http.Features.IFeatureCollection.Get() -> TFeature +*REMOVED*Microsoft.AspNetCore.Http.Features.IFeatureCollection.Set(TFeature instance) -> void +*REMOVED*Microsoft.AspNetCore.Http.Features.IHttpBufferingFeature +*REMOVED*Microsoft.AspNetCore.Http.Features.IHttpBufferingFeature.DisableRequestBuffering() -> void +*REMOVED*Microsoft.AspNetCore.Http.Features.IHttpBufferingFeature.DisableResponseBuffering() -> void +*REMOVED*Microsoft.AspNetCore.Http.Features.IHttpSendFileFeature +*REMOVED*Microsoft.AspNetCore.Http.Features.IHttpSendFileFeature.SendFileAsync(string! path, long offset, long? count, System.Threading.CancellationToken cancellation) -> System.Threading.Tasks.Task! +*REMOVED*Microsoft.AspNetCore.Http.Features.IServerVariablesFeature.this[string! variableName].get -> string! +*REMOVED*Microsoft.AspNetCore.Http.ISession.TryGetValue(string! key, out byte[]! value) -> bool +Microsoft.AspNetCore.Http.Features.FeatureCollection.Set(TFeature? instance) -> void +Microsoft.AspNetCore.Http.Features.IFeatureCollection.Get() -> TFeature? +Microsoft.AspNetCore.Http.Features.IFeatureCollection.Set(TFeature? instance) -> void +Microsoft.AspNetCore.Http.Features.IServerVariablesFeature.this[string! variableName].get -> string? +Microsoft.AspNetCore.Http.ISession.TryGetValue(string! key, out byte[]? value) -> bool +Microsoft.AspNetCore.Http.Features.FeatureCollection.FeatureCollection(int initialCapacity) -> void From ab3e8032aee91997482314c121179eac73e277db Mon Sep 17 00:00:00 2001 From: Juan Barahona Date: Tue, 20 Apr 2021 10:35:42 -0400 Subject: [PATCH 11/12] Addressing feedback from asp.net team --- .../Microsoft.AspNetCore.Http.Features.csproj | 2 +- src/Http/Http/src/Internal/ResponseCookies.cs | 5 +-- .../test/CookieTempDataProviderTest.cs | 2 +- .../src/ResponseCookiesWrapper.cs | 2 +- .../CookiePolicy/test/CookieChunkingTests.cs | 31 +++++++++++++------ .../CookiePolicy/test/CookiePolicyTests.cs | 1 - .../ChunkingCookieManagerBenchmark.cs | 16 +++++----- ...AspNetCore.Security.Microbenchmarks.csproj | 10 +++--- 8 files changed, 40 insertions(+), 29 deletions(-) diff --git a/src/Http/Http.Features/src/Microsoft.AspNetCore.Http.Features.csproj b/src/Http/Http.Features/src/Microsoft.AspNetCore.Http.Features.csproj index dc05abb5cd73..7aad17f6cd07 100644 --- a/src/Http/Http.Features/src/Microsoft.AspNetCore.Http.Features.csproj +++ b/src/Http/Http.Features/src/Microsoft.AspNetCore.Http.Features.csproj @@ -10,7 +10,7 @@ enable - + diff --git a/src/Http/Http/src/Internal/ResponseCookies.cs b/src/Http/Http/src/Internal/ResponseCookies.cs index af7a4fc4b6a4..e7466c6a6ecb 100644 --- a/src/Http/Http/src/Internal/ResponseCookies.cs +++ b/src/Http/Http/src/Internal/ResponseCookies.cs @@ -101,7 +101,7 @@ public void Append(ReadOnlySpan> keyValuePairs, Coo { if (_logger == null) { - var services = _features.Get()?.RequestServices; + var services = _features.Get()?.RequestServices; _logger = services?.GetService>(); } @@ -131,7 +131,8 @@ public void Append(ReadOnlySpan> keyValuePairs, Coo foreach (var keyValuePair in keyValuePairs) { - cookies[position] = string.Concat(_enableCookieNameEncoding ? Uri.EscapeDataString(keyValuePair.Key) : keyValuePair.Key, "=", Uri.EscapeDataString(keyValuePair.Value), cookierHeaderValue); + var key = _enableCookieNameEncoding ? Uri.EscapeDataString(keyValuePair.Key) : keyValuePair.Key; + cookies[position] = string.Concat(key, "=", Uri.EscapeDataString(keyValuePair.Value), cookierHeaderValue); position++; } diff --git a/src/Mvc/Mvc.ViewFeatures/test/CookieTempDataProviderTest.cs b/src/Mvc/Mvc.ViewFeatures/test/CookieTempDataProviderTest.cs index a1ee55c5449d..c509e6645772 100644 --- a/src/Mvc/Mvc.ViewFeatures/test/CookieTempDataProviderTest.cs +++ b/src/Mvc/Mvc.ViewFeatures/test/CookieTempDataProviderTest.cs @@ -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. using System; diff --git a/src/Security/CookiePolicy/src/ResponseCookiesWrapper.cs b/src/Security/CookiePolicy/src/ResponseCookiesWrapper.cs index 74cc9b7ba3a9..f3f706510d88 100644 --- a/src/Security/CookiePolicy/src/ResponseCookiesWrapper.cs +++ b/src/Security/CookiePolicy/src/ResponseCookiesWrapper.cs @@ -161,7 +161,7 @@ public void Append(ReadOnlySpan> keyValuePairs, Coo throw new ArgumentNullException(nameof(options)); } - var nonSuppressedValues = new List>(); + var nonSuppressedValues = new List>(keyValuePairs.Length); foreach (var keyValuePair in keyValuePairs) { diff --git a/src/Security/CookiePolicy/test/CookieChunkingTests.cs b/src/Security/CookiePolicy/test/CookieChunkingTests.cs index d2bc0d4ef1a4..9bc07c6f9f9c 100644 --- a/src/Security/CookiePolicy/test/CookieChunkingTests.cs +++ b/src/Security/CookiePolicy/test/CookieChunkingTests.cs @@ -157,14 +157,14 @@ public void DeleteChunkedCookieWithOptionsAndResponseCookies_AllDeleted() httpContext.Request.Headers["Cookie"] = new[] { - "TestCookie=chunks-7; domain=foo.com; path=/; secure", - "TestCookieC1=abcdefghi; domain=foo.com; path=/; secure", - "TestCookieC2=jklmnopqr; domain=foo.com; path=/; secure", - "TestCookieC3=stuvwxyz0; domain=foo.com; path=/; secure", - "TestCookieC4=123456789; domain=foo.com; path=/; secure", - "TestCookieC5=ABCDEFGHI; domain=foo.com; path=/; secure", - "TestCookieC6=JKLMNOPQR; domain=foo.com; path=/; secure", - "TestCookieC7=STUVWXYZ; domain=foo.com; path=/; secure" + "TestCookie=chunks-7", + "TestCookieC1=abcdefghi", + "TestCookieC2=jklmnopqr", + "TestCookieC3=stuvwxyz0", + "TestCookieC4=123456789", + "TestCookieC5=ABCDEFGHI", + "TestCookieC6=JKLMNOPQR", + "TestCookieC7=STUVWXYZ" }; var cookieOptions = new CookieOptions() @@ -177,8 +177,8 @@ public void DeleteChunkedCookieWithOptionsAndResponseCookies_AllDeleted() httpContext.Response.Headers[HeaderNames.SetCookie] = new[] { "TestCookie=chunks-7; domain=foo.com; path=/; secure", - "TestCookieC1=abcdefghi; domain=foo.com; path=/; secure", - "TestCookieC2=jklmnopqr; domain=foo.com; path=/; secure", + "TestCookieC1=STUVWXYZ; domain=foo.com; path=/; secure", + "TestCookieC2=123456789; domain=foo.com; path=/; secure", "TestCookieC3=stuvwxyz0; domain=foo.com; path=/; secure", "TestCookieC4=123456789; domain=foo.com; path=/; secure", "TestCookieC5=ABCDEFGHI; domain=foo.com; path=/; secure", @@ -188,6 +188,17 @@ public void DeleteChunkedCookieWithOptionsAndResponseCookies_AllDeleted() chunkingCookieManager.DeleteCookie(httpContext, "TestCookie", cookieOptions); Assert.Equal(8, httpContext.Response.Headers[HeaderNames.SetCookie].Count); + Assert.Equal(new[] + { + "TestCookie=; expires=Thu, 01 Jan 1970 00:00:00 GMT; domain=foo.com; path=/; secure", + "TestCookieC1=; expires=Thu, 01 Jan 1970 00:00:00 GMT; domain=foo.com; path=/; secure", + "TestCookieC2=; expires=Thu, 01 Jan 1970 00:00:00 GMT; domain=foo.com; path=/; secure", + "TestCookieC3=; expires=Thu, 01 Jan 1970 00:00:00 GMT; domain=foo.com; path=/; secure", + "TestCookieC4=; expires=Thu, 01 Jan 1970 00:00:00 GMT; domain=foo.com; path=/; secure", + "TestCookieC5=; expires=Thu, 01 Jan 1970 00:00:00 GMT; domain=foo.com; path=/; secure", + "TestCookieC6=; expires=Thu, 01 Jan 1970 00:00:00 GMT; domain=foo.com; path=/; secure", + "TestCookieC7=; expires=Thu, 01 Jan 1970 00:00:00 GMT; domain=foo.com; path=/; secure" + }, httpContext.Response.Headers[HeaderNames.SetCookie]); } } } diff --git a/src/Security/CookiePolicy/test/CookiePolicyTests.cs b/src/Security/CookiePolicy/test/CookiePolicyTests.cs index 677fc2a08501..6f5c940c7d9e 100644 --- a/src/Security/CookiePolicy/test/CookiePolicyTests.cs +++ b/src/Security/CookiePolicy/test/CookiePolicyTests.cs @@ -2,7 +2,6 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.Collections.Generic; using System.Security.Claims; using System.Security.Principal; using System.Threading.Tasks; diff --git a/src/Security/perf/Microbenchmarks/ChunkingCookieManagerBenchmark.cs b/src/Security/perf/Microbenchmarks/ChunkingCookieManagerBenchmark.cs index fc1829c7cc91..103722e8e9b8 100644 --- a/src/Security/perf/Microbenchmarks/ChunkingCookieManagerBenchmark.cs +++ b/src/Security/perf/Microbenchmarks/ChunkingCookieManagerBenchmark.cs @@ -32,14 +32,14 @@ public void GlobalSetup() _httpContext.Request.Headers["Cookie"] = new[] { - "TestCookie=chunks-7; domain=foo.com; path=/; secure", - "TestCookieC1=abcdefghi; domain=foo.com; path=/; secure", - "TestCookieC2=jklmnopqr; domain=foo.com; path=/; secure", - "TestCookieC3=stuvwxyz0; domain=foo.com; path=/; secure", - "TestCookieC4=123456789; domain=foo.com; path=/; secure", - "TestCookieC5=ABCDEFGHI; domain=foo.com; path=/; secure", - "TestCookieC6=JKLMNOPQR; domain=foo.com; path=/; secure", - "TestCookieC7=STUVWXYZ; domain=foo.com; path=/; secure" + "TestCookie=chunks-7", + "TestCookieC1=abcdefghi", + "TestCookieC2=jklmnopqr", + "TestCookieC3=stuvwxyz0", + "TestCookieC4=123456789", + "TestCookieC5=ABCDEFGHI", + "TestCookieC6=JKLMNOPQR", + "TestCookieC7=STUVWXYZ" }; _stringToAdd = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; diff --git a/src/Security/perf/Microbenchmarks/Microsoft.AspNetCore.Security.Microbenchmarks.csproj b/src/Security/perf/Microbenchmarks/Microsoft.AspNetCore.Security.Microbenchmarks.csproj index eb286d326646..cf86764d09e2 100644 --- a/src/Security/perf/Microbenchmarks/Microsoft.AspNetCore.Security.Microbenchmarks.csproj +++ b/src/Security/perf/Microbenchmarks/Microsoft.AspNetCore.Security.Microbenchmarks.csproj @@ -1,5 +1,5 @@ - - + + $(DefaultNetCoreTargetFramework) Exe @@ -7,14 +7,14 @@ true Microsoft.AspNetCore.Security - + - + + - From d312bc9d39a6c4b25446c23a64d808f8eef5d50d Mon Sep 17 00:00:00 2001 From: Chris Ross Date: Tue, 20 Apr 2021 09:13:39 -0700 Subject: [PATCH 12/12] Update src/Http/Http.Features/src/IResponseCookies.cs --- src/Http/Http.Features/src/IResponseCookies.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Http/Http.Features/src/IResponseCookies.cs b/src/Http/Http.Features/src/IResponseCookies.cs index 5a7233005eda..b41153d131a0 100644 --- a/src/Http/Http.Features/src/IResponseCookies.cs +++ b/src/Http/Http.Features/src/IResponseCookies.cs @@ -30,7 +30,7 @@ public interface IResponseCookies #if NET6_0_OR_GREATER /// - /// Add elements of specified dictionary as cookies. + /// Add elements of specified collection as cookies. /// /// Key value pair collections whose elements will be added as cookies. /// included in new cookie settings.