From bfee3317aa27a82e185dfe4b2b96dba221600896 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 26 Oct 2017 16:37:44 +0900 Subject: [PATCH 1/6] Update WebRequest usage in-line with framework --- osu-framework | 2 +- osu.Game/Online/API/APIRequest.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu-framework b/osu-framework index 5986f21268..337d70e315 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 5986f2126832451a5a7ec832a483e1dcec1b38b8 +Subproject commit 337d70e3151968d57e56df17f5de5459857b1c6b diff --git a/osu.Game/Online/API/APIRequest.cs b/osu.Game/Online/API/APIRequest.cs index 9a8180778d..e643dbae1a 100644 --- a/osu.Game/Online/API/APIRequest.cs +++ b/osu.Game/Online/API/APIRequest.cs @@ -36,7 +36,7 @@ namespace osu.Game.Online.API return request; } - private void request_Progress(WebRequest request, long current, long total) => API.Scheduler.Add(delegate { Progress?.Invoke(current, total); }); + private void request_Progress(long current, long total) => API.Scheduler.Add(delegate { Progress?.Invoke(current, total); }); protected APIDownloadRequest() { From b59401357e02f6e9acf03f7ba7867068106b2cd8 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 27 Oct 2017 12:53:08 +0900 Subject: [PATCH 2/6] Remove singular RetryCount usage, update framework --- osu-framework | 2 +- osu.Game/Online/API/APIRequest.cs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/osu-framework b/osu-framework index 337d70e315..54ec89dc64 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 337d70e3151968d57e56df17f5de5459857b1c6b +Subproject commit 54ec89dc64736aa14f124162ab5c2433535727ea diff --git a/osu.Game/Online/API/APIRequest.cs b/osu.Game/Online/API/APIRequest.cs index e643dbae1a..b7debb8e41 100644 --- a/osu.Game/Online/API/APIRequest.cs +++ b/osu.Game/Online/API/APIRequest.cs @@ -99,7 +99,6 @@ namespace osu.Game.Online.API throw new TimeoutException(@"API request timeout hit"); WebRequest = CreateWebRequest(); - WebRequest.RetryCount = 0; WebRequest.Headers[@"Authorization"] = $@"Bearer {api.AccessToken}"; if (checkAndProcessFailure()) From f94505243dba8c562f47749b828d66887356d24b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 30 Oct 2017 17:28:53 +0900 Subject: [PATCH 3/6] Use AllowRetryOnTimeout where to maintain previous functionality --- osu.Game/Online/API/APIRequest.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Online/API/APIRequest.cs b/osu.Game/Online/API/APIRequest.cs index b7debb8e41..74dddfc1c5 100644 --- a/osu.Game/Online/API/APIRequest.cs +++ b/osu.Game/Online/API/APIRequest.cs @@ -99,6 +99,7 @@ namespace osu.Game.Online.API throw new TimeoutException(@"API request timeout hit"); WebRequest = CreateWebRequest(); + WebRequest.AllowRetryOnTimeout = false; WebRequest.Headers[@"Authorization"] = $@"Bearer {api.AccessToken}"; if (checkAndProcessFailure()) From 605853267dc8cd7b2b85a7d60a5c84618c809787 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 Oct 2017 19:31:45 +0900 Subject: [PATCH 4/6] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 54ec89dc64..b45d4d1db1 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 54ec89dc64736aa14f124162ab5c2433535727ea +Subproject commit b45d4d1db105b5955eff0e707128e10e209a40fe From cd5324f1d1d766985b6825be48293ac10ceb1361 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 30 Oct 2017 21:23:47 +0900 Subject: [PATCH 5/6] Update API code to use the new Add* methods on requests --- osu.Desktop.Deploy/Program.cs | 2 +- osu.Game/Online/API/APIRequest.cs | 2 +- osu.Game/Online/API/OAuth.cs | 15 +++++++++------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/osu.Desktop.Deploy/Program.cs b/osu.Desktop.Deploy/Program.cs index d52be70b6e..54fb50d0f8 100644 --- a/osu.Desktop.Deploy/Program.cs +++ b/osu.Desktop.Deploy/Program.cs @@ -390,7 +390,7 @@ namespace osu.Desktop.Deploy public static void AuthenticatedBlockingPerform(this WebRequest r) { - r.Headers.Add("Authorization", $"token {GitHubAccessToken}"); + r.AddHeader("Authorization", $"token {GitHubAccessToken}"); r.Perform(); } } diff --git a/osu.Game/Online/API/APIRequest.cs b/osu.Game/Online/API/APIRequest.cs index 74dddfc1c5..71b18103b0 100644 --- a/osu.Game/Online/API/APIRequest.cs +++ b/osu.Game/Online/API/APIRequest.cs @@ -100,7 +100,7 @@ namespace osu.Game.Online.API WebRequest = CreateWebRequest(); WebRequest.AllowRetryOnTimeout = false; - WebRequest.Headers[@"Authorization"] = $@"Bearer {api.AccessToken}"; + WebRequest.AddHeader("Authorization", $"Bearer {api.AccessToken}"); if (checkAndProcessFailure()) return; diff --git a/osu.Game/Online/API/OAuth.cs b/osu.Game/Online/API/OAuth.cs index 445688f2ce..2e00fe6f1b 100644 --- a/osu.Game/Online/API/OAuth.cs +++ b/osu.Game/Online/API/OAuth.cs @@ -127,7 +127,8 @@ namespace osu.Game.Online.API protected override void PrePerform() { - Parameters[@"refresh_token"] = RefreshToken; + AddParameter("refresh_token", RefreshToken); + base.PrePerform(); } } @@ -146,8 +147,9 @@ namespace osu.Game.Online.API protected override void PrePerform() { - Parameters[@"username"] = Username; - Parameters[@"password"] = Password; + AddParameter("username", Username); + AddParameter("password", Password); + base.PrePerform(); } } @@ -161,9 +163,10 @@ namespace osu.Game.Online.API protected override void PrePerform() { - Parameters[@"grant_type"] = GrantType; - Parameters[@"client_id"] = ClientId; - Parameters[@"client_secret"] = ClientSecret; + AddParameter("grant_type", GrantType); + AddParameter("client_id", ClientId); + AddParameter("client_secret", ClientSecret); + base.PrePerform(); } } From 40f3cb5db7fd0d2e6e7fdbb78627247226874eb5 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 30 Oct 2017 22:39:25 +0900 Subject: [PATCH 6/6] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index b45d4d1db1..ef10edfc75 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit b45d4d1db105b5955eff0e707128e10e209a40fe +Subproject commit ef10edfc750b39258edbff46019f1d10700548c2