From d5aa5b61ad2eac7eb9c06b7b67d4309a8ea07d7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 13 Jan 2026 10:55:51 +0100 Subject: [PATCH 1/3] Replace manual specification of `Authorization` header with SignalR-provided provider property The property used here is listed in SignalR documentation: https://learn.microsoft.com/en-us/aspnet/core/signalr/authn-and-authz?view=aspnetcore-10.0#bearer-token-authentication While in practice this probably has zero bearing on anything, theoretically the way proposed in this commit is more correct. As the documentation states, with some transports the token may need to be renewed if it expires, which providing it via a header as done previously would not achieve, while going through `API.AccessToken` every time will perform a token refresh if one is needed. --- osu.Game/Online/HubClientConnector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Online/HubClientConnector.cs b/osu.Game/Online/HubClientConnector.cs index e6391e8810..7ccf763e62 100644 --- a/osu.Game/Online/HubClientConnector.cs +++ b/osu.Game/Online/HubClientConnector.cs @@ -65,7 +65,7 @@ namespace osu.Game.Online options.Proxy.Credentials = CredentialCache.DefaultCredentials; } - options.Headers.Add(@"Authorization", @$"Bearer {API.AccessToken}"); + options.AccessTokenProvider = () => Task.FromResult(API.AccessToken); // non-standard header name kept for backwards compatibility, can be removed after server side has migrated to `VERSION_HASH_HEADER` options.Headers.Add(@"OsuVersionHash", versionHash); options.Headers.Add(VERSION_HASH_HEADER, versionHash); From 5abc0f93fe67b424a97ae5869535535ae8af330a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 13 Jan 2026 11:00:45 +0100 Subject: [PATCH 2/3] Remove no longer needed header alias for version hash Clean-up from an old change (see https://github.com/ppy/osu/pull/28892#discussion_r1681136250). --- osu.Game/Online/HubClientConnector.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Online/HubClientConnector.cs b/osu.Game/Online/HubClientConnector.cs index 7ccf763e62..9dba778e41 100644 --- a/osu.Game/Online/HubClientConnector.cs +++ b/osu.Game/Online/HubClientConnector.cs @@ -66,8 +66,6 @@ namespace osu.Game.Online } options.AccessTokenProvider = () => Task.FromResult(API.AccessToken); - // non-standard header name kept for backwards compatibility, can be removed after server side has migrated to `VERSION_HASH_HEADER` - options.Headers.Add(@"OsuVersionHash", versionHash); options.Headers.Add(VERSION_HASH_HEADER, versionHash); options.Headers.Add(CLIENT_SESSION_ID_HEADER, API.SessionIdentifier.ToString()); }); From 9c8d6e63a7473dec0bf80f35fa9e76a89e57ac34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 13 Jan 2026 11:16:10 +0100 Subject: [PATCH 3/3] Simplify proxy configuration More clean-up. --- osu.Game/Online/HubClientConnector.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/osu.Game/Online/HubClientConnector.cs b/osu.Game/Online/HubClientConnector.cs index 9dba778e41..c12043c727 100644 --- a/osu.Game/Online/HubClientConnector.cs +++ b/osu.Game/Online/HubClientConnector.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; -using System.Net; +using System.Net.Http; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.SignalR.Client; @@ -57,13 +57,7 @@ namespace osu.Game.Online { // Configuring proxies is not supported on iOS, see https://github.com/xamarin/xamarin-macios/issues/14632. if (RuntimeInfo.OS != RuntimeInfo.Platform.iOS) - { - // Use HttpClient.DefaultProxy once on net6 everywhere. - // The credential setter can also be removed at this point. - options.Proxy = WebRequest.DefaultWebProxy; - if (options.Proxy != null) - options.Proxy.Credentials = CredentialCache.DefaultCredentials; - } + options.Proxy = HttpClient.DefaultProxy; options.AccessTokenProvider = () => Task.FromResult(API.AccessToken); options.Headers.Add(VERSION_HASH_HEADER, versionHash);