Exemple #1
0
        /// <summary>
        ///     Resolve destination endpoint using host header or request URI
        /// </summary>
        /// <param name="header">request header to use</param>
        /// <param name="defaultPort">which port to use if none is present in host header</param>
        /// <returns>request destination endpoint</returns>
        public static DnsEndPoint ResolveRequestEndpoint(HttpRequestHeader header, int defaultPort)
        {
            ContractUtils.Requires <ArgumentNullException>(header != null, "header");

            string hostFromHeaders = header.Host;

            return(!string.IsNullOrEmpty(hostFromHeaders)
                ? ResolveEndpointFromHostHeader(hostFromHeaders, defaultPort)
                : ResolveEndpointFromURI(header.RequestURI));
        }
Exemple #2
0
        /// <summary>
        ///     Resolve destination endpoint using host header or request URI
        /// </summary>
        /// <param name="header">request header to use</param>
        /// <param name="defaultPort">which port to use if none is present in host header</param>
        /// <returns>request destination endpoint</returns>
        public static DnsEndPoint ResolveRequestEndpoint(HttpRequestHeader header, Int32 defaultPort)
        {
            Contract.Requires<ArgumentNullException>(header != null, "header");

            string hostFromHeaders = header.Host;

            return !String.IsNullOrEmpty(hostFromHeaders)
                ? ResolveEndpointFromHostHeader(hostFromHeaders, defaultPort)
                : ResolveEndpointFromURI(header.RequestURI);
        }