From c7a13e79289ae35c4e2a9bccb3fdeb2bc03a925d Mon Sep 17 00:00:00 2001
From: Nicolas Werner <nicolas.werner@hotmail.de>
Date: Sun, 20 Nov 2022 02:15:17 +0100
Subject: [PATCH] Plumb altsvc support

---
 CMakeLists.txt                    | 6 +++---
 include/mtxclient/http/client.hpp | 3 +++
 lib/http/client.cpp               | 6 ++++++
 subprojects/coeurl.wrap           | 2 +-
 4 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 044975b19..0fcc1c2b1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,8 +15,8 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "compile as PIC by default")
 option(HUNTER_ENABLED "Enable Hunter package manager" OFF)
 include("cmake/HunterGate.cmake")
 HunterGate(
-    URL "https://github.com/cpp-pm/hunter/archive/v0.24.3.tar.gz"
-    SHA1 "10738b59e539818a01090e64c2d09896247530c7"
+    URL "https://github.com/cpp-pm/hunter/archive/v0.24.8.tar.gz"
+    SHA1 "ca7838dded9a1811b04ffd56175f629e0af82d3d"
     LOCAL
 )
 
@@ -180,7 +180,7 @@ if(USE_BUNDLED_COEURL)
 	FetchContent_Declare(
 		coeurl
 		GIT_REPOSITORY https://nheko.im/Nheko-Reborn/coeurl.git
-		GIT_TAG        v0.2.1
+		GIT_TAG        f989f3c54c1ca15e29c5bd6b1ce4efbcb3fd8078
 		)
 	FetchContent_MakeAvailable(coeurl)
 	target_link_libraries(matrix_client PUBLIC coeurl::coeurl)
diff --git a/include/mtxclient/http/client.hpp b/include/mtxclient/http/client.hpp
index 8e0907d53..9c231263a 100644
--- a/include/mtxclient/http/client.hpp
+++ b/include/mtxclient/http/client.hpp
@@ -204,6 +204,9 @@ public:
     Client(const std::string &server = "", uint16_t port = 443);
     ~Client();
 
+    //! Set a path to cache alternate service lookups like the http/3 ports of a server.
+    void alt_svc_cache_path(const std::string &path);
+
     //! Wait for the client to close.
     void close(bool force = false);
     //! Enable or disable certificate verification. On by default
diff --git a/lib/http/client.cpp b/lib/http/client.cpp
index f9847d553..cf3914f98 100644
--- a/lib/http/client.cpp
+++ b/lib/http/client.cpp
@@ -51,6 +51,12 @@ Client::shutdown()
     p->client.shutdown();
 }
 
+void
+Client::alt_svc_cache_path(const std::string &path)
+{
+    p->client.alt_svc_cache_path(path);
+}
+
 coeurl::Headers
 mtx::http::Client::prepare_headers(bool requires_auth)
 {
diff --git a/subprojects/coeurl.wrap b/subprojects/coeurl.wrap
index 85c4a2af4..d7b528bc8 100644
--- a/subprojects/coeurl.wrap
+++ b/subprojects/coeurl.wrap
@@ -1,3 +1,3 @@
 [wrap-git]
 url = https://nheko.im/nheko-reborn/coeurl.git
-revision = v0.2.1
+revision = f989f3c54c1ca15e29c5bd6b1ce4efbcb3fd8078
-- 
GitLab