protected override AnchorMailbox ResolveAnchorMailbox()
        {
            ExTraceGlobals.VerboseTracer.TraceDebug <string, Uri>((long)this.GetHashCode(), "[EDiscoveryExportToolProxyRequestHandler::ResolveAnchorMailbox]: Method {0}; Url {1};", base.ClientRequest.HttpMethod, base.ClientRequest.Url);
            string[] array = base.ClientRequest.Url.AbsolutePath.Split(new char[]
            {
                '/'
            }, StringSplitOptions.RemoveEmptyEntries);
            if (array.Length == 5 && array[2] == "exporttool" && array[4].StartsWith("microsoft.exchange."))
            {
                this.serverFqdn = array[3];
                base.Logger.Set(HttpProxyMetadata.RoutingHint, "EDiscoveryExportTool-ServerInfo");
                return(new ServerInfoAnchorMailbox(this.serverFqdn, this));
            }
            this.serverFqdn = null;
            Match         pathMatch = EDiscoveryExportToolRequestPathHandler.GetPathMatch(base.ClientRequest);
            ServerVersion serverVersion;

            if (pathMatch.Success && RegexUtilities.TryGetServerVersionFromRegexMatch(pathMatch, out serverVersion))
            {
                AnchorMailbox result = new ServerVersionAnchorMailbox <EcpService>(serverVersion, ClientAccessType.Internal, true, this);
                base.Logger.Set(HttpProxyMetadata.RoutingHint, "EDiscoveryExportTool-ServerVersion");
                return(result);
            }
            throw new HttpProxyException(HttpStatusCode.NotFound, HttpProxySubErrorCode.ServerNotFound, string.Format("Unable to find target server for url: {0}", base.ClientRequest.Url));
        }
Example #2
0
        // Token: 0x06000515 RID: 1301 RVA: 0x0001C5A4 File Offset: 0x0001A7A4
        protected override AnchorMailbox ResolveAnchorMailbox()
        {
            if (ExTraceGlobals.VerboseTracer.IsTraceEnabled(1))
            {
                ExTraceGlobals.VerboseTracer.TraceDebug <string, Uri>((long)this.GetHashCode(), "[EDiscoveryExportToolProxyRequestHandler::ResolveAnchorMailbox]: Method {0}; Url {1};", base.ClientRequest.HttpMethod, base.ClientRequest.Url);
            }
            string[] array = base.ClientRequest.Url.AbsolutePath.Split(new char[]
            {
                '/'
            }, StringSplitOptions.RemoveEmptyEntries);
            if (((array.Length == 5 && array[4].StartsWith("microsoft.exchange.")) || (array.Length == 6 && array[5].StartsWith("microsoft.exchange."))) && array[2] == "exporttool" && array[3].Contains("."))
            {
                this.serverFqdn = array[3];
            }
            else
            {
                this.serverFqdn = null;
            }
            Match         pathMatch         = EDiscoveryExportToolRequestPathHandler.GetPathMatch(base.ClientRequest);
            bool          exactVersionMatch = false;
            ServerVersion serverVersion;

            if (pathMatch.Success)
            {
                if (RegexUtilities.TryGetServerVersionFromRegexMatch(pathMatch, ref serverVersion))
                {
                    exactVersionMatch = true;
                }
            }
            else
            {
                serverVersion     = new ServerVersion(Server.CurrentExchangeMajorVersion, 0, 0, 0);
                exactVersionMatch = false;
            }
            if (((!string.IsNullOrEmpty(this.serverFqdn)) ? CafeConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).DiscoveryExportToolDownloadRoutingMechanism.Value : string.Empty) == "ServerInfo")
            {
                base.Logger.Set(3, "EDiscoveryExportTool-ServerInfo");
                return(new ServerInfoAnchorMailbox(this.serverFqdn, this));
            }
            if (EDiscoveryExportToolRequestPathHandler.IsEDiscoveryExportToolRequest(base.ClientRequest))
            {
                AnchorMailbox result = new ServerVersionAnchorMailbox <EcpService>(serverVersion, 0, exactVersionMatch, this);
                base.Logger.Set(3, "EDiscoveryExportTool-ServerVersion");
                return(result);
            }
            throw new HttpProxyException(HttpStatusCode.NotFound, 3007, string.Format("Unable to find target server for url: {0}", base.ClientRequest.Url));
        }
 internal static bool IsEDiscoveryExportToolProxyRequest(HttpRequest request)
 {
     return(EDiscoveryExportToolRequestPathHandler.IsEDiscoveryExportToolRequest(request));
 }