Skip to content

Commit 1a6b20a

Browse files
committed
Use Windows API for HTTP downloads (WIP)
1 parent 2380042 commit 1a6b20a

13 files changed

Lines changed: 271 additions & 299 deletions

File tree

Makefile

Lines changed: 22 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -179,16 +179,8 @@ ifndef USE_OPENAL_DLOPEN
179179
USE_OPENAL_DLOPEN=1
180180
endif
181181

182-
ifndef USE_CURL
183-
USE_CURL=1
184-
endif
185-
186-
ifndef USE_CURL_DLOPEN
187-
ifdef MINGW
188-
USE_CURL_DLOPEN=0
189-
else
190-
USE_CURL_DLOPEN=1
191-
endif
182+
ifndef USE_HTTP
183+
USE_HTTP=1
192184
endif
193185

194186
ifndef USE_CODEC_VORBIS
@@ -424,11 +416,9 @@ ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu" "gnu")
424416
endif
425417
endif
426418

427-
ifeq ($(USE_CURL),1)
419+
ifeq ($(USE_HTTP),1)
428420
CLIENT_CFLAGS += $(CURL_CFLAGS)
429-
ifneq ($(USE_CURL_DLOPEN),1)
430-
CLIENT_LIBS += $(CURL_LIBS)
431-
endif
421+
CLIENT_LIBS += $(CURL_LIBS)
432422
endif
433423

434424
ifeq ($(USE_MUMBLE),1)
@@ -583,11 +573,9 @@ ifeq ($(PLATFORM),darwin)
583573
endif
584574
endif
585575

586-
ifeq ($(USE_CURL),1)
576+
ifeq ($(USE_HTTP),1)
587577
CLIENT_CFLAGS += $(CURL_CFLAGS)
588-
ifneq ($(USE_CURL_DLOPEN),1)
589-
CLIENT_LIBS += $(CURL_LIBS)
590-
endif
578+
CLIENT_LIBS += $(CURL_LIBS)
591579
endif
592580

593581
BASE_CFLAGS += -D_THREAD_SAFE=1
@@ -761,20 +749,8 @@ ifdef MINGW
761749
FREETYPE_CFLAGS = -Ifreetype2
762750
endif
763751

764-
ifeq ($(USE_CURL),1)
765-
CLIENT_CFLAGS += $(CURL_CFLAGS)
766-
ifneq ($(USE_CURL_DLOPEN),1)
767-
ifeq ($(USE_LOCAL_HEADERS),1)
768-
CLIENT_CFLAGS += -DCURL_STATICLIB
769-
ifeq ($(ARCH),x86_64)
770-
CLIENT_LIBS += $(LIBSDIR)/win64/libcurl.a -lcrypt32
771-
else
772-
CLIENT_LIBS += $(LIBSDIR)/win32/libcurl.a -lcrypt32
773-
endif
774-
else
775-
CLIENT_LIBS += $(CURL_LIBS)
776-
endif
777-
endif
752+
ifeq ($(USE_HTTP),1)
753+
# TODO
778754
endif
779755

780756
ifeq ($(ARCH),x86)
@@ -851,11 +827,9 @@ ifeq ($(PLATFORM),freebsd)
851827
endif
852828
endif
853829

854-
ifeq ($(USE_CURL),1)
830+
ifeq ($(USE_HTTP),1)
855831
CLIENT_CFLAGS += $(CURL_CFLAGS)
856-
ifeq ($(USE_CURL_DLOPEN),1)
857-
CLIENT_LIBS += $(CURL_LIBS)
858-
endif
832+
CLIENT_LIBS += $(CURL_LIBS)
859833
endif
860834

861835
# cross-compiling tweaks
@@ -915,9 +889,9 @@ ifeq ($(PLATFORM),openbsd)
915889
endif
916890
endif
917891

918-
ifeq ($(USE_CURL),1)
892+
ifeq ($(USE_HTTP),1)
919893
CLIENT_CFLAGS += $(CURL_CFLAGS)
920-
USE_CURL_DLOPEN=0
894+
CLIENT_LIBS += $(CURL_LIBS)
921895
endif
922896

923897
# no shm_open on OpenBSD
@@ -940,12 +914,6 @@ ifeq ($(PLATFORM),openbsd)
940914
CLIENT_LIBS += $(THREAD_LIBS) $(OPENAL_LIBS)
941915
endif
942916
endif
943-
944-
ifeq ($(USE_CURL),1)
945-
ifneq ($(USE_CURL_DLOPEN),1)
946-
CLIENT_LIBS += $(CURL_LIBS)
947-
endif
948-
endif
949917
else # ifeq openbsd
950918

951919
#############################################################################
@@ -1268,11 +1236,8 @@ ifeq ($(USE_OPENAL),1)
12681236
endif
12691237
endif
12701238

1271-
ifeq ($(USE_CURL),1)
1272-
CLIENT_CFLAGS += -DUSE_CURL
1273-
ifeq ($(USE_CURL_DLOPEN),1)
1274-
CLIENT_CFLAGS += -DUSE_CURL_DLOPEN
1275-
endif
1239+
ifeq ($(USE_HTTP),1)
1240+
CLIENT_CFLAGS += -DUSE_HTTP
12761241
endif
12771242

12781243
ifeq ($(USE_VOIP),1)
@@ -1950,8 +1915,6 @@ Q3OBJ = \
19501915
$(B)/client/qal.o \
19511916
$(B)/client/snd_openal.o \
19521917
\
1953-
$(B)/client/cl_curl.o \
1954-
\
19551918
$(B)/client/sv_bot.o \
19561919
$(B)/client/sv_ccmds.o \
19571920
$(B)/client/sv_client.o \
@@ -2007,6 +1970,14 @@ Q3OBJ = \
20071970
$(B)/client/sys_autoupdater.o \
20081971
$(B)/client/sys_main.o
20091972

1973+
ifdef MINGW
1974+
Q3OBJ += \
1975+
$(B)/client/cl_http_windows.o
1976+
else
1977+
Q3OBJ += \
1978+
$(B)/client/cl_http_curl.o
1979+
endif
1980+
20101981
ifdef MINGW
20111982
Q3OBJ += \
20121983
$(B)/client/con_passive.o
@@ -3246,7 +3217,6 @@ ifdef MINGW
32463217
SDLDLL=$(SDLDLL) \
32473218
USE_RENDERER_DLOPEN=$(USE_RENDERER_DLOPEN) \
32483219
USE_OPENAL_DLOPEN=$(USE_OPENAL_DLOPEN) \
3249-
USE_CURL_DLOPEN=$(USE_CURL_DLOPEN) \
32503220
USE_INTERNAL_OPUS=$(USE_INTERNAL_OPUS) \
32513221
USE_INTERNAL_ZLIB=$(USE_INTERNAL_ZLIB) \
32523222
USE_INTERNAL_JPEG=$(USE_INTERNAL_JPEG)

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,7 @@ Makefile.local:
154154
MISSIONPACK_CFLAGS - custom CFLAGS for missionpack (default '-DMISSIONPACK')
155155
USE_OPENAL - use OpenAL where available
156156
USE_OPENAL_DLOPEN - link with OpenAL at runtime
157-
USE_CURL - use libcurl for http/ftp download support
158-
USE_CURL_DLOPEN - link with libcurl at runtime
157+
USE_HTTP - enable http/ftp download support
159158
USE_CODEC_VORBIS - enable Ogg Vorbis support
160159
USE_CODEC_OPUS - enable Ogg Opus support
161160
USE_MUMBLE - enable Mumble support
@@ -208,7 +207,7 @@ set using command line arguments:
208207
cl_aviFrameRate - the framerate to use when capturing video
209208
cl_aviMotionJpeg - use the mjpeg codec when capturing video
210209
cl_guidServerUniq - makes cl_guid unique for each server
211-
cl_cURLLib - filename of cURL library to load
210+
cl_cURLLib - filename of cURL library to load (non-Windows)
212211
cl_consoleKeys - space delimited list of key names or
213212
characters that toggle the console
214213
cl_mouseAccelStyle - Set to 1 for QuakeLive mouse acceleration

code/client/cl_curl.h

Lines changed: 0 additions & 102 deletions
This file was deleted.

code/client/cl_http.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
===========================================================================
3+
Copyright (C) 2006 Tony J. White (tjw@tjw.org)
4+
5+
This file is part of Quake III Arena source code.
6+
7+
Quake III Arena source code is free software; you can redistribute it
8+
and/or modify it under the terms of the GNU General Public License as
9+
published by the Free Software Foundation; either version 2 of the License,
10+
or (at your option) any later version.
11+
12+
Quake III Arena source code is distributed in the hope that it will be
13+
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
GNU General Public License for more details.
16+
17+
You should have received a copy of the GNU General Public License
18+
along with Quake III Arena source code; if not, write to the Free Software
19+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20+
===========================================================================
21+
*/
22+
23+
#ifndef __CL_HTTP_H__
24+
#define __CL_HTTP_H__
25+
26+
#include "../qcommon/q_shared.h"
27+
28+
qboolean CL_HTTP_Init( void );
29+
qboolean CL_HTTP_Available( void );
30+
void CL_HTTP_Shutdown( void );
31+
void CL_HTTP_BeginDownload( const char *localName, const char *remoteURL );
32+
void CL_HTTP_PerformDownload( void );
33+
34+
#endif // __CL_HTTP_H__

0 commit comments

Comments
 (0)