105 instantiations of HeaderDescriptor
System.Net.Http (105)
System\Net\Http\Headers\HeaderDescriptor.cs (5)
66
descriptor = new
HeaderDescriptor
(knownHeader);
76
descriptor = new
HeaderDescriptor
(headerName);
88
descriptor = new
HeaderDescriptor
(knownHeader);
98
descriptor = new
HeaderDescriptor
(HttpRuleParser.GetTokenString(headerName));
129
return new
HeaderDescriptor
(Name, customHeader: true);
System\Net\Http\Headers\KnownHeader.cs (1)
49
public HeaderDescriptor Descriptor => new
HeaderDescriptor
(this);
System\Net\Http\Headers\QPackStaticTable.cs (99)
12
(new
HeaderDescriptor
(":authority"), ""), // 0
13
(new
HeaderDescriptor
(":path"), "/"), // 1
14
(new
HeaderDescriptor
(KnownHeaders.Age), "0"), // 2
15
(new
HeaderDescriptor
(KnownHeaders.ContentDisposition), ""), // 3
16
(new
HeaderDescriptor
(KnownHeaders.ContentLength), "0"), // 4
17
(new
HeaderDescriptor
(KnownHeaders.Cookie), ""), // 5
18
(new
HeaderDescriptor
(KnownHeaders.Date), ""), // 6
19
(new
HeaderDescriptor
(KnownHeaders.ETag), ""), // 7
20
(new
HeaderDescriptor
(KnownHeaders.IfModifiedSince), ""), // 8
21
(new
HeaderDescriptor
(KnownHeaders.IfNoneMatch), ""), // 9
22
(new
HeaderDescriptor
(KnownHeaders.LastModified), ""), // 10
23
(new
HeaderDescriptor
(KnownHeaders.Link), ""), // 11
24
(new
HeaderDescriptor
(KnownHeaders.Location), ""), // 12
25
(new
HeaderDescriptor
(KnownHeaders.Referer), ""), // 13
26
(new
HeaderDescriptor
(KnownHeaders.SetCookie), ""), // 14
27
(new
HeaderDescriptor
(":method"), "CONNECT"), // 15
28
(new
HeaderDescriptor
(":method"), "DELETE"), // 16
29
(new
HeaderDescriptor
(":method"), "GET"), // 17
30
(new
HeaderDescriptor
(":method"), "HEAD"), // 18
31
(new
HeaderDescriptor
(":method"), "OPTIONS"), // 19
32
(new
HeaderDescriptor
(":method"), "POST"), // 20
33
(new
HeaderDescriptor
(":method"), "PUT"), // 21
34
(new
HeaderDescriptor
(":scheme"), "http"), // 22
35
(new
HeaderDescriptor
(":scheme"), "https"), // 23
36
(new
HeaderDescriptor
(KnownHeaders.PseudoStatus), "103"), // 24
37
(new
HeaderDescriptor
(KnownHeaders.PseudoStatus), "200"), // 25
38
(new
HeaderDescriptor
(KnownHeaders.PseudoStatus), "304"), // 26
39
(new
HeaderDescriptor
(KnownHeaders.PseudoStatus), "404"), // 27
40
(new
HeaderDescriptor
(KnownHeaders.PseudoStatus), "503"), // 28
41
(new
HeaderDescriptor
(KnownHeaders.Accept), "*/*"), // 29
42
(new
HeaderDescriptor
(KnownHeaders.Accept), "application/dns-message"), // 30
43
(new
HeaderDescriptor
(KnownHeaders.AcceptEncoding), "gzip, deflate, br"), // 31
44
(new
HeaderDescriptor
(KnownHeaders.AcceptRanges), "bytes"), // 32
45
(new
HeaderDescriptor
(KnownHeaders.AccessControlAllowHeaders), "cache-control"), // 33
46
(new
HeaderDescriptor
(KnownHeaders.AccessControlAllowHeaders), "content-type"), // 34
47
(new
HeaderDescriptor
(KnownHeaders.AccessControlAllowOrigin), "*"), // 35
48
(new
HeaderDescriptor
(KnownHeaders.CacheControl), "max-age=0"), // 36
49
(new
HeaderDescriptor
(KnownHeaders.CacheControl), "max-age=2592000"), // 37
50
(new
HeaderDescriptor
(KnownHeaders.CacheControl), "max-age=604800"), // 38
51
(new
HeaderDescriptor
(KnownHeaders.CacheControl), "no-cache"), // 39
52
(new
HeaderDescriptor
(KnownHeaders.CacheControl), "no-store"), // 40
53
(new
HeaderDescriptor
(KnownHeaders.CacheControl), "public, max-age=31536000"), // 41
54
(new
HeaderDescriptor
(KnownHeaders.ContentEncoding), "br"), // 42
55
(new
HeaderDescriptor
(KnownHeaders.ContentEncoding), "gzip"), // 43
56
(new
HeaderDescriptor
(KnownHeaders.ContentType), "application/dns-message"), // 44
57
(new
HeaderDescriptor
(KnownHeaders.ContentType), "application/javascript"), // 45
58
(new
HeaderDescriptor
(KnownHeaders.ContentType), "application/json"), // 46
59
(new
HeaderDescriptor
(KnownHeaders.ContentType), "application/x-www-form-urlencoded"), // 47
60
(new
HeaderDescriptor
(KnownHeaders.ContentType), "image/gif"), // 48
61
(new
HeaderDescriptor
(KnownHeaders.ContentType), "image/jpeg"), // 49
62
(new
HeaderDescriptor
(KnownHeaders.ContentType), "image/png"), // 50
63
(new
HeaderDescriptor
(KnownHeaders.ContentType), "text/css"), // 51
64
(new
HeaderDescriptor
(KnownHeaders.ContentType), "text/html; charset=utf-8"), // 52; Whitespace is correct, see spec.
65
(new
HeaderDescriptor
(KnownHeaders.ContentType), "text/plain"), // 53
66
(new
HeaderDescriptor
(KnownHeaders.ContentType), "text/plain;charset=utf-8"), // 54; Whitespace is correct, see spec.
67
(new
HeaderDescriptor
(KnownHeaders.Range), "bytes=0-"), // 55
68
(new
HeaderDescriptor
(KnownHeaders.StrictTransportSecurity), "max-age=31536000"), // 56
69
(new
HeaderDescriptor
(KnownHeaders.StrictTransportSecurity), "max-age=31536000; includesubdomains"), // 57
70
(new
HeaderDescriptor
(KnownHeaders.StrictTransportSecurity), "max-age=31536000; includesubdomains; preload"), // 58
71
(new
HeaderDescriptor
(KnownHeaders.Vary), "accept-encoding"), // 59
72
(new
HeaderDescriptor
(KnownHeaders.Vary), "origin"), // 60
73
(new
HeaderDescriptor
(KnownHeaders.XContentTypeOptions), "nosniff"), // 61
74
(new
HeaderDescriptor
(KnownHeaders.XXssProtection), "1; mode=block"), // 62
75
(new
HeaderDescriptor
(KnownHeaders.PseudoStatus), "100"), // 63
76
(new
HeaderDescriptor
(KnownHeaders.PseudoStatus), "204"), // 64
77
(new
HeaderDescriptor
(KnownHeaders.PseudoStatus), "206"), // 65
78
(new
HeaderDescriptor
(KnownHeaders.PseudoStatus), "302"), // 66
79
(new
HeaderDescriptor
(KnownHeaders.PseudoStatus), "400"), // 67
80
(new
HeaderDescriptor
(KnownHeaders.PseudoStatus), "403"), // 68
81
(new
HeaderDescriptor
(KnownHeaders.PseudoStatus), "421"), // 69
82
(new
HeaderDescriptor
(KnownHeaders.PseudoStatus), "425"), // 70
83
(new
HeaderDescriptor
(KnownHeaders.PseudoStatus), "500"), // 71
84
(new
HeaderDescriptor
(KnownHeaders.AcceptLanguage), ""), // 72
85
(new
HeaderDescriptor
(KnownHeaders.AccessControlAllowCredentials), "FALSE"), // 73
86
(new
HeaderDescriptor
(KnownHeaders.AccessControlAllowCredentials), "TRUE"), // 74
87
(new
HeaderDescriptor
(KnownHeaders.AccessControlAllowHeaders), "*"), // 75
88
(new
HeaderDescriptor
(KnownHeaders.AccessControlAllowMethods), "get"), // 76
89
(new
HeaderDescriptor
(KnownHeaders.AccessControlAllowMethods), "get, post, options"), // 77
90
(new
HeaderDescriptor
(KnownHeaders.AccessControlAllowMethods), "options"), // 78
91
(new
HeaderDescriptor
(KnownHeaders.AccessControlExposeHeaders), "content-length"), // 79
92
(new
HeaderDescriptor
("access-control-request-headers"), "content-type"), // 80
93
(new
HeaderDescriptor
("access-control-request-method"), "get"), // 81
94
(new
HeaderDescriptor
("access-control-request-method"), "post"), // 82
95
(new
HeaderDescriptor
(KnownHeaders.AltSvc), "clear"), // 83
96
(new
HeaderDescriptor
(KnownHeaders.Authorization), ""), // 84
97
(new
HeaderDescriptor
(KnownHeaders.ContentSecurityPolicy), "script-src 'none'; object-src 'none'; base-uri 'none'"), // 85
98
(new
HeaderDescriptor
("early-data"), "1"), // 86
99
(new
HeaderDescriptor
(KnownHeaders.ExpectCT), ""), // 87
100
(new
HeaderDescriptor
("forwarded"), ""), // 88
101
(new
HeaderDescriptor
(KnownHeaders.IfRange), ""), // 89
102
(new
HeaderDescriptor
(KnownHeaders.Origin), ""), // 90
103
(new
HeaderDescriptor
("purpose"), "prefetch"), // 91
104
(new
HeaderDescriptor
(KnownHeaders.Server), ""), // 92
105
(new
HeaderDescriptor
("timing-allow-origin"), "*"), // 93
106
(new
HeaderDescriptor
(KnownHeaders.UpgradeInsecureRequests), "1"), // 94
107
(new
HeaderDescriptor
(KnownHeaders.UserAgent), ""), // 95
108
(new
HeaderDescriptor
("x-forwarded-for"), ""), // 96
109
(new
HeaderDescriptor
(KnownHeaders.XFrameOptions), "deny"), // 97
110
(new
HeaderDescriptor
(KnownHeaders.XFrameOptions), "sameorigin") // 98
107 references to HeaderDescriptor
System.Net.Http (107)
System\Net\Http\DiagnosticsHandler.cs (8)
23
private readonly
HeaderDescriptor
[]? _propagatorFields;
36
var fieldDescriptors = new List<
HeaderDescriptor
>(fields.Count);
39
if (field is not null &&
HeaderDescriptor
.TryGet(field, out
HeaderDescriptor
descriptor))
100
if (request.WasRedirected() && _propagatorFields is
HeaderDescriptor
[] fields)
102
foreach (
HeaderDescriptor
field in fields)
352
HeaderDescriptor
.TryGet(key, out
HeaderDescriptor
descriptor) &&
System\Net\Http\Headers\HeaderDescriptor.cs (9)
16
internal readonly struct HeaderDescriptor : IEquatable<
HeaderDescriptor
>
42
public bool Equals(
HeaderDescriptor
other)
59
public static bool TryGet(string headerName, out
HeaderDescriptor
descriptor)
72
descriptor = default(
HeaderDescriptor
);
81
public static bool TryGet(ReadOnlySpan<byte> headerName, out
HeaderDescriptor
descriptor)
94
descriptor = default(
HeaderDescriptor
);
102
internal static bool TryGetStaticQPackHeader(int index, out
HeaderDescriptor
descriptor, [NotNullWhen(true)] out string? knownValue)
107
(
HeaderDescriptor
descriptor, string value)[] qpackStaticTable = QPackStaticTable.HeaderLookup;
125
public
HeaderDescriptor
AsCustomHeader()
System\Net\Http\Headers\HeaderStringValues.cs (3)
13
private readonly
HeaderDescriptor
_header;
20
internal HeaderStringValues(
HeaderDescriptor
descriptor, string value)
29
internal HeaderStringValues(
HeaderDescriptor
descriptor, string[] values)
System\Net\Http\Headers\HeaderUtilities.cs (2)
273
internal static DateTimeOffset? GetDateTimeOffsetValue(
HeaderDescriptor
descriptor, HttpHeaders store, DateTimeOffset? defaultValue = null)
290
internal static TimeSpan? GetTimeSpanValue(
HeaderDescriptor
descriptor, HttpHeaders store)
System\Net\Http\Headers\HttpHeaders.cs (54)
21
public
HeaderDescriptor
Key;
24
public HeaderEntry(
HeaderDescriptor
key, object value)
53
/// <summary>Either a <see cref="HeaderEntry"/> array or a Dictionary<<see cref="
HeaderDescriptor
"/>, <see cref="object"/>> </summary>
79
internal void Add(
HeaderDescriptor
descriptor, string? value)
99
internal void Add(
HeaderDescriptor
descriptor, IEnumerable<string?> values)
131
TryGetHeaderDescriptor(name, out
HeaderDescriptor
descriptor) &&
134
internal bool TryAddWithoutValidation(
HeaderDescriptor
descriptor, string? value)
165
TryGetHeaderDescriptor(name, out
HeaderDescriptor
descriptor) &&
168
internal bool TryAddWithoutValidation(
HeaderDescriptor
descriptor, IEnumerable<string?> values)
232
internal IEnumerable<string> GetValues(
HeaderDescriptor
descriptor)
244
if (TryGetHeaderDescriptor(name, out
HeaderDescriptor
descriptor))
253
internal bool TryGetValues(
HeaderDescriptor
descriptor, [NotNullWhen(true)] out IEnumerable<string>? values)
309
internal string GetHeaderString(
HeaderDescriptor
descriptor)
354
: ref CollectionsMarshal.GetValueRefOrNullRef((Dictionary<
HeaderDescriptor
, object>)_headerStore, entry.Key);
377
internal void AddParsedValue(
HeaderDescriptor
descriptor, object value)
391
internal void SetParsedValue(
HeaderDescriptor
descriptor, object value)
406
internal void SetOrRemoveParsedValue(
HeaderDescriptor
descriptor, object? value)
420
internal bool RemoveParsedValue(
HeaderDescriptor
descriptor, object value)
498
internal bool ContainsParsedValue(
HeaderDescriptor
descriptor, object value)
604
private static HeaderStoreItemInfo CloneHeaderInfo(
HeaderDescriptor
descriptor, HeaderStoreItemInfo sourceInfo)
680
private HeaderStoreItemInfo GetOrCreateHeaderInfo(
HeaderDescriptor
descriptor)
692
private HeaderStoreItemInfo CreateAndAddHeaderToStore(
HeaderDescriptor
descriptor)
707
internal bool TryGetHeaderValue(
HeaderDescriptor
descriptor, [NotNullWhen(true)] out object? value)
722
private bool TryGetAndParseHeaderInfo(
HeaderDescriptor
key, [NotNullWhen(true)] out HeaderStoreItemInfo? info)
766
private static void ParseRawHeaderValues(
HeaderDescriptor
descriptor, HeaderStoreItemInfo info)
796
private static void ParseSingleRawHeaderValue(HeaderStoreItemInfo info,
HeaderDescriptor
descriptor, string rawValue)
821
internal bool TryParseAndAddValue(
HeaderDescriptor
descriptor, string? value)
845
private static bool TryParseAndAddRawHeaderValue(
HeaderDescriptor
descriptor, HeaderStoreItemInfo info, string? value, bool addWhenInvalid)
975
internal object? GetSingleParsedValue(
HeaderDescriptor
descriptor)
985
internal object? GetParsedAndInvalidValues(
HeaderDescriptor
descriptor)
995
internal virtual bool IsAllowedHeaderName(
HeaderDescriptor
descriptor) => true;
997
private void PrepareHeaderInfoForAdd(
HeaderDescriptor
descriptor, out HeaderStoreItemInfo info, out bool addToStore)
1012
private static void ParseAndAddValue(
HeaderDescriptor
descriptor, HeaderStoreItemInfo info, string? value)
1074
private
HeaderDescriptor
GetHeaderDescriptor(string name)
1078
if (!
HeaderDescriptor
.TryGet(name, out
HeaderDescriptor
descriptor))
1095
internal bool TryGetHeaderDescriptor(string name, out
HeaderDescriptor
descriptor)
1103
if (
HeaderDescriptor
.TryGet(name, out descriptor))
1135
internal static string[] GetStoreValuesAsStringArray(
HeaderDescriptor
descriptor, HeaderStoreItemInfo info)
1142
internal static void GetStoreValuesAsStringOrStringArray(
HeaderDescriptor
descriptor, object sourceValues, out string? singleValue, out string[]? multiValue)
1178
internal static int GetStoreValuesIntoStringArray(
HeaderDescriptor
descriptor, object sourceValues, [NotNull] ref string[]? values)
1388
var dictionary = (Dictionary<
HeaderDescriptor
, object>)_headerStore!;
1391
foreach (KeyValuePair<
HeaderDescriptor
, object> entry in dictionary)
1412
private ref object GetValueRefOrNullRef(
HeaderDescriptor
key)
1430
valueRef = ref CollectionsMarshal.GetValueRefOrNullRef(Unsafe.As<Dictionary<
HeaderDescriptor
, object>>(store), key);
1436
private ref object? GetValueRefOrAddDefault(
HeaderDescriptor
key)
1473
ref object? GrowEntriesAndAddDefault(
HeaderDescriptor
key)
1490
ref object? ConvertToDictionaryAndAddDefault(
HeaderDescriptor
key)
1493
var dictionary = new Dictionary<
HeaderDescriptor
, object>(ArrayThreshold);
1503
ref object? DictionaryGetValueRefOrAddDefault(
HeaderDescriptor
key)
1505
var dictionary = (Dictionary<
HeaderDescriptor
, object>)_headerStore!;
1533
internal bool Contains(
HeaderDescriptor
key)
1551
internal bool Remove(
HeaderDescriptor
key)
1575
removed = Unsafe.As<Dictionary<
HeaderDescriptor
, object>>(store).Remove(key);
System\Net\Http\Headers\HttpHeadersNonValidated.cs (2)
35
headers.TryGetHeaderDescriptor(headerName, out
HeaderDescriptor
descriptor) &&
65
headers.TryGetHeaderDescriptor(headerName, out
HeaderDescriptor
descriptor) &&
System\Net\Http\Headers\HttpHeaderValueCollection.cs (2)
35
private readonly
HeaderDescriptor
_descriptor;
48
internal HttpHeaderValueCollection(
HeaderDescriptor
descriptor, HttpHeaders store)
System\Net\Http\Headers\HttpResponseHeaders.cs (1)
158
internal override bool IsAllowedHeaderName(
HeaderDescriptor
descriptor)
System\Net\Http\Headers\KnownHeader.cs (1)
49
public
HeaderDescriptor
Descriptor => new HeaderDescriptor(this);
System\Net\Http\Headers\QPackStaticTable.cs (2)
10
internal static (
HeaderDescriptor
descriptor, string value)[] HeaderLookup { get; } = new (
HeaderDescriptor
descriptor, string value)[]
System\Net\Http\SocketsHttpHandler\Http2Stream.cs (7)
502
private static readonly (
HeaderDescriptor
descriptor, byte[] value)[] s_hpackStaticHeaderTable = new (
HeaderDescriptor
, byte[])[LastHPackNormalHeaderId - FirstHPackNormalHeaderId + 1]
570
(
HeaderDescriptor
descriptor, byte[] value) = s_hpackStaticHeaderTable[index - FirstHPackNormalHeaderId];
593
(
HeaderDescriptor
descriptor, _) = s_hpackStaticHeaderTable[index - FirstHPackNormalHeaderId];
677
private void OnHeader(
HeaderDescriptor
descriptor, ReadOnlySpan<byte> value)
751
if (!
HeaderDescriptor
.TryGet(name, out
HeaderDescriptor
descriptor))
System\Net\Http\SocketsHttpHandler\Http3RequestStream.cs (11)
47
private List<(
HeaderDescriptor
name, string value)>? _trailingHeaders;
556
_trailingHeaders = new List<(
HeaderDescriptor
name, string value)>();
594
foreach ((
HeaderDescriptor
name, string value) in _trailingHeaders)
946
if (!
HeaderDescriptor
.TryGet(name, out
HeaderDescriptor
descriptor))
956
GetStaticQPackHeader(index, out
HeaderDescriptor
descriptor, out string? knownValue);
962
GetStaticQPackHeader(index, out
HeaderDescriptor
descriptor, knownValue: out _);
971
private void GetStaticQPackHeader(int index, out
HeaderDescriptor
descriptor, out string? knownValue)
973
if (!
HeaderDescriptor
.TryGetStaticQPackHeader(index, out descriptor, out knownValue))
985
private void OnHeader(int? staticIndex,
HeaderDescriptor
descriptor, string? staticValue, ReadOnlySpan<byte> literalValue)
1357
_trailingHeaders = new List<(
HeaderDescriptor
name, string value)>();
System\Net\Http\SocketsHttpHandler\HttpConnection.cs (2)
1271
if (!
HeaderDescriptor
.TryGet(name, out
HeaderDescriptor
descriptor))
System\Net\Http\SocketsHttpHandler\HttpConnectionBase.cs (3)
125
/// <summary>Uses <see cref="
HeaderDescriptor
.GetHeaderValue"/>, but first special-cases several known headers for which we can use caching.</summary>
126
public string GetResponseHeaderValueWithCaching(
HeaderDescriptor
descriptor, ReadOnlySpan<byte> value, Encoding? valueEncoding)
133
static string GetOrAddCachedValue([NotNull] ref string? cache,
HeaderDescriptor
descriptor, ReadOnlySpan<byte> value, Encoding? encoding)