96 instantiations of CacheControlHeaderValue
Microsoft.AspNetCore.Components.Endpoints (1)
src\Components\Shared\src\CacheHeaderSettings.cs (1)
22headers.CacheControl = new CacheControlHeaderValue
Microsoft.AspNetCore.Components.Server (1)
src\Components\Shared\src\CacheHeaderSettings.cs (1)
22headers.CacheControl = new CacheControlHeaderValue
Microsoft.AspNetCore.Components.WebAssembly.Server (1)
src\Components\Shared\src\CacheHeaderSettings.cs (1)
22headers.CacheControl = new CacheControlHeaderValue
Microsoft.AspNetCore.Http.Extensions.Tests (1)
HeaderDictionaryTypeExtensionsTest.cs (1)
51var expected = new CacheControlHeaderValue() { MaxAge = TimeSpan.FromSeconds(604800) };
Microsoft.AspNetCore.OutputCaching.Tests (10)
OutputCacheMiddlewareTests.cs (3)
39context.HttpContext.Request.Headers.CacheControl = new CacheControlHeaderValue() 456context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 482context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue()
OutputCachePolicyProviderTests.cs (7)
98context.HttpContext.Request.Headers.CacheControl = new CacheControlHeaderValue() 145context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 163context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 181context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 227context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 357context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 380context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue()
Microsoft.AspNetCore.ResponseCaching.Tests (42)
ResponseCachingMiddlewareTests.cs (4)
24context.HttpContext.Request.Headers.CacheControl = new CacheControlHeaderValue() 403context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 479context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 504context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue()
ResponseCachingPolicyProviderTests.cs (37)
87context.HttpContext.Request.Headers.CacheControl = new CacheControlHeaderValue() 102context.HttpContext.Request.Headers.CacheControl = new CacheControlHeaderValue() 146context.HttpContext.Request.Headers.CacheControl = new CacheControlHeaderValue() 172context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 186context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 203context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 220context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 237context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 254context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 273context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 349context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 366context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 385context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 408context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 428context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 450context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 470context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 508context.CachedResponseHeaders[HeaderNames.CacheControl] = new CacheControlHeaderValue() 526context.CachedResponseHeaders[HeaderNames.CacheControl] = new CacheControlHeaderValue() 547context.CachedResponseHeaders[HeaderNames.CacheControl] = new CacheControlHeaderValue() 567context.CachedResponseHeaders[HeaderNames.CacheControl] = new CacheControlHeaderValue() 589context.CachedResponseHeaders[HeaderNames.CacheControl] = new CacheControlHeaderValue() 610context.CachedResponseHeaders[HeaderNames.CacheControl] = new CacheControlHeaderValue() 629context.HttpContext.Request.Headers.CacheControl = new CacheControlHeaderValue() 634context.CachedResponseHeaders[HeaderNames.CacheControl] = new CacheControlHeaderValue() 653context.HttpContext.Request.Headers.CacheControl = new CacheControlHeaderValue() 658context.CachedResponseHeaders[HeaderNames.CacheControl] = new CacheControlHeaderValue() 675context.HttpContext.Request.Headers.CacheControl = new CacheControlHeaderValue() 682context.CachedResponseHeaders[HeaderNames.CacheControl] = new CacheControlHeaderValue() 699context.HttpContext.Request.Headers.CacheControl = new CacheControlHeaderValue() 705context.CachedResponseHeaders[HeaderNames.CacheControl] = new CacheControlHeaderValue() 722context.HttpContext.Request.Headers.CacheControl = new CacheControlHeaderValue() 729context.CachedResponseHeaders[HeaderNames.CacheControl] = new CacheControlHeaderValue() 746context.HttpContext.Request.Headers.CacheControl = new CacheControlHeaderValue() 753context.CachedResponseHeaders[HeaderNames.CacheControl] = new CacheControlHeaderValue() 771context.HttpContext.Request.Headers.CacheControl = new CacheControlHeaderValue() 778context.CachedResponseHeaders[HeaderNames.CacheControl] = new CacheControlHeaderValue()
TestUtils.cs (1)
44headers.CacheControl = new CacheControlHeaderValue
Microsoft.Net.Http.Headers (1)
CacheControlHeaderValue.cs (1)
551var result = new CacheControlHeaderValue();
Microsoft.Net.Http.Headers.Tests (38)
CacheControlHeaderValueTest.cs (38)
11var cacheControl = new CacheControlHeaderValue(); 70var cacheControl = new CacheControlHeaderValue(); 92cacheControl = new CacheControlHeaderValue(); 101cacheControl = new CacheControlHeaderValue(); 109var cacheControl = new CacheControlHeaderValue(); 119cacheControl = new CacheControlHeaderValue(); 139values[i] = new CacheControlHeaderValue(); 179values[i] = new CacheControlHeaderValue(); 210var cacheControl1 = new CacheControlHeaderValue(); 211var cacheControl2 = new CacheControlHeaderValue(); 212var cacheControl3 = new CacheControlHeaderValue(); 213var cacheControl4 = new CacheControlHeaderValue(); 214var cacheControl5 = new CacheControlHeaderValue(); 253values[i] = new CacheControlHeaderValue(); 293values[i] = new CacheControlHeaderValue(); 320var value1 = new CacheControlHeaderValue(); 322var value2 = new CacheControlHeaderValue(); 333var cacheControl1 = new CacheControlHeaderValue(); 334var cacheControl2 = new CacheControlHeaderValue(); 335var cacheControl3 = new CacheControlHeaderValue(); 336var cacheControl4 = new CacheControlHeaderValue(); 337var cacheControl5 = new CacheControlHeaderValue(); 338var cacheControl6 = new CacheControlHeaderValue(); 378var expected = new CacheControlHeaderValue(); 382expected = new CacheControlHeaderValue(); 388expected = new CacheControlHeaderValue(); 394expected = new CacheControlHeaderValue(); 401expected = new CacheControlHeaderValue(); 411expected = new CacheControlHeaderValue(); 417expected = new CacheControlHeaderValue(); 480var expected = new CacheControlHeaderValue(); 485expected = new CacheControlHeaderValue(); 491expected = new CacheControlHeaderValue(); 495expected = new CacheControlHeaderValue(); 517var expected = new CacheControlHeaderValue(); 522expected = new CacheControlHeaderValue(); 528expected = new CacheControlHeaderValue(); 532expected = new CacheControlHeaderValue();
ResponseCachingSample (1)
Startup.cs (1)
20context.Response.GetTypedHeaders().CacheControl = new CacheControlHeaderValue()
100 references to CacheControlHeaderValue
Microsoft.AspNetCore.Antiforgery (2)
Internal\DefaultAntiforgery.cs (2)
367CacheControlHeaderValue.TryParse(cacheControlHeader.ToString(), out var cacheControlHeaderValue))
Microsoft.AspNetCore.HeaderParsing (5)
CommonHeaders.cs (1)
40public static HeaderSetup<CacheControlHeaderValue> CacheControl => new(HeaderNames.CacheControl, CacheControlHeaderValueParser.Instance, cacheable: true);
Parsers\CacheControlHeaderValueParser.cs (4)
10internal sealed class CacheControlHeaderValueParser : HeaderParser<CacheControlHeaderValue> 14public override bool TryParse(StringValues values, [NotNullWhen(true)] out CacheControlHeaderValue? result, [NotNullWhen(false)] out string? error) 16if (values.Count != 1 || !CacheControlHeaderValue.TryParse(values[0], out var parsedValue))
Microsoft.AspNetCore.HeaderParsing.Tests (6)
HeaderParsingFeatureTests.cs (3)
202Assert.True(feature.TryGetHeaderValue(key, out var value1, out var error1)); 203Assert.True(feature.TryGetHeaderValue(key, out var value2, out var error2)); 204Assert.True(feature2.TryGetHeaderValue(key, out var value3, out var error3));
ParserTests.cs (3)
120Assert.True(CacheControlHeaderValueParser.Instance.TryParse(sv, out var result, out var error)); 130Assert.False(CacheControlHeaderValueParser.Instance.TryParse(sv, out var result, out var error)); 139Assert.False(CacheControlHeaderValueParser.Instance.TryParse(sv, out var result, out var error));
Microsoft.AspNetCore.Http.Extensions (8)
HeaderDictionaryTypeExtensions.cs (4)
135private static CacheControlHeaderValue? ParseCacheControlHeaderValue(string value) => CacheControlHeaderValue.TryParse(value, out var result) ? result : null; 180if (typeof(T) == typeof(CacheControlHeaderValue))
RequestHeaders.cs (2)
94public CacheControlHeaderValue? CacheControl 98return Headers.Get<CacheControlHeaderValue>(HeaderNames.CacheControl);
ResponseHeaders.cs (2)
34public CacheControlHeaderValue? CacheControl 38return Headers.Get<CacheControlHeaderValue>(HeaderNames.CacheControl);
Microsoft.AspNetCore.Http.Extensions.Tests (3)
HeaderDictionaryTypeExtensionsTest.cs (3)
49var result = context.Request.GetTypedHeaders().Get<CacheControlHeaderValue>(HeaderNames.CacheControl); 51var expected = new CacheControlHeaderValue() { MaxAge = TimeSpan.FromSeconds(604800) };
Microsoft.AspNetCore.OutputCaching (1)
OutputCacheMiddleware.cs (1)
364if (HeaderUtilities.ContainsCacheDirective(cacheContext.HttpContext.Request.Headers.CacheControl, CacheControlHeaderValue.OnlyIfCachedString))
Microsoft.AspNetCore.OutputCaching.Tests (1)
OutputCacheTests.cs (1)
674var builders = TestUtils.CreateBuildersWithOutputCaching(contextAction: context => context.Response.Headers.CacheControl = CacheControlHeaderValue.NoStoreString);
Microsoft.AspNetCore.ResponseCaching (18)
ResponseCachingContext.cs (2)
112HeaderUtilities.TryParseSeconds(HttpContext.Response.Headers.CacheControl, CacheControlHeaderValue.SharedMaxAgeString, out _responseSharedMaxAge); 125HeaderUtilities.TryParseSeconds(HttpContext.Response.Headers.CacheControl, CacheControlHeaderValue.MaxAgeString, out _responseMaxAge);
ResponseCachingMiddleware.cs (1)
230if (HeaderUtilities.ContainsCacheDirective(context.HttpContext.Request.Headers.CacheControl, CacheControlHeaderValue.OnlyIfCachedString))
ResponseCachingPolicyProvider.cs (15)
41if (HeaderUtilities.ContainsCacheDirective(cacheControl, CacheControlHeaderValue.NoCacheString)) 50if (HeaderUtilities.ContainsCacheDirective(requestHeaders.Pragma, CacheControlHeaderValue.NoCacheString)) 63return !HeaderUtilities.ContainsCacheDirective(context.HttpContext.Request.Headers.CacheControl, CacheControlHeaderValue.NoStoreString); 71if (!HeaderUtilities.ContainsCacheDirective(responseCacheControlHeader, CacheControlHeaderValue.PublicString)) 78if (HeaderUtilities.ContainsCacheDirective(responseCacheControlHeader, CacheControlHeaderValue.NoStoreString)) 85if (HeaderUtilities.ContainsCacheDirective(responseCacheControlHeader, CacheControlHeaderValue.NoCacheString)) 109if (HeaderUtilities.ContainsCacheDirective(responseCacheControlHeader, CacheControlHeaderValue.PrivateString)) 173if (HeaderUtilities.TryParseSeconds(requestCacheControlHeaders, CacheControlHeaderValue.MinFreshString, out var minFresh)) 181HeaderUtilities.TryParseSeconds(cachedCacheControlHeaders, CacheControlHeaderValue.SharedMaxAgeString, out cachedSharedMaxAge); 192HeaderUtilities.TryParseSeconds(requestCacheControlHeaders, CacheControlHeaderValue.MaxAgeString, out requestMaxAge); 195HeaderUtilities.TryParseSeconds(cachedCacheControlHeaders, CacheControlHeaderValue.MaxAgeString, out cachedMaxAge); 202if (HeaderUtilities.ContainsCacheDirective(cachedCacheControlHeaders, CacheControlHeaderValue.MustRevalidateString) 203|| HeaderUtilities.ContainsCacheDirective(cachedCacheControlHeaders, CacheControlHeaderValue.ProxyRevalidateString)) 210var maxStaleExist = HeaderUtilities.ContainsCacheDirective(requestCacheControlHeaders, CacheControlHeaderValue.MaxStaleString); 211HeaderUtilities.TryParseSeconds(requestCacheControlHeaders, CacheControlHeaderValue.MaxStaleString, out requestMaxStale);
Microsoft.AspNetCore.ResponseCaching.Microbenchmarks (3)
ResponseCachingBenchmark.cs (3)
18private static readonly string _cacheControl = $"{CacheControlHeaderValue.PublicString}, {CacheControlHeaderValue.MaxAgeString}={int.MaxValue}"; 61context.Request.Headers.CacheControl = CacheControlHeaderValue.NoCacheString;
Microsoft.AspNetCore.ResponseCaching.Tests (1)
ResponseCachingTests.cs (1)
619var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Response.Headers.CacheControl = CacheControlHeaderValue.NoStoreString);
Microsoft.AspNetCore.Server.HttpSys (2)
RequestProcessing\RequestContext.FeatureCollection.cs (2)
687CacheControlHeaderValue? cacheControl; 688if (CacheControlHeaderValue.TryParse(cacheControlHeader.ToString(), out cacheControl) && cacheControl.Public)
Microsoft.Net.Http.Headers (14)
CacheControlHeaderValue.cs (14)
82private static readonly HttpHeaderParser<CacheControlHeaderValue> Parser 83= new GenericHeaderParser<CacheControlHeaderValue>(true, GetCacheControlLength); 105/// Initializes a new instance of <see cref="CacheControlHeaderValue"/>. 401var other = obj as CacheControlHeaderValue; 484/// Parses <paramref name="input"/> as a <see cref="CacheControlHeaderValue"/> value. 488public static CacheControlHeaderValue Parse(StringSegment input) 492var result = Parser.ParseValue(input, ref index); 501/// Attempts to parse the specified <paramref name="input"/> as a <see cref="CacheControlHeaderValue"/>. 505/// <returns><see langword="true"/> if input is a valid <see cref="CacheControlHeaderValue"/>, otherwise <see langword="false"/>.</returns> 506public static bool TryParse(StringSegment input, [NotNullWhen(true)] out CacheControlHeaderValue? parsedValue) 518private static int GetCacheControlLength(StringSegment input, int startIndex, out CacheControlHeaderValue? parsedValue) 551var result = new CacheControlHeaderValue(); 565CacheControlHeaderValue cc,
Microsoft.Net.Http.Headers.Tests (36)
CacheControlHeaderValueTest.cs (36)
11var cacheControl = new CacheControlHeaderValue(); 70var cacheControl = new CacheControlHeaderValue(); 109var cacheControl = new CacheControlHeaderValue(); 135var values = new CacheControlHeaderValue[9]; 175var values = new CacheControlHeaderValue[4]; 210var cacheControl1 = new CacheControlHeaderValue(); 211var cacheControl2 = new CacheControlHeaderValue(); 212var cacheControl3 = new CacheControlHeaderValue(); 213var cacheControl4 = new CacheControlHeaderValue(); 214var cacheControl5 = new CacheControlHeaderValue(); 249var values = new CacheControlHeaderValue[9]; 289var values = new CacheControlHeaderValue[4]; 320var value1 = new CacheControlHeaderValue(); 322var value2 = new CacheControlHeaderValue(); 333var cacheControl1 = new CacheControlHeaderValue(); 334var cacheControl2 = new CacheControlHeaderValue(); 335var cacheControl3 = new CacheControlHeaderValue(); 336var cacheControl4 = new CacheControlHeaderValue(); 337var cacheControl5 = new CacheControlHeaderValue(); 338var cacheControl6 = new CacheControlHeaderValue(); 378var expected = new CacheControlHeaderValue(); 480var expected = new CacheControlHeaderValue(); 517var expected = new CacheControlHeaderValue(); 549private void CompareHashCodes(CacheControlHeaderValue x, CacheControlHeaderValue y, bool areEqual) 561private void CompareValues(CacheControlHeaderValue x, CacheControlHeaderValue y, bool areEqual) 567private void CheckValidParse(string? input, CacheControlHeaderValue expectedResult) 569var result = CacheControlHeaderValue.Parse(input); 575Assert.Throws<FormatException>(() => CacheControlHeaderValue.Parse(input)); 578private void CheckValidTryParse(string? input, CacheControlHeaderValue expectedResult) 580Assert.True(CacheControlHeaderValue.TryParse(input, out var result)); 586Assert.False(CacheControlHeaderValue.TryParse(input, out var result));