From c2992afb4a9f7cbc98fffec4548c30990095d386 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Fri, 31 Mar 2023 01:22:41 +0300 Subject: [PATCH] engine: network: make all HTTP commands and cvars restricted, except http_addcustomserver. Also zero http_useragent by default (it's autogenerated now) --- engine/common/net_ws.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/engine/common/net_ws.c b/engine/common/net_ws.c index bd665d46..ae5625c5 100644 --- a/engine/common/net_ws.c +++ b/engine/common/net_ws.c @@ -3043,16 +3043,16 @@ void HTTP_Init( void ) http.first_file = http.last_file = NULL; - Cmd_AddRestrictedCommand("http_download", &HTTP_Download_f, "add file to download queue"); - Cmd_AddRestrictedCommand("http_skip", &HTTP_Skip_f, "skip current download server"); - Cmd_AddRestrictedCommand("http_cancel", &HTTP_Cancel_f, "cancel current download"); - Cmd_AddRestrictedCommand("http_clear", &HTTP_Clear_f, "cancel all downloads"); - Cmd_AddCommand("http_list", &HTTP_List_f, "list all queued downloads"); - Cmd_AddCommand("http_addcustomserver", &HTTP_AddCustomServer_f, "add custom fastdl server"); - http_useragent = Cvar_Get( "http_useragent", "xash3d", FCVAR_ARCHIVE, "User-Agent string" ); - http_autoremove = Cvar_Get( "http_autoremove", "1", FCVAR_ARCHIVE, "remove broken files" ); - http_timeout = Cvar_Get( "http_timeout", "45", FCVAR_ARCHIVE, "timeout for http downloader" ); - http_maxconnections = Cvar_Get( "http_maxconnections", "4", FCVAR_ARCHIVE, "maximum http connection number" ); + Cmd_AddRestrictedCommand( "http_download", HTTP_Download_f, "add file to download queue" ); + Cmd_AddRestrictedCommand( "http_skip", HTTP_Skip_f, "skip current download server" ); + Cmd_AddRestrictedCommand( "http_cancel", HTTP_Cancel_f, "cancel current download" ); + Cmd_AddRestrictedCommand( "http_clear", HTTP_Clear_f, "cancel all downloads" ); + Cmd_AddRestrictedCommand( "http_list", HTTP_List_f, "list all queued downloads" ); + Cmd_AddCommand( "http_addcustomserver", HTTP_AddCustomServer_f, "add custom fastdl server"); + http_useragent = Cvar_Get( "http_useragent", "", FCVAR_ARCHIVE | FCVAR_PRIVILEGED, "User-Agent string" ); + http_autoremove = Cvar_Get( "http_autoremove", "1", FCVAR_ARCHIVE | FCVAR_PRIVILEGED, "remove broken files" ); + http_timeout = Cvar_Get( "http_timeout", "45", FCVAR_ARCHIVE | FCVAR_PRIVILEGED, "timeout for http downloader" ); + http_maxconnections = Cvar_Get( "http_maxconnections", "4", FCVAR_ARCHIVE | FCVAR_PRIVILEGED, "maximum http connection number" ); // Read servers from fastdl.txt line = serverfile = (char *)FS_LoadFile( "fastdl.txt", 0, false );