Exemple #1
0
        public static NephosUriComponents GetNephosHostStyleUriComponents(Uri uri, string accountName)
        {
            string str;
            string str1;
            NephosUriComponents nephosUriComponent = new NephosUriComponents(accountName);

            string[]            uriPathSubStrings   = HttpRequestAccessor.GetUriPathSubStrings(uri, 2);
            NephosUriComponents nephosUriComponent1 = nephosUriComponent;

            if ((int)uriPathSubStrings.Length > 0)
            {
                str = HttpRequestAccessorCommon.TrimEndSlash(uriPathSubStrings[0]);
            }
            else
            {
                str = null;
            }
            nephosUriComponent1.ContainerName = str;
            NephosUriComponents nephosUriComponent2 = nephosUriComponent;

            if ((int)uriPathSubStrings.Length > 1)
            {
                str1 = HttpRequestAccessorCommon.TrimEndSlash(uriPathSubStrings[1]);
            }
            else
            {
                str1 = null;
            }
            nephosUriComponent2.RemainingPart = str1;
            return(nephosUriComponent);
        }
Exemple #2
0
        private static Uri ConstructHostStyleNephosUri(Uri hostSuffix, NephosUriComponents uriComponents)
        {
            if (uriComponents.AccountName == null)
            {
                return(hostSuffix);
            }
            string accountName = uriComponents.AccountName;

            if (uriComponents.IsSecondaryAccountAccess)
            {
                accountName = uriComponents.GetSecondaryAccountName();
            }
            Uri           uri           = HttpRequestAccessor.ConstructHostStyleAccountUri(hostSuffix, accountName);
            StringBuilder stringBuilder = new StringBuilder(string.Empty);

            if (uriComponents.ContainerName != null)
            {
                stringBuilder.Append(uriComponents.ContainerName);
            }
            if (uriComponents.RemainingPart != null)
            {
                if (uriComponents.ContainerName != null)
                {
                    stringBuilder.Append("/");
                }
                stringBuilder.Append(uriComponents.RemainingPart);
            }
            return(new Uri(uri, stringBuilder.ToString()));
        }
Exemple #3
0
 public static Uri ConstructNephosUri(Uri endpoint, NephosUriComponents uriComponents, bool pathStyleUri)
 {
     NephosAssertionException.Assert(endpoint != null);
     NephosAssertionException.Assert(uriComponents != null);
     if (!pathStyleUri)
     {
         return(HttpRequestAccessor.ConstructHostStyleNephosUri(endpoint, uriComponents));
     }
     return(HttpRequestAccessor.ConstructPathStyleNephosUri(endpoint, uriComponents));
 }
Exemple #4
0
        public static void GetContainerNameAndRemainingPart(Uri uri, UriStyle uriStyle, out string containerName, out string remainingPart)
        {
            containerName = null;
            remainingPart = null;
            int num = (uriStyle == UriStyle.PathStyle ? 1 : 0);

            string[] uriPathSubStrings = HttpRequestAccessor.GetUriPathSubStrings(uri, num + 2);
            if (uriPathSubStrings != null && (int)uriPathSubStrings.Length > num)
            {
                containerName = uriPathSubStrings[num];
                if ((int)uriPathSubStrings.Length > num + 1)
                {
                    remainingPart = uriPathSubStrings[num + 1];
                }
            }
        }
Exemple #5
0
        public static NephosUriComponents GetNephosUriComponents(Uri uri, string[] hostSuffixes, bool allowPathStyleUri, out bool uriIsPathStyle)
        {
            NephosUriComponents nephosUriComponent = null;

            if (HttpRequestAccessor.TryGetNephosHostStyleUriComponents(uri, hostSuffixes, out nephosUriComponent))
            {
                uriIsPathStyle = false;
                return(nephosUriComponent);
            }
            if (!allowPathStyleUri)
            {
                uriIsPathStyle = false;
                return(null);
            }
            uriIsPathStyle = true;
            return(HttpRequestAccessor.GetNephosPathStyleUriComponents(uri));
        }
Exemple #6
0
        public static NephosUriComponents GetNephosPathStyleUriComponents(Uri uri)
        {
            string str;
            string str1;
            string str2;
            NephosUriComponents nephosUriComponent = new NephosUriComponents()
            {
                IsUriPathStyle = true
            };

            string[]            uriPathSubStrings   = HttpRequestAccessor.GetUriPathSubStrings(uri, 3);
            NephosUriComponents nephosUriComponent1 = nephosUriComponent;

            if ((int)uriPathSubStrings.Length > 0)
            {
                str = HttpRequestAccessorCommon.TrimEndSlash(uriPathSubStrings[0]);
            }
            else
            {
                str = null;
            }
            nephosUriComponent1.AccountName = str;
            NephosUriComponents nephosUriComponent2 = nephosUriComponent;

            if ((int)uriPathSubStrings.Length > 1)
            {
                str1 = HttpRequestAccessorCommon.TrimEndSlash(uriPathSubStrings[1]);
            }
            else
            {
                str1 = null;
            }
            nephosUriComponent2.ContainerName = str1;
            NephosUriComponents nephosUriComponent3 = nephosUriComponent;

            if ((int)uriPathSubStrings.Length > 2)
            {
                str2 = HttpRequestAccessorCommon.TrimEndSlash(uriPathSubStrings[2]);
            }
            else
            {
                str2 = null;
            }
            nephosUriComponent3.RemainingPart = str2;
            return(nephosUriComponent);
        }
Exemple #7
0
        private static bool TryGetNephosHostStyleUriComponents(Uri uri, string[] hostSuffixes, out NephosUriComponents uriComponents)
        {
            uriComponents = null;
            string host = uri.Host;

            string[] strArrays = hostSuffixes;
            for (int i = 0; i < (int)strArrays.Length; i++)
            {
                string str = strArrays[i];
                if (host.EndsWith(str, StringComparison.OrdinalIgnoreCase))
                {
                    string str1 = host.Substring(0, host.Length - str.Length);
                    if (str1.Length > 0 && str1[str1.Length - 1] == HttpRequestAccessorCommon.subDomainDelimiterChar && str1.Length > 1)
                    {
                        string str2 = str1.Substring(0, str1.Length - 1);
                        uriComponents = HttpRequestAccessor.GetNephosHostStyleUriComponents(uri, str2);
                        return(true);
                    }
                }
            }
            return(false);
        }
Exemple #8
0
        private static string[] GetUriPathSubStrings(Uri uri, int count, StringSplitOptions splitOptions)
        {
            string str = HttpRequestAccessor.NormalizeLocalPathForDotNet4(uri.LocalPath);

            return(str.Substring(1).Split(HttpRequestAccessorCommon.uriDelimiter, count, splitOptions));
        }
Exemple #9
0
 public static NephosUriComponents GetNephosUriComponents(HttpWebRequest request, string[] hostSuffixes, bool allowPathStyleUri)
 {
     return(HttpRequestAccessor.GetNephosUriComponents(request.Address, hostSuffixes, allowPathStyleUri));
 }
Exemple #10
0
 public static NephosUriComponents GetNephosUriComponents(IHttpListenerRequest request, string[] hostSuffixes, bool allowPathStyleUri)
 {
     return(HttpRequestAccessor.GetNephosUriComponents(HttpUtilities.GetRequestUri(request), hostSuffixes, allowPathStyleUri));
 }
Exemple #11
0
        public static NephosUriComponents GetNephosUriComponents(Uri uri, string[] hostSuffixes, bool allowPathStyleUri)
        {
            bool flag;

            return(HttpRequestAccessor.GetNephosUriComponents(uri, hostSuffixes, allowPathStyleUri, out flag));
        }