diff --git a/Core/Core/Api/GraphQL/Models/ServerInfo.cs b/Core/Core/Api/GraphQL/Models/ServerInfo.cs
index 11f053ebe8..1f5ef15181 100644
--- a/Core/Core/Api/GraphQL/Models/ServerInfo.cs
+++ b/Core/Core/Api/GraphQL/Models/ServerInfo.cs
@@ -13,10 +13,9 @@ public sealed class ServerInfo
///
/// This field is not returned from the GQL API,
- /// it should be populated after construction from the response headers.
- /// see
+ /// it was previously populated after construction from the response headers, but now FE1 is deprecated, so we should always assume FE2
///
- public bool frontend2 { get; set; }
+ public bool frontend2 { get; set; } = true;
///
/// This field is not returned from the GQL API,
diff --git a/Core/Core/Credentials/AccountManager.cs b/Core/Core/Credentials/AccountManager.cs
index 29965efa43..41fe888690 100644
--- a/Core/Core/Credentials/AccountManager.cs
+++ b/Core/Core/Credentials/AccountManager.cs
@@ -90,7 +90,6 @@ public static async Task GetServerInfo(Uri server, CancellationToken
ServerInfo serverInfo = response.Data.serverInfo;
serverInfo.url = server.ToString().TrimEnd('/');
- serverInfo.frontend2 = await IsFrontend2Server(server).ConfigureAwait(false);
return response.Data.serverInfo;
}
@@ -198,7 +197,6 @@ internal static async Task GetUserServerInfo(
ServerInfo serverInfo = response.Data.serverInfo;
serverInfo.url = server.ToString().TrimEnd('/');
- serverInfo.frontend2 = await IsFrontend2Server(server).ConfigureAwait(false);
return response.Data;
}
@@ -802,38 +800,6 @@ await response.Content.ReadAsStringAsync().ConfigureAwait(false)
}
}
- ///
- /// Sends a simple get request to the , and checks the response headers for a "x-speckle-frontend-2" value
- ///
- /// Server endpoint to get header
- /// if response contains FE2 header and the value was
- /// response contained FE2 header, but the value was , empty, or not parseable to a
- /// Request to failed to send or response was not successful
- private static async Task IsFrontend2Server(Uri server)
- {
- using var httpClient = Http.GetHttpProxyClient();
-
- var response = await Http.HttpPing(server).ConfigureAwait(false);
-
- var headers = response.Headers;
- const string HEADER = "x-speckle-frontend-2";
- if (!headers.TryGetValues(HEADER, out IEnumerable values))
- {
- return false;
- }
-
- string? headerValue = values.FirstOrDefault();
-
- if (!bool.TryParse(headerValue, out bool value))
- {
- throw new SpeckleException(
- $"Headers contained {HEADER} header, but value {headerValue} could not be parsed to a bool"
- );
- }
-
- return value;
- }
-
private static string GenerateChallenge()
{
using RNGCryptoServiceProvider rng = new();
diff --git a/Core/Core/Helpers/Http.cs b/Core/Core/Helpers/Http.cs
index 36407bbc16..2aad2756cf 100644
--- a/Core/Core/Helpers/Http.cs
+++ b/Core/Core/Helpers/Http.cs
@@ -143,7 +143,7 @@ public static async Task HttpPing(Uri uri)
try
{
using var httpClient = GetHttpProxyClient();
- HttpResponseMessage response = await httpClient.GetAsync(uri).ConfigureAwait(false);
+ HttpResponseMessage response = await httpClient.GetAsync(GetPingUrl(uri)).ConfigureAwait(false);
response.EnsureSuccessStatusCode();
SpeckleLog.Logger.Information("Successfully pinged {uri}", uri);
return response;
@@ -155,6 +155,12 @@ public static async Task HttpPing(Uri uri)
}
}
+ public static Uri GetPingUrl(Uri serverUrl)
+ {
+ var server = serverUrl.GetLeftPart(UriPartial.Authority);
+ return new Uri(new(server), "/favicon.ico");
+ }
+
public static HttpClient GetHttpProxyClient(SpeckleHttpClientHandler? speckleHttpClientHandler = null)
{
IWebProxy proxy = WebRequest.GetSystemWebProxy();
@@ -166,6 +172,8 @@ public static HttpClient GetHttpProxyClient(SpeckleHttpClientHandler? speckleHtt
{
Timeout = Timeout.InfiniteTimeSpan //timeout is configured on the SpeckleHttpClientHandler through policy
};
+ client.DefaultRequestHeaders.UserAgent.Clear();
+ client.DefaultRequestHeaders.UserAgent.Add(new("SpeckleSDK", "2.0.0"));
return client;
}
diff --git a/Core/Tests/Speckle.Core.Tests.Integration/Credentials/UserServerInfoTests.cs b/Core/Tests/Speckle.Core.Tests.Integration/Credentials/UserServerInfoTests.cs
index eafabc4f0e..1c5999c210 100644
--- a/Core/Tests/Speckle.Core.Tests.Integration/Credentials/UserServerInfoTests.cs
+++ b/Core/Tests/Speckle.Core.Tests.Integration/Credentials/UserServerInfoTests.cs
@@ -23,20 +23,6 @@ public async Task IsFrontEnd2True()
Assert.That(result.frontend2, Is.True);
}
- ///
- /// We get ServerInfo from "http://localhost:3000/graphql",
- /// Then we mutate the `frontend2` property of ServerInfo by trying to fetch header from "http://localhost:3000/",
- /// This is not doable in local server because there is no end-point on this to ping.
- /// This is a bad sign for mutation.
- ///
- [Test]
- public void GetServerInfo_ExpectFail_CantPing()
- {
- Uri serverUrl = new(acc.serverInfo.url);
-
- Assert.ThrowsAsync(async () => await AccountManager.GetServerInfo(serverUrl));
- }
-
[Test]
public void GetServerInfo_ExpectFail_NoServer()
{
diff --git a/Core/Tests/Speckle.Core.Tests.Unit/Helpers/Path.cs b/Core/Tests/Speckle.Core.Tests.Unit/Helpers/Path.cs
index 7878ab510c..1a8091d999 100644
--- a/Core/Tests/Speckle.Core.Tests.Unit/Helpers/Path.cs
+++ b/Core/Tests/Speckle.Core.Tests.Unit/Helpers/Path.cs
@@ -8,6 +8,17 @@ namespace Speckle.Core.Tests.Unit.Helpers;
[TestOf(nameof(SpecklePathProvider))]
public class SpecklePathTests
{
+ [Test]
+ [TestCase("https://app.speckle.systems", "https://app.speckle.systems/favicon.ico")]
+ [TestCase("https://app.speckle.systems/", "https://app.speckle.systems/favicon.ico")]
+ [TestCase("https://app.speckle.systems/auth/login", "https://app.speckle.systems/favicon.ico")]
+ [TestCase("https://latest.speckle.systems", "https://latest.speckle.systems/favicon.ico")]
+ public void TestGetPingUrl(string given, string expected)
+ {
+ var x = Http.GetPingUrl(new Uri(given));
+ Assert.That(x, Is.EqualTo(new Uri(expected)));
+ }
+
[Test]
public void TestUserApplicationDataPath()
{