aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-11-29 12:40:18 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2020-11-29 12:40:18 +0100
commitb2ebc41ba291d041dc2be06fd8fc8914f1b298b7 (patch)
treed54c900d6f61c794f4dd401f9f6b278633fb54b6
parentmanager: do not respond to update state requests for non-elevated (diff)
downloadwireguard-windows-b2ebc41ba291d041dc2be06fd8fc8914f1b298b7.tar.xz
wireguard-windows-b2ebc41ba291d041dc2be06fd8fc8914f1b298b7.zip
fetcher: enable HTTP/2.0 on systems that support it
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--installer/fetcher/fetcher.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/installer/fetcher/fetcher.c b/installer/fetcher/fetcher.c
index 2e0a2d16..2dce1210 100644
--- a/installer/fetcher/fetcher.c
+++ b/installer/fetcher/fetcher.c
@@ -73,7 +73,7 @@ static void set_progress(HWND progress, size_t current, size_t total)
static DWORD __stdcall download_thread(void *param)
{
- DWORD ret = 1, bytes_read, bytes_written;
+ DWORD ret = 1, bytes_read, bytes_written, enable_http2 = WINHTTP_PROTOCOL_FLAG_HTTP2;
HINTERNET session = NULL, connection = NULL, request = NULL;
uint8_t hash[32], computed_hash[32], buf[512 * 1024];
char download_path[MAX_FILENAME_LEN + sizeof(msi_path)], random_filename[65];
@@ -113,6 +113,7 @@ static DWORD __stdcall download_thread(void *param)
session = WinHttpOpen(L(useragent()), is_win7() ? WINHTTP_ACCESS_TYPE_DEFAULT_PROXY : WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY, NULL, NULL, 0);
if (!session)
goto out;
+ WinHttpSetOption(session, WINHTTP_OPTION_ENABLE_HTTP_PROTOCOL, &enable_http2, sizeof(enable_http2)); // Don't check return value, in case of old Windows
connection = WinHttpConnect(session, L(server), port, 0);
if (!connection)
goto out;