Skip to content

Commit

Permalink
Move winhttppal to its own library
Browse files Browse the repository at this point in the history
  • Loading branch information
franksinankaya committed Sep 2, 2019
1 parent 8a4d808 commit 2124784
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 4,138 deletions.
2 changes: 1 addition & 1 deletion Release/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ endif()

include(cmake/cpprest_find_boost.cmake)
include(cmake/cpprest_find_zlib.cmake)
include(cmake/cpprest_find_curl.cmake)
include(cmake/cpprest_find_winhttppal.cmake)
include(cmake/cpprest_find_openssl.cmake)
include(cmake/cpprest_find_websocketpp.cmake)
include(cmake/cpprest_find_brotli.cmake)
Expand Down
17 changes: 0 additions & 17 deletions Release/cmake/cpprest_find_curl.cmake

This file was deleted.

17 changes: 17 additions & 0 deletions Release/cmake/cpprest_find_winhttppal.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
function(cpprest_find_winhttppal)
if(TARGET cpprestsdk_winhttppal_internal)
return()
endif()

if(NOT winhttppal_LIBRARY OR NOT winhttppal_INCLUDE_DIRS)
find_package(winhttppal REQUIRED)
endif()

add_library(cpprestsdk_winhttppal_internal INTERFACE)
if(TARGET winhttppal::winhttppal)
target_link_libraries(cpprestsdk_winhttppal_internal INTERFACE winhttppal::winhttppal)
else()
target_link_libraries(cpprestsdk_winhttppal_internal INTERFACE "$<BUILD_INTERFACE:${winhttppal_LIBRARY}>")
target_include_directories(cpprestsdk_winhttppal_internal INTERFACE "$<BUILD_INTERFACE:${winhttppal_INCLUDE_DIRS}>")
endif()
endfunction()
4 changes: 2 additions & 2 deletions Release/cmake/cpprestsdk-config.in.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ if(@CPPREST_USES_OPENSSL@)
find_dependency(OpenSSL)
endif()

if(@CPPREST_USES_CURL@)
find_dependency(CURL)
if(@CPPREST_USES_WINHTTPPAL@)
find_dependency(WINHTTPPAL)
endif()

if(@CPPREST_USES_BOOST@ AND OFF)
Expand Down
18 changes: 9 additions & 9 deletions Release/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ if(CPPREST_HTTP_CLIENT_IMPL STREQUAL "asio")
target_compile_definitions(cpprest PUBLIC -DCPPREST_FORCE_HTTP_CLIENT_ASIO)
target_sources(cpprest PRIVATE http/client/http_client_asio.cpp http/client/x509_cert_utilities.cpp)
target_link_libraries(cpprest PUBLIC cpprestsdk_boost_internal cpprestsdk_openssl_internal)
elseif(CPPREST_HTTP_CLIENT_IMPL STREQUAL "curl")
elseif(CPPREST_HTTP_CLIENT_IMPL STREQUAL "winhttppal")
cpprest_find_boost()
cpprest_find_openssl()
cpprest_find_curl()
target_compile_definitions(cpprest PUBLIC -DCPPREST_FORCE_HTTP_CLIENT_CURL)
target_sources(cpprest PRIVATE http/client/http_client_curl.cpp http/client/winhttppal/winhttppal.cpp http/client/x509_cert_utilities.cpp)
target_link_libraries(cpprest PUBLIC cpprestsdk_boost_internal cpprestsdk_openssl_internal cpprestsdk_curl_internal)
cpprest_find_winhttppal()
target_compile_definitions(cpprest PUBLIC -DCPPREST_FORCE_HTTP_CLIENT_WINHTTPPAL)
target_sources(cpprest PRIVATE http/client/http_client_winhttppal.cpp http/client/x509_cert_utilities.cpp)
target_link_libraries(cpprest PUBLIC cpprestsdk_boost_internal cpprestsdk_openssl_internal cpprestsdk_winhttppal_internal)
elseif(CPPREST_HTTP_CLIENT_IMPL STREQUAL "winhttp")
target_link_libraries(cpprest PRIVATE
httpapi.lib
Expand Down Expand Up @@ -244,7 +244,7 @@ if(CPPREST_INSTALL)
set(CPPREST_USES_ZLIB OFF)
set(CPPREST_USES_BROTLI OFF)
set(CPPREST_USES_OPENSSL OFF)
set(CPPREST_USES_CURL OFF)
set(CPPREST_USES_WINHTTPPAL OFF)

set(CPPREST_TARGETS cpprest)
if(TARGET cpprestsdk_boost_internal)
Expand All @@ -263,9 +263,9 @@ if(CPPREST_INSTALL)
list(APPEND CPPREST_TARGETS cpprestsdk_openssl_internal)
set(CPPREST_USES_OPENSSL ON)
endif()
if(TARGET cpprestsdk_curl_internal)
list(APPEND CPPREST_TARGETS cpprestsdk_curl_internal)
set(CPPREST_USES_CURL ON)
if(TARGET cpprestsdk_winhttppal_internal)
list(APPEND CPPREST_TARGETS cpprestsdk_winhttppal_internal)
set(CPPREST_USES_WINHTTPPAL ON)
endif()
if(TARGET cpprestsdk_websocketpp_internal)
list(APPEND CPPREST_TARGETS cpprestsdk_websocketpp_internal)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "../common/internal_http_helpers.h"
#include "cpprest/http_headers.h"
#include "http_client_impl.h"
#include "winhttppal/winhttppal.h"
#include "winhttppal.h"
#include <atomic>
#include <memory>

Expand Down Expand Up @@ -620,7 +620,7 @@ struct ie_proxy_config : WINHTTP_CURRENT_USER_IE_PROXY_CONFIG
};


// CURL client.
// WINHTTPPAL client.
class curl_client final : public _http_client_communicator
{
public:
Expand Down Expand Up @@ -923,7 +923,7 @@ class curl_client final : public _http_client_communicator
DWORD ignoredCertificateValidationSteps = 0;
if (client_config().validate_certificates())
{
// Revocation is enabled by default in CURL
// Revocation is enabled by default in WINHTTPPAL
// check if the user has overridden the desired Common Name with the host header
const auto hostHeader = headers.find(_XPLATSTR("Host"));
if (hostHeader != headers.end())
Expand Down
Loading

0 comments on commit 2124784

Please sign in to comment.