public bool SetCacheControlHeaders(CacheControl control, bool force = true, string vary = null) { if (!force && m_NetResponse.Headers[HttpResponseHeader.CacheControl].IsNotNullOrWhiteSpace()) { return(false); } var value = control.HTTPCacheControl; if (value.IsNullOrWhiteSpace()) { return(false); } m_NetResponse.Headers[HttpResponseHeader.CacheControl] = value; if (control.Cacheability == CacheControl.Type.NoCache) { m_NetResponse.Headers[HttpResponseHeader.Pragma] = "no-cache"; m_NetResponse.Headers[HttpResponseHeader.Expires] = "0"; m_NetResponse.Headers[HttpResponseHeader.Vary] = "*"; } else { //if (control.MaxAgeSec.HasValue) // m_NetResponse.Headers[HttpRequestHeader.Expires] = App.TimeSource.UTCNow.AddSeconds(control.MaxAgeSec.Value).DateTimeToHTTPCookieDateTime(); if (vary.IsNotNullOrWhiteSpace()) { m_NetResponse.Headers[HttpResponseHeader.Vary] = vary; } } return(true); }
public DisableCacheControlFeatureHandler( [DisallowNull] ICacheControlKeyProvider keyProvider, [DisallowNull] CacheControl cacheControl, [DisallowNull] ICacheControlStore cacheControlStore) : base(cacheControl, keyProvider, cacheControlStore) { }
public async Task TestHelloWorldAsync() { var host = "localhost"; var port = 50051; var handler = new GroupCacheHandler(); using (var server = new OwinServer(handler, port, host)){ server.Start(); var endpoint = new PeerEndpoint() { HostName = host, Port = port }; using (var client = new OwinClient(endpoint)) { using (var stream = new MemoryStream()) { var cacheControl = new CacheControl(); await client.GetAsync("groupA", "key1", stream, cacheControl, CancellationToken.None); var str = stream.StreamToString(); Assert.AreEqual(str, "HelloWorld"); Assert.IsFalse(cacheControl.NoStore); } } } }
public NativeMessageHandler(bool throwOnCaptiveNetwork, bool customSSLVerification, NativeCookieHandler cookieHandler = null) { this.throwOnCaptiveNetwork = throwOnCaptiveNetwork; if (customSSLVerification) client.SetHostnameVerifier(new HostnameVerifier()); noCacheCacheControl = (new CacheControl.Builder()).NoCache().Build(); }
protected CacheControlFeatureHandler( [DisallowNull] CacheControl cacheControl, [DisallowNull] ICacheControlKeyProvider keyProvider, [DisallowNull] ICacheControlStore cacheControlStore) { this.cacheControl = cacheControl ?? throw new ArgumentNullException(nameof(cacheControl)); this.keyProvider = keyProvider ?? throw new ArgumentNullException(nameof(keyProvider)); this.cacheControlStore = cacheControlStore ?? throw new ArgumentNullException(nameof(cacheControlStore)); }
public NativeMessageHandler(bool throwOnCaptiveNetwork, bool customSSLVerification, NativeCookieHandler cookieHandler = null) { this.throwOnCaptiveNetwork = throwOnCaptiveNetwork; if (customSSLVerification) client.SetHostnameVerifier(new HostnameVerifier()); noCacheCacheControl = (new CacheControl.Builder()).NoCache().Build(); var factory = new ImprovedSSLSocketFactory(); client.SetSslSocketFactory(factory); }
public PrivateCacheControlFeatureHandler( [DisallowNull] ICacheControlKeyProvider keyProvider, [DisallowNull] CacheControl cacheControl, [DisallowNull] ICacheControlStore cacheControlStore) : base(cacheControl, keyProvider, cacheControlStore) { this.cacheControlStore = cacheControlStore ?? throw new ArgumentNullException(nameof(cacheControlStore)); this.keyProvider = keyProvider ?? throw new ArgumentNullException(nameof(keyProvider)); }
public NativeMessageHandler(bool throwOnCaptiveNetwork, bool customSSLVerification, bool allowUntrustedCertificate, NativeCookieHandler cookieHandler = null) { this.throwOnCaptiveNetwork = throwOnCaptiveNetwork; this.customSSLVerification = customSSLVerification; AllowUntrustedCertificates = allowUntrustedCertificate; noCacheCacheControl = (new CacheControl.Builder()).NoCache().Build(); }
public NativeMessageHandler(bool throwOnCaptiveNetwork, bool customSSLVerification, NativeCookieHandler cookieHandler = null) { this.throwOnCaptiveNetwork = throwOnCaptiveNetwork; this.CustomSSLVerification = customSSLVerification; RefreshClient(); noCacheCacheControl = (new CacheControl.Builder()).NoCache().Build(); }
public NativeMessageHandler(bool throwOnCaptiveNetwork, bool customSSLVerification, NativeCookieHandler cookieHandler = null) { this.throwOnCaptiveNetwork = throwOnCaptiveNetwork; if (customSSLVerification) { client.SetHostnameVerifier(new HostnameVerifier()); } noCacheCacheControl = (new CacheControl.Builder()).NoCache().Build(); }
public NativeMessageHandler (bool throwOnCaptiveNetwork, bool customSSLVerification, NativeCookieHandler cookieHandler = null) { this.throwOnCaptiveNetwork = throwOnCaptiveNetwork; if (customSSLVerification) client.SetHostnameVerifier (new HostnameVerifier ()); noCacheCacheControl = (new CacheControl.Builder ()).NoCache ().Build (); // If less than Android Lollipop if (((int)Build.VERSION.SdkInt) < 21) { client.SetSslSocketFactory (new ImprovedSSLSocketFactory ()); } }
public CacheControlFilter( [DisallowNull] CacheControl cacheControl, [DisallowNull] ICacheControlFeatureHandler featureHandler, [DisallowNull] IValidator validator, [DisallowNull] ICacheControlKeyProvider keyProvider ) { this.cacheControl = cacheControl ?? throw new ArgumentNullException(nameof(cacheControl)); this.featureHandler = featureHandler ?? throw new ArgumentNullException(nameof(featureHandler)); this.validator = validator ?? throw new ArgumentNullException(nameof(validator)); this.keyProvider = keyProvider ?? throw new ArgumentNullException(nameof(keyProvider)); }
public ImageWizardOptions() { UseETag = true; UseClintHints = false; AllowUnsafeUrl = false; UseAcceptHeader = false; Key = null; AllowedDPR = new[] { 1.0, 1.5, 2.0, 3.0, 4.0 }; CacheControl = new CacheControl(); }
public static void ScheduleInvalidateAll() { ScheduleInvalidation("all", string.Empty); //DB.Vote.Master.UpdateCacheRemovedAll(DateTime.UtcNow); //DB.Vote.Master.UpdateCacheRemovedBallot(DateTime.UtcNow); //DB.Vote.Master.UpdateCacheRemovedElected(DateTime.UtcNow); //DB.Vote.Master.UpdateCacheRemovedIntro(DateTime.UtcNow); //DB.Vote.Master.UpdateCacheRemovedPoliticianIssue(DateTime.UtcNow); //DB.Vote.Master.UpdateCacheRemovedIssue(DateTime.UtcNow); //DB.Vote.Master.UpdateCacheRemovedReferendum(DateTime.UtcNow); //DB.Vote.Master.UpdateCacheRemovedElectionReport(DateTime.UtcNow); //DB.Vote.Master.UpdateCacheRemovedOfficialsReport(DateTime.UtcNow); CacheControl.UpdateWhenCleared(DateTime.UtcNow); }
public override int GetHashCode() => BlobName.GetHashCode() ^ CacheControl.GetHashCode() ^ BlobContainerName.GetHashCode() ^ ContentDisposition.GetHashCode() ^ ContentEncoding.GetHashCode() ^ ContentLanguage.GetHashCode() ^ ContentType.GetHashCode() ^ ExpiryTime.GetHashCode() ^ Identifier.GetHashCode() ^ IPRange.GetHashCode() ^ Permissions.GetHashCode() ^ Protocol.GetHashCode() ^ StartTime.GetHashCode() ^ Version.GetHashCode();
public NativeMessageHandler(bool throwOnCaptiveNetwork, bool customSSLVerification, NativeCookieHandler cookieHandler = null) { this.throwOnCaptiveNetwork = throwOnCaptiveNetwork; if (customSSLVerification) { client.SetHostnameVerifier(new HostnameVerifier()); } noCacheCacheControl = (new CacheControl.Builder()).NoCache().Build(); // If less than Android Lollipop if (((int)Build.VERSION.SdkInt) < 21) { client.SetSslSocketFactory(new ImprovedSSLSocketFactory()); } }
public OkHttpClientHandler(bool throwOnCaptiveNetwork, NativeCookieHandler cookieHandler = null) { _throwOnCaptiveNetwork = throwOnCaptiveNetwork; _noCacheCacheControl = (new CacheControl.Builder()).NoCache().Build(); }
public static bool Has(this CacheControl cache, CacheControl flag) { return((flag & cache) != 0); }
public static HttpResult NotModified(string description=null, CacheControl? cacheControl = null, TimeSpan? maxAge = null, string eTag = null, DateTime? lastModified=null) { return new HttpResult(HttpStatusCode.NotModified, description ?? HostContext.ResolveLocalizedString(LocalizedStrings.NotModified)) { ETag = eTag, LastModified = lastModified, MaxAge = maxAge, CacheControl = cacheControl.GetValueOrDefault(CacheControl.None), }; }
public static void ScheduleInvalidateAll() { ScheduleInvalidation("all", Empty); CacheControl.UpdateWhenCleared(DateTime.UtcNow); }
public static ICacheControl <ClientInformation> GetCacheController() { var cacheController = new CacheControl <ClientInformation>(); // Can be a db/redis controller return(cacheController); }
public static bool Has(this CacheControl cache, CacheControl flag) { return (flag & cache) != 0; }