Exemple #1
0
        internal bool IncludeUrl(HttpContext context)
        {
            if (!IsCachable(context))
            {
                return(false);
            }

            OriginUrl url = Url(context);

            // Method can be called mutliple times in a request,
            // so cache "Include" result for this rule.
            object o = context.Items[_requestItemsCacheKey];

            if (o != null)
            {
                return(o.Equals(true));
            }

            bool include = false;

            foreach (IEdgeFilter filter in Filters())
            {
                if (filter.Include(this, url))
                {
                    include = true;

                    break;
                }
            }

            context.Items[_requestItemsCacheKey] = include;

            return(include);
        }
        public bool Include(OriginUrl url)
        {
            if (IsMatch(_include, url, false))
            {
                return(!IsMatch(_exclude, url, false));
            }

            return(false);
        }
Exemple #3
0
        public bool Include(EdgeCacheRule rule, OriginUrl url)
        {
            RegexEdgeFilterGroup group;

            if (_groups.TryGetValue(rule.Name, out group))
            {
                return(group.Include(url));
            }

            return(false);
        }
        public string GetKey(HttpContext context)
        {
            HttpRequest request = context.Request;

            StringBuilder key = new StringBuilder();

            OriginUrl url = OriginUrl.CurrentUrl(context);

            key.Append(request.HttpMethod);
            key.Append(";");
            key.Append(url.Path);
            key.Append(";");
            key.Append(GetDeviceKey(context));

            return(key.ToString().ToLowerInvariant());
        }
Exemple #5
0
 public OriginUrl Url(HttpContext context)
 {
     return(OriginUrl.CurrentUrl(context));
 }