Skip to content

Commit 2124784

Browse files
Move winhttppal to its own library
1 parent 8a4d808 commit 2124784

File tree

11 files changed

+48
-4138
lines changed

11 files changed

+48
-4138
lines changed

Release/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ endif()
6161

6262
include(cmake/cpprest_find_boost.cmake)
6363
include(cmake/cpprest_find_zlib.cmake)
64-
include(cmake/cpprest_find_curl.cmake)
64+
include(cmake/cpprest_find_winhttppal.cmake)
6565
include(cmake/cpprest_find_openssl.cmake)
6666
include(cmake/cpprest_find_websocketpp.cmake)
6767
include(cmake/cpprest_find_brotli.cmake)

Release/cmake/cpprest_find_curl.cmake

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
function(cpprest_find_winhttppal)
2+
if(TARGET cpprestsdk_winhttppal_internal)
3+
return()
4+
endif()
5+
6+
if(NOT winhttppal_LIBRARY OR NOT winhttppal_INCLUDE_DIRS)
7+
find_package(winhttppal REQUIRED)
8+
endif()
9+
10+
add_library(cpprestsdk_winhttppal_internal INTERFACE)
11+
if(TARGET winhttppal::winhttppal)
12+
target_link_libraries(cpprestsdk_winhttppal_internal INTERFACE winhttppal::winhttppal)
13+
else()
14+
target_link_libraries(cpprestsdk_winhttppal_internal INTERFACE "$<BUILD_INTERFACE:${winhttppal_LIBRARY}>")
15+
target_include_directories(cpprestsdk_winhttppal_internal INTERFACE "$<BUILD_INTERFACE:${winhttppal_INCLUDE_DIRS}>")
16+
endif()
17+
endfunction()

Release/cmake/cpprestsdk-config.in.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ if(@CPPREST_USES_OPENSSL@)
1111
find_dependency(OpenSSL)
1212
endif()
1313

14-
if(@CPPREST_USES_CURL@)
15-
find_dependency(CURL)
14+
if(@CPPREST_USES_WINHTTPPAL@)
15+
find_dependency(WINHTTPPAL)
1616
endif()
1717

1818
if(@CPPREST_USES_BOOST@ AND OFF)

Release/src/CMakeLists.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,13 @@ if(CPPREST_HTTP_CLIENT_IMPL STREQUAL "asio")
131131
target_compile_definitions(cpprest PUBLIC -DCPPREST_FORCE_HTTP_CLIENT_ASIO)
132132
target_sources(cpprest PRIVATE http/client/http_client_asio.cpp http/client/x509_cert_utilities.cpp)
133133
target_link_libraries(cpprest PUBLIC cpprestsdk_boost_internal cpprestsdk_openssl_internal)
134-
elseif(CPPREST_HTTP_CLIENT_IMPL STREQUAL "curl")
134+
elseif(CPPREST_HTTP_CLIENT_IMPL STREQUAL "winhttppal")
135135
cpprest_find_boost()
136136
cpprest_find_openssl()
137-
cpprest_find_curl()
138-
target_compile_definitions(cpprest PUBLIC -DCPPREST_FORCE_HTTP_CLIENT_CURL)
139-
target_sources(cpprest PRIVATE http/client/http_client_curl.cpp http/client/winhttppal/winhttppal.cpp http/client/x509_cert_utilities.cpp)
140-
target_link_libraries(cpprest PUBLIC cpprestsdk_boost_internal cpprestsdk_openssl_internal cpprestsdk_curl_internal)
137+
cpprest_find_winhttppal()
138+
target_compile_definitions(cpprest PUBLIC -DCPPREST_FORCE_HTTP_CLIENT_WINHTTPPAL)
139+
target_sources(cpprest PRIVATE http/client/http_client_winhttppal.cpp http/client/x509_cert_utilities.cpp)
140+
target_link_libraries(cpprest PUBLIC cpprestsdk_boost_internal cpprestsdk_openssl_internal cpprestsdk_winhttppal_internal)
141141
elseif(CPPREST_HTTP_CLIENT_IMPL STREQUAL "winhttp")
142142
target_link_libraries(cpprest PRIVATE
143143
httpapi.lib
@@ -244,7 +244,7 @@ if(CPPREST_INSTALL)
244244
set(CPPREST_USES_ZLIB OFF)
245245
set(CPPREST_USES_BROTLI OFF)
246246
set(CPPREST_USES_OPENSSL OFF)
247-
set(CPPREST_USES_CURL OFF)
247+
set(CPPREST_USES_WINHTTPPAL OFF)
248248

249249
set(CPPREST_TARGETS cpprest)
250250
if(TARGET cpprestsdk_boost_internal)
@@ -263,9 +263,9 @@ if(CPPREST_INSTALL)
263263
list(APPEND CPPREST_TARGETS cpprestsdk_openssl_internal)
264264
set(CPPREST_USES_OPENSSL ON)
265265
endif()
266-
if(TARGET cpprestsdk_curl_internal)
267-
list(APPEND CPPREST_TARGETS cpprestsdk_curl_internal)
268-
set(CPPREST_USES_CURL ON)
266+
if(TARGET cpprestsdk_winhttppal_internal)
267+
list(APPEND CPPREST_TARGETS cpprestsdk_winhttppal_internal)
268+
set(CPPREST_USES_WINHTTPPAL ON)
269269
endif()
270270
if(TARGET cpprestsdk_websocketpp_internal)
271271
list(APPEND CPPREST_TARGETS cpprestsdk_websocketpp_internal)

Release/src/http/client/http_client_curl.cpp renamed to Release/src/http/client/http_client_winhttppal.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include "../common/internal_http_helpers.h"
1919
#include "cpprest/http_headers.h"
2020
#include "http_client_impl.h"
21-
#include "winhttppal/winhttppal.h"
21+
#include "winhttppal.h"
2222
#include <atomic>
2323
#include <memory>
2424

@@ -620,7 +620,7 @@ struct ie_proxy_config : WINHTTP_CURRENT_USER_IE_PROXY_CONFIG
620620
};
621621

622622

623-
// CURL client.
623+
// WINHTTPPAL client.
624624
class curl_client final : public _http_client_communicator
625625
{
626626
public:
@@ -923,7 +923,7 @@ class curl_client final : public _http_client_communicator
923923
DWORD ignoredCertificateValidationSteps = 0;
924924
if (client_config().validate_certificates())
925925
{
926-
// Revocation is enabled by default in CURL
926+
// Revocation is enabled by default in WINHTTPPAL
927927
// check if the user has overridden the desired Common Name with the host header
928928
const auto hostHeader = headers.find(_XPLATSTR("Host"));
929929
if (hostHeader != headers.end())

0 commit comments

Comments
 (0)