コード例 #1
0
        //
        internal static void SetBinding(string uriScheme, RequestCacheBinding binding)
        {
            if (uriScheme == null)
            {
                throw new ArgumentNullException("uriScheme");
            }

            if (s_CacheConfigSettings == null)
            {
                LoadConfigSettings();
            }

            if (s_CacheConfigSettings.DisableAllCaching)
            {
                return;
            }

            if (uriScheme.Length == 0)
            {
                s_DefaultGlobalBinding = binding;
            }
            else if (uriScheme == Uri.UriSchemeHttp || uriScheme == Uri.UriSchemeHttps)
            {
                s_DefaultHttpBinding = binding;
            }
            else if (uriScheme == Uri.UriSchemeFtp)
            {
                s_DefaultFtpBinding = binding;
            }
        }
 internal static void SetBinding(string uriScheme, RequestCacheBinding binding)
 {
     if (uriScheme == null)
     {
         throw new ArgumentNullException("uriScheme");
     }
     if (s_CacheConfigSettings == null)
     {
         LoadConfigSettings();
     }
     if (!s_CacheConfigSettings.DisableAllCaching)
     {
         if (uriScheme.Length == 0)
         {
             s_DefaultGlobalBinding = binding;
         }
         else if ((uriScheme == Uri.UriSchemeHttp) || (uriScheme == Uri.UriSchemeHttps))
         {
             s_DefaultHttpBinding = binding;
         }
         else if (uriScheme == Uri.UriSchemeFtp)
         {
             s_DefaultFtpBinding = binding;
         }
     }
 }
 private static void LoadConfigSettings()
 {
     lock (s_BypassCacheBinding)
     {
         if (s_CacheConfigSettings == null)
         {
             RequestCachingSectionInternal section = RequestCachingSectionInternal.GetSection();
             s_DefaultGlobalBinding = new RequestCacheBinding(section.DefaultCache, section.DefaultHttpValidator, section.DefaultCachePolicy);
             s_DefaultHttpBinding = new RequestCacheBinding(section.DefaultCache, section.DefaultHttpValidator, section.DefaultHttpCachePolicy);
             s_DefaultFtpBinding = new RequestCacheBinding(section.DefaultCache, section.DefaultFtpValidator, section.DefaultFtpCachePolicy);
             s_CacheConfigSettings = section;
         }
     }
 }
コード例 #4
0
 private static void LoadConfigSettings()
 {
     lock (s_BypassCacheBinding)
     {
         if (s_CacheConfigSettings == null)
         {
             RequestCachingSectionInternal section = RequestCachingSectionInternal.GetSection();
             s_DefaultGlobalBinding = new RequestCacheBinding(section.DefaultCache, section.DefaultHttpValidator, section.DefaultCachePolicy);
             s_DefaultHttpBinding   = new RequestCacheBinding(section.DefaultCache, section.DefaultHttpValidator, section.DefaultHttpCachePolicy);
             s_DefaultFtpBinding    = new RequestCacheBinding(section.DefaultCache, section.DefaultFtpValidator, section.DefaultFtpCachePolicy);
             s_CacheConfigSettings  = section;
         }
     }
 }
コード例 #5
0
        //
        private static void LoadConfigSettings()
        {
            // Any concurent access shall go here and block until we've grabbed the config settings
            lock (s_BypassCacheBinding)
            {
                if (s_CacheConfigSettings == null)
                {
                    RequestCachingSectionInternal settings = RequestCachingSectionInternal.GetSection();

                    s_DefaultGlobalBinding = new RequestCacheBinding(settings.DefaultCache, settings.DefaultHttpValidator, settings.DefaultCachePolicy);
                    s_DefaultHttpBinding   = new RequestCacheBinding(settings.DefaultCache, settings.DefaultHttpValidator, settings.DefaultHttpCachePolicy);
                    s_DefaultFtpBinding    = new RequestCacheBinding(settings.DefaultCache, settings.DefaultFtpValidator, settings.DefaultFtpCachePolicy);

                    s_CacheConfigSettings = settings;
                }
            }
        }
コード例 #6
0
        //
        internal static void SetBinding(string uriScheme, RequestCacheBinding binding)
        {
            if (uriScheme == null)
                throw new ArgumentNullException("uriScheme");

            if (s_CacheConfigSettings == null)
                LoadConfigSettings();

            if(s_CacheConfigSettings.DisableAllCaching)
                return;

            if (uriScheme.Length == 0)
                s_DefaultGlobalBinding = binding;
            else if (uriScheme == Uri.UriSchemeHttp || uriScheme == Uri.UriSchemeHttps)
                s_DefaultHttpBinding = binding;
            else if (uriScheme == Uri.UriSchemeFtp)
                s_DefaultFtpBinding = binding;
        }
コード例 #7
0
        //
        internal void SetupCacheProtocol(Uri uri)
        {
            m_CacheBinding = RequestCacheManager.GetBinding(uri.Scheme);

            // Note if the cache is disabled it will give back a bypass policy.
            InternalSetCachePolicy( m_CacheBinding.Policy);
            if (m_CachePolicy == null)
            {
                // If the protocol cache policy is not specifically configured, grab from the base class.
                InternalSetCachePolicy(WebRequest.DefaultCachePolicy);
            }
        }
コード例 #8
0
        //
        private static void LoadConfigSettings()
        {
            // Any concurent access shall go here and block until we've grabbed the config settings
            lock (s_BypassCacheBinding)
            {
                if (s_CacheConfigSettings == null)
                {
                    RequestCachingSectionInternal settings = RequestCachingSectionInternal.GetSection();

                    s_DefaultGlobalBinding = new RequestCacheBinding (settings.DefaultCache, settings.DefaultHttpValidator, settings.DefaultCachePolicy);
                    s_DefaultHttpBinding = new RequestCacheBinding (settings.DefaultCache, settings.DefaultHttpValidator, settings.DefaultHttpCachePolicy);
                    s_DefaultFtpBinding = new RequestCacheBinding (settings.DefaultCache, settings.DefaultFtpValidator, settings.DefaultFtpCachePolicy);

                    s_CacheConfigSettings = settings;
                }
            }
        }
コード例 #9
0
 internal void SetupCacheProtocol(Uri uri)
 {
     this.m_CacheBinding = RequestCacheManager.GetBinding(uri.Scheme);
     this.InternalSetCachePolicy(this.m_CacheBinding.Policy);
     if (this.m_CachePolicy == null)
     {
         this.InternalSetCachePolicy(DefaultCachePolicy);
     }
 }