protected GVFSConfig QueryGVFSConfig(ITracer tracer, GVFSEnlistment enlistment, RetryConfig retryConfig) { GVFSConfig gvfsConfig = null; if (!this.ShowStatusWhileRunning( () => { using (ConfigHttpRequestor configRequestor = new ConfigHttpRequestor(tracer, enlistment, retryConfig)) { return(configRequestor.TryQueryGVFSConfig(out gvfsConfig)); } }, "Querying remote for config", suppressGvfsLogMessage: true)) { this.ReportErrorAndExit(tracer, "Unable to query /gvfs/config"); } return(gvfsConfig); }
protected ServerGVFSConfig QueryGVFSConfig(ITracer tracer, GVFSEnlistment enlistment, RetryConfig retryConfig) { ServerGVFSConfig serverGVFSConfig = null; string errorMessage = null; if (!this.ShowStatusWhileRunning( () => { using (ConfigHttpRequestor configRequestor = new ConfigHttpRequestor(tracer, enlistment, retryConfig)) { const bool LogErrors = true; return(configRequestor.TryQueryGVFSConfig(LogErrors, out serverGVFSConfig, out _, out errorMessage)); } }, "Querying remote for config", suppressGvfsLogMessage: true)) { this.ReportErrorAndExit(tracer, "Unable to query /gvfs/config" + Environment.NewLine + errorMessage); } return(serverGVFSConfig); }
private bool TryAnonymousQuery(ITracer tracer, Enlistment enlistment, out bool isAnonymous) { bool querySucceeded; using (ITracer anonymousTracer = tracer.StartActivity("AttemptAnonymousAuth", EventLevel.Informational)) { HttpStatusCode?httpStatus; using (ConfigHttpRequestor configRequestor = new ConfigHttpRequestor(anonymousTracer, enlistment, new RetryConfig())) { ServerGVFSConfig gvfsConfig; const bool LogErrors = false; if (configRequestor.TryQueryGVFSConfig(LogErrors, out gvfsConfig, out httpStatus, out _)) { querySucceeded = true; isAnonymous = true; } else if (httpStatus == HttpStatusCode.Unauthorized) { querySucceeded = true; isAnonymous = false; } else { querySucceeded = false; isAnonymous = false; } } anonymousTracer.Stop(new EventMetadata { { "HttpStatus", httpStatus.HasValue ? ((int)httpStatus).ToString() : "None" }, { "QuerySucceeded", querySucceeded }, { "IsAnonymous", isAnonymous }, }); } return(querySucceeded); }