Esempio n. 1
0
        public UriSources CombineIfRedirection(StandardizedUri sourceUri, Uri redirectionTarget)
        {
            var src        = GetOrCreateSources(sourceUri);
            var stdDestUri = new StandardizedUri(redirectionTarget);

            src.RedirectedUri = redirectionTarget;

            if (sourceUri.Equals(stdDestUri))
            {
                // Not a meaningful redirection
                return(src);
            }

            // The request has been redirected,
            // so the source and destination pages should be considered equivalent.
            // Combine the pages that point to either.
            src.Status = SpiderPageStatus.Redirected;

            var dest          = GetOrCreateSources(stdDestUri);
            var combinedLinks = src.CallingLinks.Union(dest.CallingLinks).ToHashSet();

            src.CallingLinks  = combinedLinks;
            dest.CallingLinks = combinedLinks;

            return(dest);
        }