mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-09-20 09:04:43 +00:00
45d52271da
This adds the libqb_http API, which is designed to support HTTP and HTTPS usage from QB64-PE source. The design consists of a single thread which services all the HTTP(s) connections. There are then various libqb_http APIs exposed that allow interacting with this thread to create a new connection, query connection status, read data, or close the connection. Internally the thread makes use of the curl_multi interface to allow a single thread to service multiple HTTP(s) connections in parallel. This means you can _OPENCLIENT() multiple HTTP connection in a row and all of them will be serviced at the same time in whatever order data is available. HTTP is optional and selected via a Makefile setting. A stub is swapped in if HTTP support is not used, which avoids need to add another build flag to libqb.cpp.
38 lines
1.1 KiB
Makefile
38 lines
1.1 KiB
Makefile
|
|
ifeq ($(OS),win)
|
|
# This version is only used for Windows, Linux and OSX use the library provided by their system
|
|
|
|
CURL_LIB := $(PATH_INTERNAL_C)/parts/network/http/libcurl.a
|
|
|
|
CURL_MAKE_FLAGS := CFG=-schannel
|
|
CURL_MAKE_FLAGS += "CURL_CFLAG_EXTRAS=-DCURL_STATICLIB -DHTTP_ONLY"
|
|
CURL_MAKE_FLAGS += CC=../../../../c_compiler/bin/gcc.exe
|
|
CURL_MAKE_FLAGS += AR=../../../../c_compiler/bin/ar.exe
|
|
CURL_MAKE_FLAGS += RANLIB=../../../../c_compiler/bin/ranlib.exe
|
|
CURL_MAKE_FLAGS += STRIP=../../../../c_compiler/bin/strip.exe
|
|
CURL_MAKE_FLAGS += libcurl_a_LIBRARY="../libcurl.a"
|
|
CURL_MAKE_FLAGS += ARCH=w$(BITS)
|
|
|
|
$(CURL_LIB):
|
|
$(MAKE) -C $(PATH_INTERNAL_C)/parts/network/http/curl -f ./Makefile.m32 $(CURL_MAKE_FLAGS) "../libcurl.a"
|
|
|
|
.PHONY: clean-curl-lib
|
|
clean-curl-lib:
|
|
$(MAKE) -C $(PATH_INTERNAL_C)/parts/network/http/curl -f ./Makefile.m32 $(CURL_MAKE_FLAGS) clean
|
|
|
|
CLEAN_DEP_LIST += clean-curl-lib
|
|
CLEAN_LIST += $(CURL_LIB)
|
|
|
|
CURL_EXE_LIBS := $(CURL_LIB)
|
|
|
|
CURL_CXXFLAGS += -DCURL_STATICLIB
|
|
CURL_CXXFLAGS += -I$(PATH_INTERNAL_C)/parts/network/http/include
|
|
|
|
CURL_CXXLIBS += -lcrypt32
|
|
|
|
else
|
|
|
|
CURL_EXE_LIBS :=
|
|
CURL_CXXLIBS :=
|
|
CURL_CXXLIBS += -lcurl
|
|
endif
|