public HttpConnectionContext(string host,
                                     int port                   = 0,
                                     string user                = null,
                                     string password            = null,
                                     InternetProxyContext proxy = null,
                                     int timeout                = 0)
        {
            var uriBuilder = new UriBuilder(host);

            if (port != 0)
            {
                uriBuilder.Port = port;
            }

            if (uriBuilder.Scheme != HTTP_SCHEME && uriBuilder.Scheme != HTTPS_SCHEME)
            {
                throw RuntimeException.InvalidArgumentValue();
            }

            _hostUri = uriBuilder.Uri;

            Host = _hostUri.Host;
            Port = _hostUri.Port;

            User     = user == null ? String.Empty : user;
            Password = password == null ? String.Empty : password;
            Timeout  = timeout;
            _proxy   = proxy;
        }
        public HttpConnectionContext(string host,
                                     int port                   = 0,
                                     string user                = null,
                                     string password            = null,
                                     InternetProxyContext proxy = null,
                                     int timeout                = 0,
                                     IValue ssl                 = null,
                                     bool useOSAuth             = false)
        {
            if (ssl != null && !(ssl.DataType == Machine.DataType.Undefined || ssl.DataType == Machine.DataType.NotAValidValue))
            {
                throw new RuntimeException("Защищенное соединение по произвольным сертификатам не поддерживается. Если необходим доступ по https, просто укажите протокол https в адресе хоста.");
            }

            var uriBuilder = new UriBuilder(host);

            if (port != 0)
            {
                uriBuilder.Port = port;
            }

            if (uriBuilder.Scheme != HTTP_SCHEME && uriBuilder.Scheme != HTTPS_SCHEME)
            {
                throw RuntimeException.InvalidArgumentValue();
            }

            _hostUri = uriBuilder.Uri;

            Host = _hostUri.Host;
            Port = _hostUri.Port;

            User     = user == null ? String.Empty : user;
            Password = password == null ? String.Empty : password;

            Timeout             = timeout;
            _proxy              = proxy;
            UseOSAuthentication = useOSAuth;
            AllowAutoRedirect   = true;
        }