From 453ad8ed0d6d5f35622e28dec6f8b213c3b20653 Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Sat, 22 Jul 2023 16:36:14 +1000 Subject: [PATCH] checkextension(): check libcurl is loaded before returning it's available Signed-off-by: bones_was_here --- libcurl.c | 6 ++++++ libcurl.h | 1 + prvm_cmds.c | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/libcurl.c b/libcurl.c index 53674299..b0ba3e21 100644 --- a/libcurl.c +++ b/libcurl.c @@ -834,6 +834,12 @@ void Curl_Shutdown(void) curl_dll = NULL; } +// for VM_checkextension() +qbool Curl_Available(void) +{ + return curl_dll ? true : false; +} + /* ==================== Curl_Find diff --git a/libcurl.h b/libcurl.h index 21b8c6fe..edf4c4a1 100644 --- a/libcurl.h +++ b/libcurl.h @@ -25,6 +25,7 @@ void Curl_Cancel_ToMemory(curl_callback_t callback, void* cbdata); void Curl_Init(void); void Curl_Init_Commands(void); void Curl_Shutdown(void); +qbool Curl_Available(void); void Curl_CancelAll(void); void Curl_Clear_forthismap(void); qbool Curl_Have_forthismap(void); diff --git a/prvm_cmds.c b/prvm_cmds.c index 6535ea0a..e8c54bb2 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -321,6 +321,10 @@ static qbool checkextension(prvm_prog_t *prog, const char *name) if (!strcasecmp("DP_QC_DIGEST_SHA256", name)) return Crypto_Available(); + // special shreck for libcurl + if (!strcasecmp("DP_QC_URI_GET", name) || !strcasecmp("DP_QC_URI_POST", name)) + return Curl_Available(); + return true; } } -- 2.39.2