]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
checkextension(): check libcurl is loaded before returning it's available
authorbones_was_here <bones_was_here@xonotic.au>
Sat, 22 Jul 2023 06:36:14 +0000 (16:36 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Sat, 22 Jul 2023 06:36:14 +0000 (16:36 +1000)
Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
libcurl.c
libcurl.h
prvm_cmds.c

index 53674299a8a603388088bb15e635a2dc164f636f..b0ba3e21f55ba3958f60b6746e88a9a79d4f6143 100644 (file)
--- 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
index 21b8c6fe9f331cbfd2f31ba83e272736cbf4aad0..edf4c4a10cf9f676d0b3732df4235826ace0740a 100644 (file)
--- 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);
index 6535ea0ad04074b19b830c3a29a302998471d819..e8c54bb2fe9a045eae0ea214b3f4f633d4632d57 100644 (file)
@@ -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;
                }
        }