Browse Source

Boilerplate code for WinINet.

Miku AuahDark 2 years ago
parent
commit
b4e954f439

+ 13 - 0
src/CMakeLists.txt

@@ -57,6 +57,10 @@ add_library (https-android STATIC EXCLUDE_FROM_ALL
 	android/AndroidClient.cpp
 )
 
+add_library (https-wininet STATIC EXCLUDE_FROM_ALL
+	windows/WinINetClient.cpp
+)
+
 ### Flags
 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
 	option (USE_CURL_BACKEND "Use the libcurl backend" ON)
@@ -64,6 +68,7 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
 	option (USE_SCHANNEL_BACKEND "Use the schannel backend (windows-only)" OFF)
 	option (USE_NSURL_BACKEND "Use the NSUrl backend (apple-only)" OFF)
 	option (USE_ANDROID_BACKEND "Use the Android Java backend (Android-only)" OFF)
+	option (USE_WININET_BACKEND "Use the WinINet backend (windows-only)" OFF)
 
 	option (USE_WINSOCK "Use winsock instead of BSD sockets (windows-only)" OFF)
 elseif (WIN32)
@@ -72,6 +77,7 @@ elseif (WIN32)
 	option (USE_SCHANNEL_BACKEND "Use the schannel backend (windows-only)" ON)
 	option (USE_NSURL_BACKEND "Use the NSUrl backend (apple-only)" OFF)
 	option (USE_ANDROID_BACKEND "Use the Android Java backend (Android-only)" OFF)
+	option (USE_WININET_BACKEND "Use the WinINet backend (windows-only)" ON)
 
 	option (USE_WINSOCK "Use winsock instead of BSD sockets (windows-only)" ON)
 
@@ -83,6 +89,7 @@ elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
 	option (USE_SCHANNEL_BACKEND "Use the schannel backend (windows-only)" OFF)
 	option (USE_NSURL_BACKEND "Use the NSUrl backend (apple-only)" ON)
 	option (USE_ANDROID_BACKEND "Use the Android Java backend (Android-only)" OFF)
+	option (USE_WININET_BACKEND "Use the WinINet backend (windows-only)" OFF)
 
 	option (USE_WINSOCK "Use winsock instead of BSD sockets (windows-only)" OFF)
 
@@ -98,6 +105,7 @@ elseif (ANDROID)
 	option (USE_SCHANNEL_BACKEND "Use the schannel backend (windows-only)" OFF)
 	option (USE_NSURL_BACKEND "Use the NSUrl backend (apple-only)" OFF)
 	option (USE_ANDROID_BACKEND "Use the Android Java backend (Android-only)" ON)
+	option (USE_WININET_BACKEND "Use the WinINet backend (windows-only)" OFF)
 
 	option (USE_WINSOCK "Use winsock instead of BSD sockets (windows-only)" OFF)
 
@@ -147,6 +155,11 @@ if (USE_ANDROID_BACKEND)
 	message(STATUS "Ensure to add the Java files to your project too!")
 endif ()
 
+if (USE_WININET_BACKEND)
+	set(HTTPS_BACKEND_WININET ON)
+	target_link_libraries (https https-wininet wininet)
+endif ()
+
 if (USE_WINSOCK)
 	set(HTTPS_USE_WINSOCK ON)
 endif ()

+ 1 - 0
src/common/config-generated.h.in

@@ -3,5 +3,6 @@
 #cmakedefine HTTPS_BACKEND_SCHANNEL
 #cmakedefine HTTPS_BACKEND_NSURL
 #cmakedefine HTTPS_BACKEND_ANDROID
+#cmakedefine HTTPS_BACKEND_WININET
 #cmakedefine HTTPS_USE_WINSOCK
 #cmakedefine DEBUG_SCHANNEL

+ 1 - 0
src/common/config.h

@@ -4,6 +4,7 @@
 	#include "common/config-generated.h"
 #elif defined(WIN32) || defined(_WIN32)
 	#define HTTPS_BACKEND_SCHANNEL
+	#define HTTPS_BACKEND_WININET
 	#define HTTPS_USE_WINSOCK
 #elif defined(__ANDROID__)
 	#define HTTPS_BACKEND_ANDROID

+ 0 - 0
src/windows/WinINetClient.cpp


+ 0 - 0
src/windows/WinINetClient.h