/// <summary>
        /// Initialises a new instance of HttpWebServiceRequest to be submitted as a POST request.
        /// </summary>
        /// <param name="webServiceState">An <see cref="HttpWebServiceState"/> instance</param>
        internal HttpWebServiceRequest(HttpWebServiceState webServiceState)
        {
            m_webServiceState = webServiceState;
            m_redirectsRemaining = m_webServiceState.MaxRedirects;

            // Pull the timeout from the settings
            TimeSpan timeoutSetting = TimeSpan.FromSeconds(Settings.Updates.HttpTimeout);

            if (timeoutSetting < TimeSpan.FromSeconds(1) || timeoutSetting > TimeSpan.FromMinutes(5))
            {
                Timeout = 10000;
            }
            else
            {
                Timeout = (int)timeoutSetting.TotalMilliseconds;
            }
        }
Example #2
0
        /// <summary>
        /// Initialises a new instance of HttpWebServiceRequest to be submitted as a POST request.
        /// </summary>
        /// <param name="webServiceState">An <see cref="HttpWebServiceState"/> instance</param>
        internal HttpWebServiceRequest(HttpWebServiceState webServiceState)
        {
            m_webServiceState    = webServiceState;
            m_redirectsRemaining = m_webServiceState.MaxRedirects;

            // Pull the timeout from the settings
            TimeSpan timeoutSetting = TimeSpan.FromSeconds(Settings.Updates.HttpTimeout);

            if (timeoutSetting < TimeSpan.FromSeconds(1) || timeoutSetting > TimeSpan.FromMinutes(5))
            {
                Timeout = 10000;
            }
            else
            {
                Timeout = (int)timeoutSetting.TotalMilliseconds;
            }
        }
        /// <summary>
        /// Factory method to create an HttpWebServiceException resulting from a WebException.
        /// Various different HttpWebServiceExceptionStatus types are applied, with appropriate messages, depending on the
        /// nature of the WebException.
        /// </summary>
        /// <param name="url">The url of the request that failed</param>
        /// <param name="webServiceState">The EVEMonWebClientState instance of the request</param>
        /// <param name="ex">The WebException that was thrown</param>
        /// <returns></returns>
        public static HttpWebServiceException WebException(string url, HttpWebServiceState webServiceState, WebException ex)
        {
            string proxyHost;
            if (webServiceState.Proxy.Enabled)
            {
                proxyHost = webServiceState.Proxy.Host;
            }
            else
            {
                proxyHost = HttpWebRequest.DefaultWebProxy.GetProxy(new Uri(url)).Host;
            }

            HttpWebServiceExceptionStatus status;

            var msg = ParseWebException(ex, url, proxyHost, out status);
            return new HttpWebServiceException(status, ex, url, msg);
        }
Example #4
0
        /// <summary>
        /// Factory method to create an HttpWebServiceException resulting from a WebException.
        /// Various different HttpWebServiceExceptionStatus types are applied, with appropriate messages, depending on the
        /// nature of the WebException.
        /// </summary>
        /// <param name="url">The url of the request that failed</param>
        /// <param name="webServiceState">The EVEMonWebClientState instance of the request</param>
        /// <param name="ex">The WebException that was thrown</param>
        /// <returns></returns>
        public static HttpWebServiceException WebException(string url, HttpWebServiceState webServiceState, WebException ex)
        {
            string proxyHost;

            if (webServiceState.Proxy.Enabled)
            {
                proxyHost = webServiceState.Proxy.Host;
            }
            else
            {
                proxyHost = HttpWebRequest.DefaultWebProxy.GetProxy(new Uri(url)).Host;
            }

            HttpWebServiceExceptionStatus status;

            var msg = ParseWebException(ex, url, proxyHost, out status);

            return(new HttpWebServiceException(status, ex, url, msg));
        }
Example #5
0
 /// <summary>
 /// Initialises a new instance of HttpWebServiceRequest to be submitted as a POST request.
 /// </summary>
 /// <param name="webServiceState">An <see cref="HttpWebServiceState"/> instance</param>
 internal HttpWebServiceRequest(HttpWebServiceState webServiceState)
 {
     m_webServiceState    = webServiceState;
     m_redirectsRemaining = m_webServiceState.MaxRedirects;
 }