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); }
public static NephosUriComponents GetNephosPathStyleUriComponents(Uri uri) { string str; string str1; string str2; NephosUriComponents nephosUriComponent = new NephosUriComponents() { IsUriPathStyle = true }; string[] uriPathSubStrings = HttpRequestAccessorJuly09.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 || string.IsNullOrEmpty(uriPathSubStrings[1])) { str1 = null; } else { str1 = uriPathSubStrings[1]; } nephosUriComponent2.ContainerName = str1; NephosUriComponents nephosUriComponent3 = nephosUriComponent; if ((int)uriPathSubStrings.Length <= 2 || string.IsNullOrEmpty(uriPathSubStrings[2])) { str2 = null; } else { str2 = uriPathSubStrings[2]; } nephosUriComponent3.RemainingPart = str2; nephosUriComponent.IsRemainingPartPresentButEmpty = ((int)uriPathSubStrings.Length <= 2 || uriPathSubStrings[2] == null ? false : uriPathSubStrings[2].Length == 0); return(nephosUriComponent); }
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); }
internal static Uri GetRequestUriInternal(Uri listenerRequestUri, string rawUrl, string hostHeader) { Uri uri; if (listenerRequestUri == null) { throw new InvalidUrlException(string.Format("request.Url is null; RawUrl={0}, HostHeader={1}", rawUrl, hostHeader)); } if (string.IsNullOrEmpty(rawUrl)) { throw new ArgumentException("request.RawUrl is null or empty", "request.RawUrl"); } UriBuilder uriBuilder = new UriBuilder() { Scheme = listenerRequestUri.Scheme, Host = listenerRequestUri.Host }; int?nullable = null; if (!HttpUtilities.TryGetPortFromHostHeaderValue(hostHeader, out nullable)) { uriBuilder.Port = listenerRequestUri.Port; } else if (nullable.HasValue) { uriBuilder.Port = nullable.Value; } if (!rawUrl.StartsWith("/")) { uri = (rawUrl != "*" ? new Uri(rawUrl) : new Uri(string.Concat(uriBuilder.Uri.AbsoluteUri, rawUrl))); } else { uri = new Uri(string.Concat(HttpRequestAccessorCommon.TrimEndSlash(uriBuilder.Uri.AbsoluteUri), rawUrl)); } uriBuilder.Path = uri.AbsolutePath; if (!string.IsNullOrEmpty(uri.Query)) { uriBuilder.Query = HttpUtilities.QueryWithoutQuestionMark(uri.Query); } return(uriBuilder.Uri); }