Add abstract frontend to HTTP support and stop using curl on Windows

This commit is contained in:
Tim Angus committed 2025-07-22 14:57:01 +01:00
1 parent bc30e0186b
commit 1cbba07fc3
12 files changed
+187 -299

No files matched your search

+25 -27
View File
@@ -1210,8 +1210,8 @@ void CL_ShutdownAll(qboolean shutdownRef)
if(clc.demorecording)
CL_StopRecord_f();
#ifdef USE_CURL
CL_cURL_Shutdown();
#ifdef USE_HTTP
CL_HTTP_Shutdown();
#endif
// clear sounds
S_DisableSounds();
@@ -2088,17 +2088,17 @@ Called when all downloading has been completed
*/
void CL_DownloadsComplete( void ) {
#ifdef USE_CURL
// if we downloaded with cURL
if(clc.cURLUsed) {
clc.cURLUsed = qfalse;
CL_cURL_Shutdown();
if( clc.cURLDisconnected ) {
#ifdef USE_HTTP
// if we downloaded with HTTP
if(clc.httpUsed) {
clc.httpUsed = qfalse;
CL_HTTP_Shutdown();
if( clc.disconnectedForHttpDownload ) {
if(clc.downloadRestart) {
FS_Restart(clc.checksumFeed);
clc.downloadRestart = qfalse;
}
clc.cURLDisconnected = qfalse;
clc.disconnectedForHttpDownload = qfalse;
CL_Reconnect_f();
return;
}
@@ -2193,7 +2193,7 @@ void CL_NextDownload(void)
{
char *s;
char *remoteName, *localName;
qboolean useCURL = qfalse;
qboolean usedHTTP = qfalse;
// A download has finished, check whether this matches a referenced checksum
if(*clc.downloadName)
@@ -2230,7 +2230,7 @@ void CL_NextDownload(void)
*s++ = 0;
else
s = localName + strlen(localName); // point at the nul byte
#ifdef USE_CURL
#ifdef USE_HTTP
if(!(cl_allowDownload->integer & DLF_NO_REDIRECT)) {
if(clc.sv_allowDownload & DLF_NO_REDIRECT) {
Com_Printf("WARNING: server does not "
@@ -2243,14 +2243,10 @@ void CL_NextDownload(void)
"download redirection, but does not "
"have sv_dlURL set\n");
}
else if(!CL_cURL_Init()) {
Com_Printf("WARNING: could not load "
"cURL library\n");
}
else {
CL_cURL_BeginDownload(localName, va("%s/%s",
else if(CL_HTTP_Available()) {
CL_HTTP_BeginDownload(localName, va("%s/%s",
clc.sv_dlURL, remoteName));
useCURL = qtrue;
usedHTTP = qtrue;
}
}
else if(!(clc.sv_allowDownload & DLF_NO_REDIRECT)) {
@@ -2259,8 +2255,8 @@ void CL_NextDownload(void)
"configuration (cl_allowDownload is %d)\n",
cl_allowDownload->integer);
}
#endif /* USE_CURL */
if(!useCURL) {
#endif /* USE_HTTP */
if(!usedHTTP) {
if((cl_allowDownload->integer & DLF_NO_UDP)) {
Com_Error(ERR_DROP, "UDP Downloads are "
"disabled on your client. "
@@ -2934,13 +2930,13 @@ void CL_Frame ( int msec ) {
return;
}
#ifdef USE_CURL
if(clc.downloadCURLM) {
CL_cURL_PerformDownload();
#ifdef USE_HTTP
if(clc.httpUsed) {
CL_HTTP_PerformDownload();
// we can't process frames normally when in disconnected
// download mode since the ui vm expects clc.state to be
// CA_CONNECTED
if(clc.cURLDisconnected) {
if(clc.disconnectedForHttpDownload) {
cls.realFrametime = msec;
cls.frametime = msec;
cls.realtime += cls.frametime;
@@ -3559,9 +3555,6 @@ void CL_Init( void ) {
cl_showMouseRate = Cvar_Get ("cl_showmouserate", "0", 0);
cl_allowDownload = Cvar_Get ("cl_allowDownload", "0", CVAR_ARCHIVE);
#ifdef USE_CURL_DLOPEN
cl_cURLLib = Cvar_Get("cl_cURLLib", DEFAULT_CURL_LIB, CVAR_ARCHIVE | CVAR_PROTECTED);
#endif
cl_conXOffset = Cvar_Get ("cl_conXOffset", "0", 0);
#ifdef __APPLE__
@@ -3656,6 +3649,11 @@ void CL_Init( void ) {
cl_voipProtocol = Cvar_Get ("cl_voipProtocol", cl_voip->integer ? "opus" : "", CVAR_USERINFO | CVAR_ROM);
#endif
#ifdef USE_HTTP
if(!CL_HTTP_Init()) {
Com_Printf("WARNING: couldn't initialize HTTP download support\n");
}
#endif
// cgame might not be initialized before menu is used
Cvar_Get ("cg_viewsize", "100", CVAR_ARCHIVE );