Skip to content

Commit 4ef204e

Browse files
authored
Remove or make public pubternals for Http #11312 (#11429)
1 parent f35564b commit 4ef204e

File tree

90 files changed

+222
-536
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+222
-536
lines changed

‎src/Antiforgery/test/DefaultAntiforgeryTokenStoreTest.cs‎

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
using System.Collections.Generic;
66
using System.Threading.Tasks;
77
using Microsoft.AspNetCore.Http;
8-
using Microsoft.AspNetCore.Http.Internal;
98
using Microsoft.Extensions.Primitives;
9+
using Microsoft.Net.Http.Headers;
1010
using Moq;
1111
using Xunit;
1212

@@ -20,7 +20,7 @@ public class DefaultAntiforgeryTokenStoreTest
2020
public void GetCookieToken_CookieDoesNotExist_ReturnsNull()
2121
{
2222
// Arrange
23-
var httpContext = GetHttpContext(new RequestCookieCollection());
23+
var httpContext = GetHttpContext();
2424
var options = new AntiforgeryOptions
2525
{
2626
Cookie = { Name = _cookieName }
@@ -79,7 +79,7 @@ public void GetCookieToken_CookieIsNotEmpty_ReturnsToken()
7979
public async Task GetRequestTokens_CookieIsEmpty_ReturnsNullTokens()
8080
{
8181
// Arrange
82-
var httpContext = GetHttpContext(new RequestCookieCollection());
82+
var httpContext = GetHttpContext();
8383
httpContext.Request.Form = FormCollection.Empty;
8484

8585
var options = new AntiforgeryOptions
@@ -407,18 +407,14 @@ public void SaveCookieToken_NonNullAntiforgeryOptionsConfigureCookieOptionsDomai
407407

408408
private HttpContext GetHttpContext(string cookieName, string cookieValue)
409409
{
410-
var cookies = new RequestCookieCollection(new Dictionary<string, string>
411-
{
412-
{ cookieName, cookieValue },
413-
});
414-
415-
return GetHttpContext(cookies);
410+
var context = GetHttpContext();
411+
context.Request.Headers[HeaderNames.Cookie] = $"{cookieName}={cookieValue}";
412+
return context;
416413
}
417414

418-
private HttpContext GetHttpContext(IRequestCookieCollection cookies)
415+
private HttpContext GetHttpContext()
419416
{
420417
var httpContext = new DefaultHttpContext();
421-
httpContext.Request.Cookies = cookies;
422418

423419
return httpContext;
424420
}

‎src/Components/Server/test/ComponentEndpointRouteBuilderExtensionsTest.cs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using Microsoft.AspNetCore.Builder;
5-
using Microsoft.AspNetCore.Builder.Internal;
65
using Microsoft.AspNetCore.Http;
76
using Microsoft.Extensions.DependencyInjection;
87
using Microsoft.Extensions.Hosting;

‎src/Hosting/Hosting/src/Builder/ApplicationBuilderFactory.cs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using System;
55
using Microsoft.AspNetCore.Builder;
6-
using Microsoft.AspNetCore.Builder.Internal;
76
using Microsoft.AspNetCore.Http.Features;
87

98
namespace Microsoft.AspNetCore.Hosting.Builder

‎src/Hosting/Hosting/test/ConfigureBuilderTests.cs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System;
55
using System.Reflection;
66
using Microsoft.AspNetCore.Builder;
7-
using Microsoft.AspNetCore.Builder.Internal;
87
using Microsoft.AspNetCore.Hosting.Internal;
98
using Microsoft.Extensions.DependencyInjection;
109
using Xunit;
@@ -52,4 +51,4 @@ public CrasherService()
5251
}
5352
}
5453
}
55-
}
54+
}

‎src/Hosting/Hosting/test/StartupManagerTests.cs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using System.Collections.Generic;
66
using System.Reflection;
77
using Microsoft.AspNetCore.Builder;
8-
using Microsoft.AspNetCore.Builder.Internal;
98
using Microsoft.AspNetCore.Hosting.Fakes;
109
using Microsoft.AspNetCore.Hosting.Internal;
1110
using Microsoft.AspNetCore.Hosting.Tests.Internal;

‎src/Http/Http.Abstractions/ref/Microsoft.AspNetCore.Http.Abstractions.netcoreapp3.0.cs‎

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -474,58 +474,6 @@ public partial interface IRouteValuesFeature
474474
Microsoft.AspNetCore.Routing.RouteValueDictionary RouteValues { get; set; }
475475
}
476476
}
477-
namespace Microsoft.AspNetCore.Http.Internal
478-
{
479-
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
480-
public readonly partial struct HeaderSegment : System.IEquatable<Microsoft.AspNetCore.Http.Internal.HeaderSegment>
481-
{
482-
private readonly object _dummy;
483-
public HeaderSegment(Microsoft.Extensions.Primitives.StringSegment formatting, Microsoft.Extensions.Primitives.StringSegment data) { throw null; }
484-
public Microsoft.Extensions.Primitives.StringSegment Data { get { throw null; } }
485-
public Microsoft.Extensions.Primitives.StringSegment Formatting { get { throw null; } }
486-
public bool Equals(Microsoft.AspNetCore.Http.Internal.HeaderSegment other) { throw null; }
487-
public override bool Equals(object obj) { throw null; }
488-
public override int GetHashCode() { throw null; }
489-
public static bool operator ==(Microsoft.AspNetCore.Http.Internal.HeaderSegment left, Microsoft.AspNetCore.Http.Internal.HeaderSegment right) { throw null; }
490-
public static bool operator !=(Microsoft.AspNetCore.Http.Internal.HeaderSegment left, Microsoft.AspNetCore.Http.Internal.HeaderSegment right) { throw null; }
491-
}
492-
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
493-
public readonly partial struct HeaderSegmentCollection : System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Http.Internal.HeaderSegment>, System.Collections.IEnumerable, System.IEquatable<Microsoft.AspNetCore.Http.Internal.HeaderSegmentCollection>
494-
{
495-
private readonly object _dummy;
496-
public HeaderSegmentCollection(Microsoft.Extensions.Primitives.StringValues headers) { throw null; }
497-
public bool Equals(Microsoft.AspNetCore.Http.Internal.HeaderSegmentCollection other) { throw null; }
498-
public override bool Equals(object obj) { throw null; }
499-
public Microsoft.AspNetCore.Http.Internal.HeaderSegmentCollection.Enumerator GetEnumerator() { throw null; }
500-
public override int GetHashCode() { throw null; }
501-
public static bool operator ==(Microsoft.AspNetCore.Http.Internal.HeaderSegmentCollection left, Microsoft.AspNetCore.Http.Internal.HeaderSegmentCollection right) { throw null; }
502-
public static bool operator !=(Microsoft.AspNetCore.Http.Internal.HeaderSegmentCollection left, Microsoft.AspNetCore.Http.Internal.HeaderSegmentCollection right) { throw null; }
503-
System.Collections.Generic.IEnumerator<Microsoft.AspNetCore.Http.Internal.HeaderSegment> System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Http.Internal.HeaderSegment>.GetEnumerator() { throw null; }
504-
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
505-
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
506-
public partial struct Enumerator : System.Collections.Generic.IEnumerator<Microsoft.AspNetCore.Http.Internal.HeaderSegment>, System.Collections.IEnumerator, System.IDisposable
507-
{
508-
private object _dummy;
509-
private int _dummyPrimitive;
510-
public Enumerator(Microsoft.Extensions.Primitives.StringValues headers) { throw null; }
511-
public Microsoft.AspNetCore.Http.Internal.HeaderSegment Current { get { throw null; } }
512-
object System.Collections.IEnumerator.Current { get { throw null; } }
513-
public void Dispose() { }
514-
public bool MoveNext() { throw null; }
515-
public void Reset() { }
516-
}
517-
}
518-
public static partial class ParsingHelpers
519-
{
520-
public static void AppendHeaderJoined(Microsoft.AspNetCore.Http.IHeaderDictionary headers, string key, params string[] values) { }
521-
public static void AppendHeaderUnmodified(Microsoft.AspNetCore.Http.IHeaderDictionary headers, string key, Microsoft.Extensions.Primitives.StringValues values) { }
522-
public static Microsoft.Extensions.Primitives.StringValues GetHeader(Microsoft.AspNetCore.Http.IHeaderDictionary headers, string key) { throw null; }
523-
public static Microsoft.Extensions.Primitives.StringValues GetHeaderSplit(Microsoft.AspNetCore.Http.IHeaderDictionary headers, string key) { throw null; }
524-
public static Microsoft.Extensions.Primitives.StringValues GetHeaderUnmodified(Microsoft.AspNetCore.Http.IHeaderDictionary headers, string key) { throw null; }
525-
public static void SetHeaderJoined(Microsoft.AspNetCore.Http.IHeaderDictionary headers, string key, Microsoft.Extensions.Primitives.StringValues value) { }
526-
public static void SetHeaderUnmodified(Microsoft.AspNetCore.Http.IHeaderDictionary headers, string key, Microsoft.Extensions.Primitives.StringValues? values) { }
527-
}
528-
}
529477
namespace Microsoft.AspNetCore.Routing
530478
{
531479
public partial class RouteValueDictionary : System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string, object>>, System.Collections.Generic.IDictionary<string, object>, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, object>>, System.Collections.Generic.IReadOnlyCollection<System.Collections.Generic.KeyValuePair<string, object>>, System.Collections.Generic.IReadOnlyDictionary<string, object>, System.Collections.IEnumerable

‎src/Http/Http.Abstractions/src/Extensions/HeaderDictionaryExtensions.cs‎

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

4-
using Microsoft.AspNetCore.Http.Internal;
54
using Microsoft.Extensions.Primitives;
65

76
namespace Microsoft.AspNetCore.Http

‎src/Http/Http.Abstractions/src/HostString.cs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using System.Collections.Generic;
66
using System.Globalization;
77
using Microsoft.AspNetCore.Http.Abstractions;
8-
using Microsoft.AspNetCore.Http.Internal;
98
using Microsoft.Extensions.Primitives;
109

1110
namespace Microsoft.AspNetCore.Http

‎src/Http/Http.Abstractions/src/Internal/HeaderSegment.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
using System;
55
using Microsoft.Extensions.Primitives;
66

7-
namespace Microsoft.AspNetCore.Http.Internal
7+
namespace Microsoft.AspNetCore.Http
88
{
9-
public readonly struct HeaderSegment : IEquatable<HeaderSegment>
9+
internal readonly struct HeaderSegment : IEquatable<HeaderSegment>
1010
{
1111
private readonly StringSegment _formatting;
1212
private readonly StringSegment _data;

‎src/Http/Http.Abstractions/src/Internal/HeaderSegmentCollection.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
using System.Collections.Generic;
77
using Microsoft.Extensions.Primitives;
88

9-
namespace Microsoft.AspNetCore.Http.Internal
9+
namespace Microsoft.AspNetCore.Http
1010
{
11-
public readonly struct HeaderSegmentCollection : IEnumerable<HeaderSegment>, IEquatable<HeaderSegmentCollection>
11+
internal readonly struct HeaderSegmentCollection : IEnumerable<HeaderSegment>, IEquatable<HeaderSegmentCollection>
1212
{
1313
private readonly StringValues _headers;
1414

0 commit comments

Comments
 (0)