Skip to content

Commit 3c266f8

Browse files
authored
Rename IndexOfAnyValues to SearchValues (#48067)
1 parent 26186fd commit 3c266f8

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

src/Components/Components/src/Routing/TemplateParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Components.Routing;
2020
// * Catch-all parameters (Like /blog/{*slug})
2121
internal sealed class TemplateParser
2222
{
23-
private static readonly IndexOfAnyValues<char> _invalidParameterNameCharacters = IndexOfAnyValues.Create("{}=.");
23+
private static readonly SearchValues<char> _invalidParameterNameCharacters = SearchValues.Create("{}=.");
2424

2525
internal static RouteTemplate ParseTemplate(string template)
2626
{

src/Http/Headers/src/ContentDispositionHeaderValue.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public class ContentDispositionHeaderValue
3737

3838
// attr-char definition from RFC5987
3939
// Same as token except ( "*" / "'" / "%" )
40-
private static readonly IndexOfAnyValues<char> AttrChar =
41-
IndexOfAnyValues.Create("!#$&+-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`abcdefghijklmnopqrstuvwxyz|~");
40+
private static readonly SearchValues<char> AttrChar =
41+
SearchValues.Create("!#$&+-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`abcdefghijklmnopqrstuvwxyz|~");
4242

4343
private static readonly HttpHeaderParser<ContentDispositionHeaderValue> Parser
4444
= new GenericHeaderParser<ContentDispositionHeaderValue>(false, GetDispositionTypeLength);

src/Http/Routing/src/Patterns/RoutePatternParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ internal static class RoutePatternParser
1616
private const char QuestionMark = '?';
1717
private const string PeriodString = ".";
1818

19-
internal static readonly IndexOfAnyValues<char> InvalidParameterNameChars = IndexOfAnyValues.Create("/{}?*");
19+
internal static readonly SearchValues<char> InvalidParameterNameChars = SearchValues.Create("/{}?*");
2020

2121
public static RoutePattern Parse(string pattern)
2222
{

src/Middleware/HttpOverrides/src/ForwardedHeadersMiddleware.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ public class ForwardedHeadersMiddleware
2525
private IList<StringSegment>? _allowedHosts;
2626

2727
// RFC 3986 scheme = ALPHA * (ALPHA / DIGIT / "+" / "-" / ".")
28-
private static readonly IndexOfAnyValues<char> SchemeChars =
29-
IndexOfAnyValues.Create("+-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
28+
private static readonly SearchValues<char> SchemeChars =
29+
SearchValues.Create("+-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
3030

3131
// Host Matches Http.Sys and Kestrel
3232
// Host Matches RFC 3986 except "*" / "+" / "," / ";" / "=" and "%" HEXDIG HEXDIG which are not allowed by Http.Sys
33-
private static readonly IndexOfAnyValues<char> HostChars =
34-
IndexOfAnyValues.Create("!$&'()-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~");
33+
private static readonly SearchValues<char> HostChars =
34+
SearchValues.Create("!$&'()-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~");
3535

3636
// 0-9 / A-F / a-f / ":" / "."
37-
private static readonly IndexOfAnyValues<char> Ipv6HostChars =
38-
IndexOfAnyValues.Create(".0123456789:ABCDEFabcdef");
37+
private static readonly SearchValues<char> Ipv6HostChars =
38+
SearchValues.Create(".0123456789:ABCDEFabcdef");
3939

4040
/// <summary>
4141
/// Create a new <see cref="ForwardedHeadersMiddleware"/>.

src/Shared/HttpRuleParser.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ internal static class HttpRuleParser
1313
{
1414
// token = 1*<any CHAR except CTLs or separators>
1515
// CTL = <any US-ASCII control character (octets 0 - 31) and DEL (127)>
16-
private static readonly IndexOfAnyValues<char> TokenChars =
17-
IndexOfAnyValues.Create("!#$%&'*+-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`abcdefghijklmnopqrstuvwxyz|~");
16+
private static readonly SearchValues<char> TokenChars =
17+
SearchValues.Create("!#$%&'*+-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`abcdefghijklmnopqrstuvwxyz|~");
1818

1919
private const int MaxNestedCount = 5;
2020
private static readonly string[] DateFormats = new string[]

src/Shared/ServerInfrastructure/HttpCharacters.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@ internal static class HttpCharacters
1919
// 127.0.0.1
2020
2121
22-
private static readonly IndexOfAnyValues<byte> _allowedAuthorityBytes = IndexOfAnyValues.Create(":.-[]@0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"u8);
22+
private static readonly SearchValues<byte> _allowedAuthorityBytes = SearchValues.Create(":.-[]@0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"u8);
2323

2424
// Matches Http.Sys
2525
// Matches RFC 3986 except "*" / "+" / "," / ";" / "=" and "%" HEXDIG HEXDIG which are not allowed by Http.Sys
26-
private static readonly IndexOfAnyValues<char> _allowedHostChars = IndexOfAnyValues.Create("!$&'()-._~" + AlphaNumeric);
26+
private static readonly SearchValues<char> _allowedHostChars = SearchValues.Create("!$&'()-._~" + AlphaNumeric);
2727

2828
// tchar https://tools.ietf.org/html/rfc7230#appendix-B
29-
private static readonly IndexOfAnyValues<char> _allowedTokenChars = IndexOfAnyValues.Create("!#$%&'*+-.^_`|~" + AlphaNumeric);
30-
private static readonly IndexOfAnyValues<byte> _allowedTokenBytes = IndexOfAnyValues.Create("!#$%&'*+-.^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"u8);
29+
private static readonly SearchValues<char> _allowedTokenChars = SearchValues.Create("!#$%&'*+-.^_`|~" + AlphaNumeric);
30+
private static readonly SearchValues<byte> _allowedTokenBytes = SearchValues.Create("!#$%&'*+-.^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"u8);
3131

3232
// field-value https://tools.ietf.org/html/rfc7230#section-3.2
3333
// HTAB, [VCHAR, SP]
34-
private static readonly IndexOfAnyValues<char> _allowedFieldChars = IndexOfAnyValues.Create("\t !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~" + AlphaNumeric);
34+
private static readonly SearchValues<char> _allowedFieldChars = SearchValues.Create("\t !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~" + AlphaNumeric);
3535

3636
// Values are [0x00, 0x1F] without 0x09 (HTAB) and with 0x7F.
37-
private static readonly IndexOfAnyValues<char> _invalidFieldChars = IndexOfAnyValues.Create(
37+
private static readonly SearchValues<char> _invalidFieldChars = SearchValues.Create(
3838
"\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u000A\u000B\u000C\u000D\u000E\u000F\u0010" +
3939
"\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F\u007F");
4040

0 commit comments

Comments
 (0)