diff --git a/doc/LibCurlTransportAdatper.md b/doc/LibCurlTransportAdatper.md deleted file mode 100644 index ff40cbde6..000000000 --- a/doc/LibCurlTransportAdatper.md +++ /dev/null @@ -1,37 +0,0 @@ -# Libcurl Transport Adapter - -The Azure SDK for C++ provides an HTTP transport adapter implementation using the well known libcurl library. There are some general guidelines that you should know if you decide to use this implementation. - -## Global init and clean up - -Libcurl provides the functions [curl_global_init](https://curl.se/libcurl/c/curl_global_init.html) and [curl_global_cleanup](https://curl.se/libcurl/c/curl_global_cleanup.html) which are expected to be called at the start and before exiting the application. However, for a modular part of the application, like a library, it is expected that each library using libcurl will call the `curl_global_init` and `curl_global_cleanup`. From [libcurl global constants documentation](https://curl.se/libcurl/c/libcurl.html): - -> Note that if multiple modules in the program use libcurl, they all will separately call the libcurl functions, and that's OK because only the first curl_global_init and the last curl_global_cleanup in a program change anything. (libcurl uses a reference count in static memory). - -Consider the next example: - -```cpp -// Copyright (c) Microsoft Corporation. All rights reserved. -// SPDX-License-Identifier: MIT - -/** - * @file Demonstrate how to use libcurl and the Azure SDK for C++. - * - */ - -#include -#include - -int main(int argc, char** argv) -{ - curl_global_init(CURL_GLOBAL_ALL); - - // Use the Azure SDK clients. - - curl_global_cleanup(); - return 0; -} - -``` - -If the application is not using libcurl at all, only the Azure SDK library will call `curl_global_init` and `curl_global_cleanup`. If the application is calling the global functions and using libcurl, then the calls to these functions from the Azure SDK library won't change anything. So, as an application or library owner, you only need to worry about calling the global libcurl functions if you will be using libcurl directly. diff --git a/sdk/core/azure-core/CHANGELOG.md b/sdk/core/azure-core/CHANGELOG.md index 2e354d1b1..cb2f3b030 100644 --- a/sdk/core/azure-core/CHANGELOG.md +++ b/sdk/core/azure-core/CHANGELOG.md @@ -11,6 +11,7 @@ ### Bugs Fixed - [2647](https://github.com/Azure/azure-sdk-for-cpp/issues/2647) Make the curl transport adapter to check the connection close header. +- [2474](https://github.com/Azure/azure-sdk-for-cpp/issues/2474) Fix compiling with MSVC and /analyze. ### Other Changes diff --git a/sdk/core/azure-core/CMakeLists.txt b/sdk/core/azure-core/CMakeLists.txt index 12f57af0f..ac808ee7d 100644 --- a/sdk/core/azure-core/CMakeLists.txt +++ b/sdk/core/azure-core/CMakeLists.txt @@ -152,12 +152,6 @@ if(BUILD_TRANSPORT_WINHTTP) target_link_libraries(azure-core PRIVATE winhttp) endif() -if (MSVC) - # Disable warnings: - # - C6101: Returning uninitialized memory '*Mtu' -> libcurl calling WSAGetIPUserMtu from WS2tcpip.h - target_compile_options(azure-core PUBLIC /wd6101) -endif() - get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/src/private/package_version.hpp") generate_documentation(azure-core ${AZ_LIBRARY_VERSION}) diff --git a/sdk/core/azure-core/inc/azure/core/internal/json/json.hpp b/sdk/core/azure-core/inc/azure/core/internal/json/json.hpp index 00ae6c003..eca0e550a 100644 --- a/sdk/core/azure-core/inc/azure/core/internal/json/json.hpp +++ b/sdk/core/azure-core/inc/azure/core/internal/json/json.hpp @@ -2176,7 +2176,7 @@ _az_JSON_HEDLEY_DIAGNOSTIC_PUSH class exception : public std::exception { public: /// returns the explanatory string - _az_JSON_HEDLEY_RETURNS_NON_NULL const char* what() const noexcept override + const char* what() const noexcept override { return m.what(); } diff --git a/sdk/core/azure-core/src/http/curl/curl.cpp b/sdk/core/azure-core/src/http/curl/curl.cpp index b48026f2e..70d6aa5c1 100644 --- a/sdk/core/azure-core/src/http/curl/curl.cpp +++ b/sdk/core/azure-core/src/http/curl/curl.cpp @@ -27,7 +27,6 @@ #endif #include -#include #include #include diff --git a/sdk/core/azure-core/src/http/curl/curl_connection_pool_private.hpp b/sdk/core/azure-core/src/http/curl/curl_connection_pool_private.hpp index c6e0aeb75..9ea0202fd 100644 --- a/sdk/core/azure-core/src/http/curl/curl_connection_pool_private.hpp +++ b/sdk/core/azure-core/src/http/curl/curl_connection_pool_private.hpp @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include diff --git a/sdk/core/azure-core/src/http/curl/curl_connection_private.hpp b/sdk/core/azure-core/src/http/curl/curl_connection_private.hpp index 2b03fd243..7a26ac76c 100644 --- a/sdk/core/azure-core/src/http/curl/curl_connection_private.hpp +++ b/sdk/core/azure-core/src/http/curl/curl_connection_private.hpp @@ -12,9 +12,20 @@ #include "azure/core/http/http.hpp" #include -#include #include +#if defined(_MSC_VER) +// C6101 : Returning uninitialized memory '*Mtu'->libcurl calling WSAGetIPUserMtu from WS2tcpip.h +#pragma warning(push) +#pragma warning(disable : 6101) +#endif + +#include + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif + namespace Azure { namespace Core { namespace Http { namespace _detail { diff --git a/sdk/core/azure-core/test/ut/azure_core_test.cpp b/sdk/core/azure-core/test/ut/azure_core_test.cpp index 368a711f8..9f82b4628 100644 --- a/sdk/core/azure-core/test/ut/azure_core_test.cpp +++ b/sdk/core/azure-core/test/ut/azure_core_test.cpp @@ -5,7 +5,6 @@ #if defined(BUILD_CURL_HTTP_TRANSPORT_ADAPTER) #include -#include #include #endif diff --git a/sdk/core/azure-core/test/ut/azure_libcurl_core_main_test.cpp b/sdk/core/azure-core/test/ut/azure_libcurl_core_main_test.cpp index c85e97728..2e37fb8fb 100644 --- a/sdk/core/azure-core/test/ut/azure_libcurl_core_main_test.cpp +++ b/sdk/core/azure-core/test/ut/azure_libcurl_core_main_test.cpp @@ -16,8 +16,6 @@ #include -#include - #include #include #include diff --git a/sdk/core/azure-core/test/ut/curl_session_test.hpp b/sdk/core/azure-core/test/ut/curl_session_test.hpp index fc6b28c14..f84c11398 100644 --- a/sdk/core/azure-core/test/ut/curl_session_test.hpp +++ b/sdk/core/azure-core/test/ut/curl_session_test.hpp @@ -19,7 +19,6 @@ #endif // _MSC_VER #include -#include #include #include #include diff --git a/sdk/core/perf/test/inc/azure/perf/test/curl_http_client_get_test.hpp b/sdk/core/perf/test/inc/azure/perf/test/curl_http_client_get_test.hpp index 38f5d8b89..155198fe9 100644 --- a/sdk/core/perf/test/inc/azure/perf/test/curl_http_client_get_test.hpp +++ b/sdk/core/perf/test/inc/azure/perf/test/curl_http_client_get_test.hpp @@ -13,8 +13,6 @@ #include -#include - namespace Azure { namespace Perf { namespace Test { /** * @brief A performance test that defines a test option. diff --git a/sdk/identity/azure-identity/test/live/azure_identity_live_test.cpp b/sdk/identity/azure-identity/test/live/azure_identity_live_test.cpp index de1f8b77e..471d6e961 100644 --- a/sdk/identity/azure-identity/test/live/azure_identity_live_test.cpp +++ b/sdk/identity/azure-identity/test/live/azure_identity_live_test.cpp @@ -3,12 +3,6 @@ #include -#if defined(BUILD_CURL_HTTP_TRANSPORT_ADAPTER) -#include -#include -#include -#endif - int main(int argc, char** argv) { testing::InitGoogleTest(&argc, argv); diff --git a/sdk/keyvault/azure-security-keyvault-keys/test/ut/azure_security_keyvault_keys_test.cpp b/sdk/keyvault/azure-security-keyvault-keys/test/ut/azure_security_keyvault_keys_test.cpp index b18e233a8..3d0b851aa 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/test/ut/azure_security_keyvault_keys_test.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/test/ut/azure_security_keyvault_keys_test.cpp @@ -3,10 +3,6 @@ #include "gtest/gtest.h" -#if defined(BUILD_CURL_HTTP_TRANSPORT_ADAPTER) -#include -#endif - int main(int argc, char** argv) { testing::InitGoogleTest(&argc, argv);