Esempio n. 1
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           = HttpRequestAccessorJuly09.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(HttpRequestAccessorJuly09.ConstructUriFromUriAndString(uri, stringBuilder.ToString()));
        }
Esempio n. 2
0
 private static string GetUriWithoutSecondarySuffix(string rawUrl, NephosUriComponents uriComponents)
 {
     if (uriComponents.IsUriPathStyle && uriComponents.IsSecondaryAccountAccess && !string.IsNullOrEmpty(rawUrl))
     {
         int length = rawUrl.IndexOf(uriComponents.GetSecondaryAccountName(), 0, StringComparison.OrdinalIgnoreCase);
         if (length == 1)
         {
             length += uriComponents.AccountName.Length;
             rawUrl  = rawUrl.Remove(length, "-secondary".Length);
             Logger <IRestProtocolHeadLogger> .Instance.Verbose.Log("removing secondary suffix : {0}", new object[] { rawUrl });
         }
     }
     return(rawUrl);
 }