From e6a49460ebd339c8828797497fc7eaebc0ebbf76 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Mon, 26 Sep 2022 20:38:31 +1000 Subject: [PATCH] curl: force http1.1 to workaround around some temporary issues with http2 requests (most noticable with dropbox) See https://github.com/curl/curl/issues/9526 for more details --- src/Http_Worker.c | 4 ++++ src/Resources.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Http_Worker.c b/src/Http_Worker.c index 67130a0ff..936361eb0 100644 --- a/src/Http_Worker.c +++ b/src/Http_Worker.c @@ -221,6 +221,9 @@ typedef int CURLcode; #define CURLOPT_HEADERFUNCTION (20000 + 79) #define CURLOPT_HTTPGET (0 + 80) #define CURLOPT_SSL_VERIFYHOST (0 + 81) +#define CURLOPT_HTTP_VERSION (0 + 84) + +#define CURL_HTTP_VERSION_1_1 2L /* stick to HTTP 1.1 */ #if defined _WIN32 #define APIENTRY __cdecl @@ -345,6 +348,7 @@ static void Http_SetCurlOpts(struct HttpRequest* req) { _curl_easy_setopt(curl, CURLOPT_USERAGENT, GAME_APP_NAME); _curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); _curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 20L); + _curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); _curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, Http_ProcessHeader); _curl_easy_setopt(curl, CURLOPT_HEADERDATA, req); diff --git a/src/Resources.c b/src/Resources.c index 9b596bc59..13e603fa1 100644 --- a/src/Resources.c +++ b/src/Resources.c @@ -449,7 +449,7 @@ static struct ZipfileSource { const char* url; cc_result (*Process)(struct HttpRequest* req); short size; - cc_bool downloaded; + cc_bool downloaded, last; int reqID; } defaultZipSources[] = { { "classic jar", "http://launcher.mojang.com/mc/game/c0.30_01c/client/54622801f5ef1bcc1549a842c5b04cb5d5583005/client.jar", ClassicPatcher_ExtractFiles, 291 },