From 7da85e6f9b6e9a694eb2faef5c1779c83b9efe3c Mon Sep 17 00:00:00 2001 From: turret Date: Fri, 12 Jan 2024 19:43:15 +0000 Subject: net: format WSS url properly libcurl requires first 3 characters of a wss url (i.e. wss://example.com) to be capital, so instead WSS://example.com. so we modify the assume url to use WSS and ensure the returned URL from discord uses the WSS capital scheme --- net/net.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/net/net.c b/net/net.c index a1f013b..332aef3 100644 --- a/net/net.c +++ b/net/net.c @@ -56,20 +56,23 @@ void net_get_gateway_url() goto assume; } - char *gateway_url = calloc(strlen(gateway_url_json->valuestring) + 1, + gateway_url = calloc(strlen(gateway_url_json->valuestring) + 1, sizeof(char)); strcpy(gateway_url, gateway_url_json->valuestring); + gateway_url[0] = 'W'; + gateway_url[1] = 'S'; + gateway_url[2] = 'S'; + print(LOG_DEBUG "net: using gateway url %s", gateway_url); - free(gateway_url); cJSON_Delete(gateway_info); return; assume: - print(LOG_DEBUG "net: assuming gateway url wss://gateway.discord.gg"); - gateway_url = calloc(strlen("wss://gateway.discord.gg") + 1, + print(LOG_DEBUG "net: assuming gateway url WSS://gateway.discord.gg"); + gateway_url = calloc(strlen("WSS://gateway.discord.gg") + 1, sizeof(char)); - strcpy(gateway_url, "wss://gateway.discord.gg"); + strcpy(gateway_url, "WSS://gateway.discord.gg"); return; } l1_initcall(net_get_gateway_url); -- cgit v1.2.3