Exemple #1
0
        string GetServerRootUrl(string url)
        {
            var uri     = new Uri(url);
            var builder = new UriBuilder(uri);

            builder.Path  = string.Empty;
            builder.Query = string.Empty;

            var port = ":" + builder.Port;

            if ((builder.Scheme == "https" && builder.Port == 443) ||
                (builder.Scheme == "http" && builder.Port == 80))
            {
                port = "";
            }

            var path = $"{builder.Scheme}://{builder.Host}{port}";

            if (!string.IsNullOrEmpty(StressTester.Options.ReplaceDomain))
            {
                path = StressTester.ReplaceDomain(path);
            }

            return(path);
        }
Exemple #2
0
        string GetServerRootUrl(string url)
        {
            // fix up if stress tester is replacing the domain
            if (!string.IsNullOrEmpty(StressTester.Options.ReplaceDomain))
            {
                url = StressTester.ReplaceDomain(url);
            }

            var uri     = new Uri(url);
            var builder = new UriBuilder(uri);

            builder.Path  = string.Empty;
            builder.Query = string.Empty;
            return(builder.ToString());
        }