diff -Nru cpprest-2.10.13/azure-pipelines.yml cpprest-2.10.14/azure-pipelines.yml --- cpprest-2.10.13/azure-pipelines.yml 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/azure-pipelines.yml 2019-07-16 19:07:11.000000000 +0000 @@ -153,46 +153,34 @@ vmImage: 'Ubuntu 16.04' steps: - script: | - sudo apt-get install -y ppa-purge + sudo apt -y remove php* + sudo apt install -y ppa-purge sudo ppa-purge -y ppa:ondrej/php - sudo apt-get install -y libboost-atomic-dev libboost-thread-dev libboost-system-dev libboost-date-time-dev libboost-regex-dev libboost-filesystem-dev libboost-random-dev libboost-chrono-dev libboost-serialization-dev libwebsocketpp-dev openssl libssl-dev ninja-build - displayName: Apt install dependencies - - script: | + unset BOOST_ROOT + sudo apt install -y libboost-atomic-dev libboost-thread-dev libboost-system-dev libboost-date-time-dev libboost-regex-dev libboost-filesystem-dev libboost-random-dev libboost-chrono-dev libboost-serialization-dev libwebsocketpp-dev openssl libssl-dev ninja-build mkdir build.debug - mkdir build.release - displayName: Make Build Directories - - task: CMake@1 - inputs: - workingDirectory: 'build.debug' - cmakeArgs: '-G Ninja -DCMAKE_BUILD_TYPE=Debug ..' - - task: CMake@1 - inputs: - workingDirectory: 'build.release' - cmakeArgs: '-G Ninja -DCMAKE_BUILD_TYPE=Release ..' - - script: | cd build.debug - ninja - displayName: 'Run ninja, debug' - - script: | + /usr/local/bin/cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug .. + cd .. + mkdir build.release + cd build.release + /usr/local/bin/cmake -G Ninja -DCMAKE_BUILD_TYPE=Release .. + cd .. + ninja -C build.debug + ninja -C build.release cd build.debug/Release/Binaries ./test_runner *test.so - displayName: 'Run tests, debug' - - script: | - cd build.release - ninja - displayName: 'Run ninja, release' - - script: | - cd build.release/Release/Binaries + cd ../../../build.release/Release/Binaries ./test_runner *test.so - displayName: 'Run tests, release' + displayName: Run build - job: Ubuntu_1604_Vcpkg pool: vmImage: 'Ubuntu 16.04' steps: - script: | sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y - sudo apt-get -y update - sudo apt-get install g++-7 ninja-build -y + sudo apt -y update + sudo apt install g++-9 ninja-build -y ./vcpkg/bootstrap-vcpkg.sh ./vcpkg/vcpkg install zlib openssl boost-system boost-date-time boost-regex websocketpp boost-thread boost-filesystem boost-random boost-chrono boost-interprocess brotli --vcpkg-root ./vcpkg displayName: Vcpkg install dependencies @@ -234,52 +222,53 @@ export NCPU=2 ../configure.sh --ndk /usr/local/lib/android/sdk/ndk-bundle displayName: 'Build for Android' - - job: MacOS_Homebrew - pool: - vmImage: 'macOS-10.13' - steps: - - script: brew install boost openssl ninja - displayName: Brew install dependencies - - script: | - mkdir build.debug - mkdir build.release - mkdir build.release.static - displayName: Make Build Directories - - task: CMake@1 - inputs: - workingDirectory: 'build.debug' - cmakeArgs: '-G Ninja -DCMAKE_BUILD_TYPE=Debug ..' - - task: CMake@1 - inputs: - workingDirectory: 'build.release' - cmakeArgs: '-G Ninja -DCMAKE_BUILD_TYPE=Release ..' - - task: CMake@1 - inputs: - workingDirectory: 'build.release.static' - cmakeArgs: '-G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF ..' - - script: | - cd build.debug - ninja - displayName: 'Run ninja, debug' - - script: | - cd build.debug/Release/Binaries - ./test_runner *test.dylib - displayName: 'Run tests, debug' - - script: | - cd build.release - ninja - displayName: 'Run ninja, release' - - script: | - cd build.release/Release/Binaries - ./test_runner *test.dylib - displayName: 'Run tests, release' - - script: | - cd build.release.static - ninja - displayName: 'Run ninja, release static' + # Homebrew is disabled for now because it apparently is deploying a Boost version that the version of xcode deployed in Pipelines cannot build. + # - job: MacOS_Homebrew + # pool: + # vmImage: 'macOS-10.14' + # steps: + # - script: brew install boost openssl ninja + # displayName: Brew install dependencies + # - script: | + # mkdir build.debug + # mkdir build.release + # mkdir build.release.static + # displayName: Make Build Directories + # - task: CMake@1 + # inputs: + # workingDirectory: 'build.debug' + # cmakeArgs: '-G Ninja -DCMAKE_BUILD_TYPE=Debug ..' + # - task: CMake@1 + # inputs: + # workingDirectory: 'build.release' + # cmakeArgs: '-G Ninja -DCMAKE_BUILD_TYPE=Release ..' + # - task: CMake@1 + # inputs: + # workingDirectory: 'build.release.static' + # cmakeArgs: '-G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF ..' + # - script: | + # cd build.debug + # ninja + # displayName: 'Run ninja, debug' + # - script: | + # cd build.debug/Release/Binaries + # ./test_runner *test.dylib + # displayName: 'Run tests, debug' + # - script: | + # cd build.release + # ninja + # displayName: 'Run ninja, release' + # - script: | + # cd build.release/Release/Binaries + # ./test_runner *test.dylib + # displayName: 'Run tests, release' + # - script: | + # cd build.release.static + # ninja + # displayName: 'Run ninja, release static' - job: MacOS_Vcpkg pool: - vmImage: 'macOS-10.13' + vmImage: 'macOS-10.14' steps: - script: | brew install gcc ninja @@ -314,11 +303,12 @@ cd build.release/Release/Binaries ./test_runner *test.dylib displayName: 'Run tests, release' - - job: MacOS_iOS - pool: - vmImage: 'macOS-10.13' - steps: - - script: | - cd Build_iOS - ./configure.sh - displayName: 'Build for iOS' + # iOS is disabled for now because the dependency Apple-Boost-BuildScript appears to be broken with the version of XCode in use in Pipelines. + # - job: MacOS_iOS + # pool: + # vmImage: 'macOS-10.14' + # steps: + # - script: | + # cd Build_iOS + # ./configure.sh + # displayName: 'Build for iOS' diff -Nru cpprest-2.10.13/Build_android/configure.sh cpprest-2.10.14/Build_android/configure.sh --- cpprest-2.10.13/Build_android/configure.sh 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Build_android/configure.sh 2019-07-16 19:07:11.000000000 +0000 @@ -92,6 +92,8 @@ # Variables setup +unset BOOST_ROOT + if [ ! -e "${ANDROID_NDK}/ndk-build" ] then echo "ANDROID_NDK does not point to a valid NDK." @@ -153,7 +155,7 @@ if [ "${DO_BOOST}" == "1" ]; then ( if [ ! -d 'Boost-for-Android' ]; then git clone https://github.com/moritz-wundke/Boost-for-Android; fi cd Boost-for-Android - git checkout 1356b87fed389b4abf1ff671adec0b899877174b + git checkout aed656a97fb3af7322fd2c3da5995a2d09d87d4b PATH="$PATH:$NDK_DIR" \ CXXFLAGS="-std=gnu++11" \ ./build-android.sh \ diff -Nru cpprest-2.10.13/Build_iOS/configure.sh cpprest-2.10.14/Build_iOS/configure.sh --- cpprest-2.10.13/Build_iOS/configure.sh 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Build_iOS/configure.sh 2019-07-16 19:07:11.000000000 +0000 @@ -73,8 +73,8 @@ done ## Configuration -DEFAULT_BOOST_VERSION=1.67.0 -DEFAULT_OPENSSL_VERSION=1.0.2o +DEFAULT_BOOST_VERSION=1.69.0 +DEFAULT_OPENSSL_VERSION=1.1.0k BOOST_VERSION=${BOOST_VERSION:-${DEFAULT_BOOST_VERSION}} OPENSSL_VERSION=${OPENSSL_VERSION:-${DEFAULT_OPENSSL_VERSION}} CPPRESTSDK_BUILD_TYPE=${CPPRESTSDK_BUILD_TYPE:-Release} @@ -96,7 +96,7 @@ git clone https://github.com/faithfracture/Apple-Boost-BuildScript ${ABS_PATH}/Apple-Boost-BuildScript fi pushd ${ABS_PATH}/Apple-Boost-BuildScript - git checkout 1b94ec2e2b5af1ee036d9559b96e70c113846392 + git checkout 1ebe6e7654d9c9e1792076ee3827a45d5d2f34c5 BOOST_LIBS="thread chrono filesystem regex system random" ./boost.sh -ios -tvos --boost-version $BOOST_VERSION popd mv ${ABS_PATH}/Apple-Boost-BuildScript/build/boost/${BOOST_VERSION}/ios/framework/boost.framework ${ABS_PATH} diff -Nru cpprest-2.10.13/changelog.md cpprest-2.10.14/changelog.md --- cpprest-2.10.13/changelog.md 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/changelog.md 2019-07-16 19:07:11.000000000 +0000 @@ -1,3 +1,22 @@ +cpprestsdk (2.10.14) +* Potential breaking change warning: This release changes the "default" proxy for the WinHTTP backend to go back to WINHTTP_ACCESS_TYPE_DEFAULT_PROXY. See https://github.com/microsoft/cpprestsdk/commit/60e067e71aebebdda5d82955060f5f0821c9df1d for more details. To get automatic WPAD behavior, set the proxy to auto detect. +* macOS with Brew and iOS builds have been disabled and are no longer being tested because our dependency boost for ios project appears to be broken with current releases of XCode as on the Azure Pipelines machines. We are interested in macOS / iOS folks who know what's going on here in contributing a repair to turn this back on. +* PR##1133 Add switches to make apiscan happy. +* PR##1130 json: {"meow"} is not a valid object +* PR##1150 Undefine compress if it is defined by zconf.h +* PR##1156 Fix broken CI Builds +* PR##1155 Use EVP_MAX_MD_SIZE instead of HMAC_MAX_MD_CBLOCK +* PR##1145 Remove the address_configured flag on tcp::resolver::query +* PR##1143 add ping and pong to message handler +* PR##539 Fix reusing ASIO http_client connecting to HTTPS server via proxy +* PR##1175 Fix issue #1171: Order of object destruction +* PR##1183 FIX: SSL proxy tunnel support with basic auth +* PR##1184 Fix profile being set on the compiler instead of the linker. +* PR##1185 Update boost-for-android for Android NDK r20 and disable macOS Homebrew. +* PR##1187 Replace CPPREST_TARGET_XP with version checks, remove ""s, and other cleanup +* PR##1188 Remove proxy settings detection behavior in "default proxy mode." +-- cpprestsdk team TUE, 16 Jul 2019 09:06:00 +0200 + cpprestsdk (2.10.13) * PR#1120 Fix off by one error in leap years before year 2000, and bad day names * PR#1117 Parse and emit years from 1900 to 9999, and remove environment variable dependence on Android diff -Nru cpprest-2.10.13/CONTRIBUTORS.txt cpprest-2.10.14/CONTRIBUTORS.txt --- cpprest-2.10.13/CONTRIBUTORS.txt 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/CONTRIBUTORS.txt 2019-07-16 19:07:11.000000000 +0000 @@ -54,3 +54,6 @@ Benjamin Lee (mobileben) René Meusel (reneme) + +Sony Corporation +Gareth Sylvester-Bradley (garethsb-sony) diff -Nru cpprest-2.10.13/debian/changelog cpprest-2.10.14/debian/changelog --- cpprest-2.10.13/debian/changelog 2019-07-12 15:40:06.000000000 +0000 +++ cpprest-2.10.14/debian/changelog 2019-07-31 09:20:15.000000000 +0000 @@ -1,8 +1,21 @@ -cpprest (2.10.13-2~ubuntu18.04.1~ppa1) bionic; urgency=medium +cpprest (2.10.14-2~ubuntu18.04.1~ppa1) bionic; urgency=medium * No-change backport to bionic - -- Gianfranco Costamagna Fri, 12 Jul 2019 17:40:06 +0200 + -- Gianfranco Costamagna Wed, 31 Jul 2019 11:20:15 +0200 + +cpprest (2.10.14-2) unstable; urgency=medium + + * Do not error on new gcc-9 build errors. (Closes: #925660) + + -- Gianfranco Costamagna Tue, 23 Jul 2019 09:39:44 +0200 + +cpprest (2.10.14-1) unstable; urgency=medium + + * New upstream version 2.10.14 + * std-version, bump to 4.4.0 + + -- Gianfranco Costamagna Mon, 22 Jul 2019 23:22:01 +0200 cpprest (2.10.13-2) unstable; urgency=medium diff -Nru cpprest-2.10.13/debian/control cpprest-2.10.14/debian/control --- cpprest-2.10.13/debian/control 2019-05-09 11:16:39.000000000 +0000 +++ cpprest-2.10.14/debian/control 2019-07-22 21:21:51.000000000 +0000 @@ -3,7 +3,7 @@ Priority: optional Maintainer: Gianfranco Costamagna Build-Depends: cmake, - debhelper-compat (=12), + debhelper-compat (= 12), libbrotli-dev, libboost-atomic-dev, libboost-chrono-dev, @@ -17,7 +17,7 @@ pkg-config, zlib1g-dev Build-Depends-Indep: doxygen -Standards-Version: 4.3.0 +Standards-Version: 4.4.0 Homepage: https://github.com/Microsoft/cpprestsdk Vcs-Git: https://salsa.debian.org/debian/cpprest.git Vcs-Browser: https://salsa.debian.org/debian/cpprest diff -Nru cpprest-2.10.13/debian/rules cpprest-2.10.14/debian/rules --- cpprest-2.10.13/debian/rules 2019-04-02 09:30:35.000000000 +0000 +++ cpprest-2.10.14/debian/rules 2019-07-23 07:39:44.000000000 +0000 @@ -16,7 +16,7 @@ rm -rf html latex override_dh_auto_configure: - dh_auto_configure -- -DCPPREST_EXPORT_DIR=cmake -DCPPREST_EXCLUDE_BROTLI=OFF + dh_auto_configure -- -DCPPREST_EXPORT_DIR=cmake -DCPPREST_EXCLUDE_BROTLI=OFF -DWERROR=OFF override_dh_auto_build-indep: doxygen Release/public_apis_doxyfile diff -Nru cpprest-2.10.13/.gitignore cpprest-2.10.14/.gitignore --- cpprest-2.10.13/.gitignore 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/.gitignore 2019-07-16 19:07:11.000000000 +0000 @@ -73,3 +73,5 @@ Generated Files/ # Ignore iOS temp build directories Build_iOS/Apple-Boost-BuildScript + +/out/ diff -Nru cpprest-2.10.13/Release/CMakeLists.txt cpprest-2.10.14/Release/CMakeLists.txt --- cpprest-2.10.13/Release/CMakeLists.txt 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/CMakeLists.txt 2019-07-16 19:07:11.000000000 +0000 @@ -11,7 +11,7 @@ set(CPPREST_VERSION_MAJOR 2) set(CPPREST_VERSION_MINOR 10) -set(CPPREST_VERSION_REVISION 13) +set(CPPREST_VERSION_REVISION 14) enable_testing() @@ -182,9 +182,16 @@ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MP") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MP") + set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "${CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL} /profile /OPT:REF /OPT:ICF") + set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /profile /OPT:REF /OPT:ICF") + if (WINDOWS_STORE OR WINDOWS_PHONE) add_compile_options(/ZW) endif() + + if (NOT (MSVC_VERSION LESS 1920)) + add_compile_options(/permissive-) + endif() else() message("-- Unknown compiler, success is doubtful.") message("CMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID}") diff -Nru cpprest-2.10.13/Release/include/cpprest/details/cpprest_compat.h cpprest-2.10.14/Release/include/cpprest/details/cpprest_compat.h --- cpprest-2.10.13/Release/include/cpprest/details/cpprest_compat.h 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/include/cpprest/details/cpprest_compat.h 2019-07-16 19:07:11.000000000 +0000 @@ -24,8 +24,6 @@ #define CPPREST_CONSTEXPR const #endif // _MSC_VER >= 1900 -#define CASABLANCA_UNREFERENCED_PARAMETER(x) (x) - #include #else // ^^^ _WIN32 ^^^ // vvv !_WIN32 vvv @@ -38,7 +36,6 @@ { \ if (!(x)) __builtin_unreachable(); \ } while (false) -#define CASABLANCA_UNREFERENCED_PARAMETER(x) (void)x #define CPPREST_NOEXCEPT noexcept #define CPPREST_CONSTEXPR constexpr diff -Nru cpprest-2.10.13/Release/include/cpprest/details/web_utilities.h cpprest-2.10.14/Release/include/cpprest/details/web_utilities.h --- cpprest-2.10.13/Release/include/cpprest/details/web_utilities.h 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/include/cpprest/details/web_utilities.h 2019-07-16 19:07:11.000000000 +0000 @@ -24,23 +24,24 @@ }; typedef std::unique_ptr<::utility::string_t, zero_memory_deleter> plaintext_string; -#if defined(_WIN32) && !defined(CPPREST_TARGET_XP) -#if defined(__cplusplus_winrt) +#ifdef _WIN32 +#if _WIN32_WINNT >= _WIN32_WINNT_VISTA +#ifdef __cplusplus_winrt class winrt_encryption { public: - winrt_encryption() {} + winrt_encryption() = default; _ASYNCRTIMP winrt_encryption(const std::wstring& data); _ASYNCRTIMP plaintext_string decrypt() const; private: ::pplx::task m_buffer; }; -#else +#else // ^^^ __cplusplus_winrt ^^^ // vvv !__cplusplus_winrt vvv class win32_encryption { public: - win32_encryption() {} + win32_encryption() = default; _ASYNCRTIMP win32_encryption(const std::wstring& data); _ASYNCRTIMP ~win32_encryption(); _ASYNCRTIMP plaintext_string decrypt() const; @@ -49,8 +50,9 @@ std::vector m_buffer; size_t m_numCharacters; }; -#endif -#endif +#endif // __cplusplus_winrt +#endif // _WIN32_WINNT >= _WIN32_WINNT_VISTA +#endif // _WIN32 } // namespace details /// @@ -89,7 +91,7 @@ "This API is deprecated for security reasons to avoid unnecessary password copies stored in plaintext.") utility::string_t password() const { -#if defined(_WIN32) && !defined(CPPREST_TARGET_XP) +#if defined(_WIN32) && _WIN32_WINNT >= _WIN32_WINNT_VISTA return utility::string_t(*m_password.decrypt()); #else return m_password; @@ -105,7 +107,7 @@ details::plaintext_string _internal_decrypt() const { // Encryption APIs not supported on XP -#if defined(_WIN32) && !defined(CPPREST_TARGET_XP) +#if defined(_WIN32) && _WIN32_WINNT >= _WIN32_WINNT_VISTA return m_password.decrypt(); #else return details::plaintext_string(new ::utility::string_t(m_password)); @@ -115,7 +117,7 @@ private: ::utility::string_t m_username; -#if defined(_WIN32) && !defined(CPPREST_TARGET_XP) +#if defined(_WIN32) && _WIN32_WINNT >= _WIN32_WINNT_VISTA #if defined(__cplusplus_winrt) details::winrt_encryption m_password; #else @@ -151,13 +153,13 @@ /// /// Constructs a proxy with the default settings. /// - web_proxy() : m_address(_XPLATSTR("")), m_mode(use_default_) {} + web_proxy() : m_address(), m_mode(use_default_) {} /// /// Creates a proxy with specified mode. /// /// Mode to use. - web_proxy(web_proxy_mode mode) : m_address(_XPLATSTR("")), m_mode(static_cast(mode)) {} + web_proxy(web_proxy_mode mode) : m_address(), m_mode(static_cast(mode)) {} /// /// Creates a proxy explicitly with provided address. diff -Nru cpprest-2.10.13/Release/include/cpprest/http_client.h cpprest-2.10.14/Release/include/cpprest/http_client.h --- cpprest-2.10.13/Release/include/cpprest/http_client.h 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/include/cpprest/http_client.h 2019-07-16 19:07:11.000000000 +0000 @@ -54,7 +54,7 @@ #include #include -#if !defined(CPPREST_TARGET_XP) +#if _WIN32_WINNT >= _WIN32_WINNT_VISTA #include "cpprest/oauth1.h" #endif @@ -110,7 +110,7 @@ { } -#if !defined(CPPREST_TARGET_XP) +#if _WIN32_WINNT >= _WIN32_WINNT_VISTA /// /// Get OAuth 1.0 configuration. /// @@ -363,7 +363,7 @@ #endif private: -#if !defined(CPPREST_TARGET_XP) +#if _WIN32_WINNT >= _WIN32_WINNT_VISTA std::shared_ptr m_oauth1; #endif diff -Nru cpprest-2.10.13/Release/include/cpprest/streams.h cpprest-2.10.14/Release/include/cpprest/streams.h --- cpprest-2.10.13/Release/include/cpprest/streams.h 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/include/cpprest/streams.h 2019-07-16 19:07:11.000000000 +0000 @@ -470,7 +470,7 @@ { \ typedef std::true_type _is_integral; \ typedef std::false_type _is_unsigned; \ - static const int64_t _min = std::numeric_limits<_t>::min(); \ + static const int64_t _min = (std::numeric_limits<_t>::min)(); \ static const int64_t _max = (std::numeric_limits<_t>::max)(); \ }; #define _UINT_TRAIT(_t) \ @@ -528,9 +528,12 @@ public: static pplx::task parse(streams::streambuf buffer) { - typename _type_parser_integral_traits::_is_integral ii; - typename _type_parser_integral_traits::_is_unsigned ui; - return _parse(buffer, ii, ui); + typedef typename _type_parser_integral_traits::_is_integral ii; + typedef typename _type_parser_integral_traits::_is_unsigned ui; + + static_assert(ii::value || !ui::value, "type is not supported for extraction from a stream"); + + return _parse(buffer, ii {}, ui {}); } private: @@ -539,15 +542,6 @@ _parse_floating_point(buffer); } - static pplx::task _parse(streams::streambuf, std::false_type, std::true_type) - { -#ifdef _WIN32 - static_assert(false, "type is not supported for extraction from a stream"); -#else - throw std::runtime_error("type is not supported for extraction from a stream"); -#endif - } - static pplx::task _parse(streams::streambuf buffer, std::true_type, std::false_type) { return type_parser::parse(buffer).then([](pplx::task op) -> T { @@ -1145,8 +1139,8 @@ auto update = [=](pplx::task op) -> pplx::task { int_type ch = op.get(); if (ch == traits::eof()) return pplx::task_from_result(false); - bool accptd = accept_character(state, ch); - if (!accptd) return pplx::task_from_result(false); + bool accepted = accept_character(state, ch); + if (!accepted) return pplx::task_from_result(false); // We peeked earlier, so now we must advance the position. concurrency::streams::streambuf buf = buffer; return buf.bumpc().then([](int_type) { return true; }); @@ -1314,9 +1308,18 @@ template static std::string create_exception_message(int_type ch, bool exponent) { - std::ostringstream os; - os << "Invalid character '" << char(ch) << "'" << (exponent ? " in exponent" : ""); - return os.str(); + std::string result; + if (exponent) + { + result.assign("Invalid character 'X' in exponent"); + } + else + { + result.assign("Invalid character 'X'"); + } + + result[19] = static_cast(ch); + return result; } template diff -Nru cpprest-2.10.13/Release/include/cpprest/version.h cpprest-2.10.14/Release/include/cpprest/version.h --- cpprest-2.10.13/Release/include/cpprest/version.h 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/include/cpprest/version.h 2019-07-16 19:07:11.000000000 +0000 @@ -5,6 +5,6 @@ */ #define CPPREST_VERSION_MINOR 10 #define CPPREST_VERSION_MAJOR 2 -#define CPPREST_VERSION_REVISION 13 +#define CPPREST_VERSION_REVISION 14 #define CPPREST_VERSION (CPPREST_VERSION_MAJOR * 100000 + CPPREST_VERSION_MINOR * 100 + CPPREST_VERSION_REVISION) diff -Nru cpprest-2.10.13/Release/include/cpprest/ws_client.h cpprest-2.10.14/Release/include/cpprest/ws_client.h --- cpprest-2.10.13/Release/include/cpprest/ws_client.h 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/include/cpprest/ws_client.h 2019-07-16 19:07:11.000000000 +0000 @@ -330,8 +330,7 @@ virtual pplx::task close() = 0; - virtual pplx::task close(websocket_close_status close_status, - const utility::string_t& close_reason = _XPLATSTR("")) = 0; + virtual pplx::task close(websocket_close_status close_status, const utility::string_t& close_reason = {}) = 0; virtual void set_close_handler( const std::function& @@ -478,7 +477,7 @@ /// frame. While closing an established connection, an endpoint may indicate the /// reason for closure. An asynchronous operation that is completed the connection has been /// successfully closed. - pplx::task close(websocket_close_status close_status, const utility::string_t& close_reason = _XPLATSTR("")) + pplx::task close(websocket_close_status close_status, const utility::string_t& close_reason = {}) { return m_client->callback_client()->close(close_status, close_reason); } @@ -566,7 +565,7 @@ /// frame. While closing an established connection, an endpoint may indicate the /// reason for closure. An asynchronous operation that is completed the connection has been /// successfully closed. - pplx::task close(websocket_close_status close_status, const utility::string_t& close_reason = _XPLATSTR("")) + pplx::task close(websocket_close_status close_status, const utility::string_t& close_reason = {}) { return m_client->close(close_status, close_reason); } diff -Nru cpprest-2.10.13/Release/include/cpprest/ws_msg.h cpprest-2.10.14/Release/include/cpprest/ws_msg.h --- cpprest-2.10.13/Release/include/cpprest/ws_msg.h 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/include/cpprest/ws_msg.h 2019-07-16 19:07:11.000000000 +0000 @@ -60,10 +60,23 @@ public: #if !defined(__cplusplus_winrt) /// - /// Sets a the outgoing message to be an unsolicited pong message. + /// Sets the outgoing message to be a ping message. /// This is useful when the client side wants to check whether the server is alive. /// - void set_pong_message() { this->set_message_pong(); } + /// UTF-8 String containing the optional ping message. + void set_ping_message(const std::string& data = {}) + { + this->set_message_ping(concurrency::streams::container_buffer(data)); + } + + /// + /// Sets the outgoing message to be an unsolicited pong message. + /// + /// UTF-8 String containing the optional pong message. + void set_pong_message(const std::string& data = {}) + { + this->set_message_pong(concurrency::streams::container_buffer(data)); + } #endif /// @@ -140,9 +153,14 @@ const pplx::task_completion_event& body_sent() const { return m_body_sent; } #if !defined(__cplusplus_winrt) - void set_message_pong() + void set_message_ping(const concurrency::streams::container_buffer& buffer) + { + m_msg_type = websocket_message_type::ping; + m_length = static_cast(buffer.size()); + m_body = buffer; + } + void set_message_pong(const concurrency::streams::container_buffer& buffer) { - concurrency::streams::container_buffer buffer(""); m_msg_type = websocket_message_type::pong; m_length = static_cast(buffer.size()); m_body = buffer; diff -Nru cpprest-2.10.13/Release/include/pplx/pplxtasks.h cpprest-2.10.14/Release/include/pplx/pplxtasks.h --- cpprest-2.10.13/Release/include/pplx/pplxtasks.h 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/include/pplx/pplxtasks.h 2019-07-16 19:07:11.000000000 +0000 @@ -3799,7 +3799,7 @@ auto _LogWorkItemAndInvokeUserLambda(_Func&& _func) const -> decltype(_func()) { details::_TaskWorkItemRAIILogger _LogWorkItem(this->_M_pTask->_M_taskEventLogger); - CASABLANCA_UNREFERENCED_PARAMETER(_LogWorkItem); + (void)_LogWorkItem; return _func(); } @@ -3931,7 +3931,7 @@ -> decltype(_func(std::forward<_Arg>(_value))) { details::_TaskWorkItemRAIILogger _LogWorkItem(this->_M_pTask->_M_taskEventLogger); - CASABLANCA_UNREFERENCED_PARAMETER(_LogWorkItem); + (void)_LogWorkItem; return _func(std::forward<_Arg>(_value)); } diff -Nru cpprest-2.10.13/Release/samples/BlackJack/BlackJack_Client/BlackJackClient.cpp cpprest-2.10.14/Release/samples/BlackJack/BlackJack_Client/BlackJackClient.cpp --- cpprest-2.10.13/Release/samples/BlackJack/BlackJack_Client/BlackJackClient.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/samples/BlackJack/BlackJack_Client/BlackJackClient.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -17,7 +17,6 @@ #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif -#define NOMINMAX #include #include diff -Nru cpprest-2.10.13/Release/samples/BlackJack/BlackJack_Server/messagetypes.h cpprest-2.10.14/Release/samples/BlackJack/BlackJack_Server/messagetypes.h --- cpprest-2.10.13/Release/samples/BlackJack/BlackJack_Server/messagetypes.h 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/samples/BlackJack/BlackJack_Server/messagetypes.h 2019-07-16 19:07:11.000000000 +0000 @@ -179,7 +179,7 @@ { if (iter->value == CV_Ace) hasAces = true; - res.low += std::min((int)iter->value, 10); + res.low += (std::min)((int)iter->value, 10); } res.high = hasAces ? res.low + 10 : res.low; return res; @@ -271,7 +271,7 @@ static Player FromJSON(const web::json::object& object) { - Player result(U("")); + Player result(utility::string_t{}); auto iName = object.find(NAME); if (iName == object.end()) diff -Nru cpprest-2.10.13/Release/samples/BlackJack/BlackJack_Server/stdafx.h cpprest-2.10.14/Release/samples/BlackJack/BlackJack_Server/stdafx.h --- cpprest-2.10.13/Release/samples/BlackJack/BlackJack_Server/stdafx.h 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/samples/BlackJack/BlackJack_Server/stdafx.h 2019-07-16 19:07:11.000000000 +0000 @@ -26,9 +26,6 @@ #include #ifdef _WIN32 -#ifndef NOMINMAX -#define NOMINMAX -#endif #include #else #include diff -Nru cpprest-2.10.13/Release/samples/BlackJack/BlackJack_UIClient/Player.xaml.cpp cpprest-2.10.14/Release/samples/BlackJack/BlackJack_UIClient/Player.xaml.cpp --- cpprest-2.10.13/Release/samples/BlackJack/BlackJack_UIClient/Player.xaml.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/samples/BlackJack/BlackJack_UIClient/Player.xaml.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -54,7 +54,13 @@ playerName->Text = ref new Platform::String(web::uri::decode(player.Name).c_str()); playerBalance->Text = "$" + player.Balance.ToString(); playerBet->Text = "Bet: $" + player.Hand.bet.ToString(); - playerInsurance->Text = (player.Hand.insurance > 0) ? "Ins: $" + player.Hand.insurance.ToString() : ""; + if (player.Hand.insurance > 0) { + auto& text = playerInsurance->Text; + text.assign("Ins: $"); + text.append(std::to_string(player.Hand.insurance)); + } else { + text.clear(); + } } void PlayerSpace::AddCard(Card card) @@ -87,19 +93,19 @@ { case BJHandResult::HR_ComputerWin: playerInsurance->Text = L"Dealer Wins"; - playerBet->Text = L""; + playerBet->Text.clear(); break; case BJHandResult::HR_PlayerWin: playerInsurance->Text = L"Player Wins"; - playerBet->Text = L""; + playerBet->Text.clear(); break; case BJHandResult::HR_Push: playerInsurance->Text = L"Push"; - playerBet->Text = L""; + playerBet->Text.clear(); break; case BJHandResult::HR_PlayerBlackJack: playerInsurance->Text = L"Blackjack!"; - playerBet->Text = L""; + playerBet->Text.clear(); break; default: break; } diff -Nru cpprest-2.10.13/Release/samples/BlackJack/BlackJack_UIClient/Player.xaml.h cpprest-2.10.14/Release/samples/BlackJack/BlackJack_UIClient/Player.xaml.h --- cpprest-2.10.13/Release/samples/BlackJack/BlackJack_UIClient/Player.xaml.h 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/samples/BlackJack/BlackJack_UIClient/Player.xaml.h 2019-07-16 19:07:11.000000000 +0000 @@ -25,10 +25,10 @@ void Clear() { - playerBalance->Text = L""; - playerBet->Text = L""; - playerName->Text = L""; - playerInsurance->Text = L""; + playerBalance->Text.clear(); + playerBet->Text.clear(); + playerName->Text.clear(); + playerInsurance->Text.clear(); m_cards.clear(); playerCardGrid->Children->Clear(); } diff -Nru cpprest-2.10.13/Release/samples/BlackJack/BlackJack_UIClient/PlayingTable.xaml.cpp cpprest-2.10.14/Release/samples/BlackJack/BlackJack_UIClient/PlayingTable.xaml.cpp --- cpprest-2.10.13/Release/samples/BlackJack/BlackJack_UIClient/PlayingTable.xaml.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/samples/BlackJack/BlackJack_UIClient/PlayingTable.xaml.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -116,7 +116,7 @@ request.then( [this](pplx::task tsk) { - this->resultLabel->Text = L""; + this->resultLabel->Text.clear(); try { @@ -137,7 +137,7 @@ { if (response.headers().content_type() != L"application/json") return; - this->resultLabel->Text = L""; + this->resultLabel->Text.clear(); response.extract_json().then( [this, response](json::value jsonResponse) { @@ -265,7 +265,7 @@ request.then( [this](pplx::task tsk) { - this->resultLabel->Text = L""; + this->resultLabel->Text.clear(); try { @@ -307,7 +307,7 @@ request.then( [this](pplx::task tsk) { - this->resultLabel->Text = L""; + this->resultLabel->Text.clear(); try { @@ -343,7 +343,7 @@ request.then( [this](pplx::task tsk) { - this->resultLabel->Text = L""; + this->resultLabel->Text.clear(); try { @@ -378,7 +378,7 @@ request.then( [this](pplx::task tsk) { - this->resultLabel->Text = L""; + this->resultLabel->Text.clear(); try { @@ -412,7 +412,7 @@ request.then( [this](pplx::task tsk) { - this->resultLabel->Text = L""; + this->resultLabel->Text.clear(); try { @@ -449,7 +449,7 @@ [this](pplx::task tsk) { EnableExit(); - this->resultLabel->Text = L""; + this->resultLabel->Text.clear(); try { @@ -499,7 +499,7 @@ [this](pplx::task tsk) { EnableExit(); - this->resultLabel->Text = L""; + this->resultLabel->Text.clear(); try { @@ -516,7 +516,7 @@ { InterpretError(exc.error_code().value()); EnableConnecting(); - _tableId = L""; + _tableId.clear(); } }, ctx); @@ -551,7 +551,7 @@ this->resultLabel->Text = L"Thanks for playing!"; - _tableId = L""; + _tableId.clear(); } catch (const http_exception& exc) { diff -Nru cpprest-2.10.13/Release/samples/BlackJack/BlackJack_UIClient/PlayingTable.xaml.h cpprest-2.10.14/Release/samples/BlackJack/BlackJack_UIClient/PlayingTable.xaml.h --- cpprest-2.10.13/Release/samples/BlackJack/BlackJack_UIClient/PlayingTable.xaml.h 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/samples/BlackJack/BlackJack_UIClient/PlayingTable.xaml.h 2019-07-16 19:07:11.000000000 +0000 @@ -93,7 +93,7 @@ { ClearDealerCards(); ClearPlayerCards(); - resultLabel->Text = ""; + resultLabel->Text.clear(); } void EnableBetting() diff -Nru cpprest-2.10.13/Release/samples/CasaLens/casalens.cpp cpprest-2.10.14/Release/samples/CasaLens/casalens.cpp --- cpprest-2.10.13/Release/samples/CasaLens/casalens.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/samples/CasaLens/casalens.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -30,13 +30,13 @@ // FILL IN THE API KEYS FOR THE DIFFERENT SERVICES HERE. // Refer Readme.txt for details on how to obtain the key for the services. const utility::string_t casalens_creds::events_keyname = U("app_key"); -const utility::string_t casalens_creds::events_key = U(""); +const utility::string_t casalens_creds::events_key; const utility::string_t casalens_creds::movies_keyname = U("api_key"); -const utility::string_t casalens_creds::movies_key = U(""); +const utility::string_t casalens_creds::movies_key; const utility::string_t casalens_creds::images_keyname = U("username"); -const utility::string_t casalens_creds::images_key = U(""); +const utility::string_t casalens_creds::images_key; const utility::string_t casalens_creds::bmaps_keyname = U("key"); -const utility::string_t casalens_creds::bmaps_key = U(""); +const utility::string_t casalens_creds::bmaps_key; const utility::string_t CasaLens::events_json_key = U("events"); const utility::string_t CasaLens::movies_json_key = U("movies"); diff -Nru cpprest-2.10.13/Release/samples/Oauth1Client/Oauth1Client.cpp cpprest-2.10.14/Release/samples/Oauth1Client/Oauth1Client.cpp --- cpprest-2.10.13/Release/samples/Oauth1Client/Oauth1Client.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/samples/Oauth1Client/Oauth1Client.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -49,11 +49,11 @@ // // Set key & secret pair to enable session for that service. // -static const utility::string_t s_linkedin_key(U("")); -static const utility::string_t s_linkedin_secret(U("")); +static const utility::string_t s_linkedin_key; +static const utility::string_t s_linkedin_secret; -static const utility::string_t s_twitter_key(U("")); -static const utility::string_t s_twitter_secret(U("")); +static const utility::string_t s_twitter_key; +static const utility::string_t s_twitter_secret; // // Utility method to open browser on Windows, OS X and Linux systems. diff -Nru cpprest-2.10.13/Release/samples/Oauth2Client/Oauth2Client.cpp cpprest-2.10.14/Release/samples/Oauth2Client/Oauth2Client.cpp --- cpprest-2.10.13/Release/samples/Oauth2Client/Oauth2Client.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/samples/Oauth2Client/Oauth2Client.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -49,14 +49,14 @@ // // Set key & secret pair to enable session for that service. // -static const utility::string_t s_dropbox_key(U("")); -static const utility::string_t s_dropbox_secret(U("")); +static const utility::string_t s_dropbox_key; +static const utility::string_t s_dropbox_secret; -static const utility::string_t s_linkedin_key(U("")); -static const utility::string_t s_linkedin_secret(U("")); +static const utility::string_t s_linkedin_key; +static const utility::string_t s_linkedin_secret; -static const utility::string_t s_live_key(U("")); -static const utility::string_t s_live_secret(U("")); +static const utility::string_t s_live_key; +static const utility::string_t s_live_secret; // // Utility method to open browser on Windows, OS X and Linux systems. @@ -89,7 +89,7 @@ : m_listener(new http_listener(listen_uri)), m_config(config) { m_listener->support([this](http::http_request request) -> void { - if (request.request_uri().path() == U("/") && request.request_uri().query() != U("")) + if (request.request_uri().path() == U("/") && !request.request_uri().query().empty()) { m_resplock.lock(); diff -Nru cpprest-2.10.13/Release/samples/OAuth2Live/MainPage.xaml.cpp cpprest-2.10.14/Release/samples/OAuth2Live/MainPage.xaml.cpp --- cpprest-2.10.13/Release/samples/OAuth2Live/MainPage.xaml.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/samples/OAuth2Live/MainPage.xaml.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -29,8 +29,8 @@ // // NOTE: You must set this Live key and secret for app to work. // -static const utility::string_t s_live_key(U("")); -static const utility::string_t s_live_secret(U("")); +static const utility::string_t s_live_key; +static const utility::string_t s_live_secret; MainPage::MainPage() : m_live_oauth2_config(s_live_key, @@ -69,7 +69,7 @@ // Start over, clear tokens and button state. m_live_oauth2_config.set_token(oauth2_token()); - AccessToken->Text = ""; + AccessToken->Text.clear(); _UpdateButtonState(); String ^ authURI = ref new String(m_live_oauth2_config.build_authorization_uri(true).c_str()); diff -Nru cpprest-2.10.13/Release/samples/WindowsLiveAuth/live_connect.h cpprest-2.10.14/Release/samples/WindowsLiveAuth/live_connect.h --- cpprest-2.10.13/Release/samples/WindowsLiveAuth/live_connect.h 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/samples/WindowsLiveAuth/live_connect.h 2019-07-16 19:07:11.000000000 +0000 @@ -338,7 +338,7 @@ web::http::http_request req(web::http::methods::PUT); req.set_request_uri(bldr.to_string()); - req.set_body(stream, content_length, U("")); + req.set_body(stream, content_length, utility::string_t{}); return _make_request(req).then([](web::http::http_response response) { return _json_extract(response); }); } @@ -368,7 +368,7 @@ web::http::http_request req(web::http::methods::PUT); req.set_request_uri(bldr.to_string()); - req.set_body(stream, size, U("")); + req.set_body(stream, size, utility::string_t{}); return _make_request(req) .then([](web::http::http_response response) { return response.content_ready(); }) diff -Nru cpprest-2.10.13/Release/src/http/client/http_client_asio.cpp cpprest-2.10.14/Release/src/http/client/http_client_asio.cpp --- cpprest-2.10.13/Release/src/http/client/http_client_asio.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/src/http/client/http_client_asio.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -87,8 +87,7 @@ { const std::string CRLF("\r\n"); -std::string calc_cn_host(const web::http::uri& baseUri, - const web::http::http_headers& requestHeaders) +std::string calc_cn_host(const web::http::uri& baseUri, const web::http::http_headers& requestHeaders) { std::string result; if (baseUri.scheme() == U("https")) @@ -570,7 +569,7 @@ if (m_context->m_http_client->client_config().proxy().credentials().is_set()) { - request_stream << m_context->generate_basic_proxy_auth_header() << CRLF; + request_stream << m_context->generate_basic_proxy_auth_header(); } request_stream << CRLF; @@ -905,7 +904,9 @@ } }; - if (proxy_type == http_proxy_type::ssl_tunnel) + // Note that we must not try to CONNECT using an already established connection via proxy -- this would send + // CONNECT to the end server which is definitely not what we want. + if (proxy_type == http_proxy_type::ssl_tunnel && !m_connection->is_reused()) { // The ssl_tunnel_proxy keeps the context alive and then calls back once the ssl tunnel is established via // 'start_http_request_flow' @@ -1233,8 +1234,8 @@ } const auto this_request = shared_from_this(); - const auto readSize = static_cast( - std::min(static_cast(m_http_client->client_config().chunksize()), m_content_length - m_uploaded)); + const auto readSize = static_cast((std::min)( + static_cast(m_http_client->client_config().chunksize()), m_content_length - m_uploaded)); auto readbuf = _get_readbuffer(); readbuf.getn(boost::asio::buffer_cast(m_body_buf.prepare(readSize)), readSize) .then([this_request AND_CAPTURE_MEMBER_FUNCTION_POINTERS](pplx::task op) { @@ -1486,8 +1487,8 @@ if (!needChunked) { async_read_until_buffersize( - static_cast( - std::min(m_content_length, static_cast(m_http_client->client_config().chunksize()))), + static_cast((std::min)(m_content_length, + static_cast(m_http_client->client_config().chunksize()))), boost::bind( &asio_context::handle_read_content, shared_from_this(), boost::asio::placeholders::error)); } @@ -1571,7 +1572,7 @@ { if (inbytes) { - output.resize(output.size() + std::max(input_size, static_cast(1024))); + output.resize(output.size() + (std::max)(input_size, static_cast(1024))); } got = m_decompressor->decompress(input + inbytes, input_size - inbytes, @@ -1709,7 +1710,7 @@ if (ec) { - if (ec == boost::asio::error::eof && m_content_length == std::numeric_limits::max()) + if (ec == boost::asio::error::eof && m_content_length == (std::numeric_limits::max)()) { m_content_length = m_downloaded + m_body_buf.size(); } @@ -1741,7 +1742,7 @@ const auto this_request = shared_from_this(); auto read_size = static_cast( - std::min(static_cast(m_body_buf.size()), m_content_length - m_downloaded)); + (std::min)(static_cast(m_body_buf.size()), m_content_length - m_downloaded)); if (m_decompressor) { @@ -1764,7 +1765,7 @@ this_request->m_downloaded += static_cast(read_size); this_request->async_read_until_buffersize( - static_cast(std::min( + static_cast((std::min)( static_cast(this_request->m_http_client->client_config().chunksize()), this_request->m_content_length - this_request->m_downloaded)), boost::bind( @@ -1793,7 +1794,7 @@ this_request->m_downloaded += static_cast(read_size); this_request->m_body_buf.consume(read_size); this_request->async_read_until_buffersize( - static_cast(std::min( + static_cast((std::min)( static_cast(this_request->m_http_client->client_config().chunksize()), this_request->m_content_length - this_request->m_downloaded)), boost::bind(&asio_context::handle_read_content, @@ -1819,7 +1820,7 @@ this_request->m_downloaded += static_cast(writtenSize); this_request->m_body_buf.consume(writtenSize); this_request->async_read_until_buffersize( - static_cast(std::min( + static_cast((std::min)( static_cast(this_request->m_http_client->client_config().chunksize()), this_request->m_content_length - this_request->m_downloaded)), boost::bind(&asio_context::handle_read_content, diff -Nru cpprest-2.10.13/Release/src/http/client/http_client.cpp cpprest-2.10.14/Release/src/http/client/http_client.cpp --- cpprest-2.10.13/Release/src/http/client/http_client.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/src/http/client/http_client.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -386,7 +386,7 @@ m_pipeline = std::make_shared(std::move(final_pipeline_stage)); -#if !defined(CPPREST_TARGET_XP) +#if _WIN32_WINNT >= _WIN32_WINNT_VISTA add_handler(std::static_pointer_cast( std::make_shared(client_config.oauth1()))); #endif diff -Nru cpprest-2.10.13/Release/src/http/client/http_client_winhttp.cpp cpprest-2.10.14/Release/src/http/client/http_client_winhttp.cpp --- cpprest-2.10.13/Release/src/http/client/http_client_winhttp.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/src/http/client/http_client_winhttp.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -20,7 +20,7 @@ #include #include -#ifndef CPPREST_TARGET_XP +#if _WIN32_WINNT >= _WIN32_WINNT_VISTA #include #endif @@ -102,13 +102,46 @@ // Helper function to trim leading and trailing null characters from a string. static void trim_nulls(utility::string_t& str) { - size_t index; - for (index = 0; index < str.size() && str[index] == 0; ++index) - ; - str.erase(0, index); - for (index = str.size(); index > 0 && str[index - 1] == 0; --index) - ; - str.erase(index); + if (str.empty()) + { + return; + } + + auto first = str.begin(); + auto last = str.end(); + + if (*first) + { + --last; + if (*last) + { + // no nulls to remove + return; + } + + // nulls at the back to remove + do + { + --last; + } while (*last == utility::char_t {}); + ++last; + str.erase(last, str.end()); + return; + } + + // nulls at the front, and maybe the back, to remove + first = std::find_if(str.begin(), last, [](const utility::char_t c) { return c != utility::char_t {}; }); + + if (first != last) + { + do + { + --last; + } while (*last == utility::char_t {}); + ++last; + } + + str.assign(first, last); } // Helper function to get the reason phrase from a WinHTTP response. @@ -210,6 +243,24 @@ transfer_encoding_chunked }; +static DWORD WinHttpDefaultProxyConstant() CPPREST_NOEXCEPT +{ +#if _WIN32_WINNT >= _WIN32_WINNT_VISTA +#if _WIN32_WINNT < _WIN32_WINNT_WINBLUE + if (!IsWindows8Point1OrGreater()) + { + // Not Windows 8.1 or later, use the default proxy setting + return WINHTTP_ACCESS_TYPE_DEFAULT_PROXY; + } +#endif // _WIN32_WINNT < _WIN32_WINNT_WINBLUE + + // Windows 8.1 or later, use the automatic proxy setting + return WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY; +#else // ^^^ _WIN32_WINNT >= _WIN32_WINNT_VISTA ^^^ // vvv _WIN32_WINNT < _WIN32_WINNT_VISTA vvv + return WINHTTP_ACCESS_TYPE_DEFAULT_PROXY; +#endif // _WIN32_WINNT >= _WIN32_WINNT_VISTA +} + // Additional information necessary to track a WinHTTP request. class winhttp_request_context final : public request_context { @@ -245,7 +296,7 @@ HINTERNET m_request_handle; std::weak_ptr* - m_request_handle_context; // owned by m_request_handle to be delete'd by WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING + m_request_handle_context; // owned by m_request_handle to be deleted by WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING bool m_proxy_authentication_tried; bool m_server_authentication_tried; @@ -464,7 +515,7 @@ if (m_bytes_remaining) { // We're at the offset of a chunk of consumable data; let the caller process it - l = std::min(m_bytes_remaining, buffer_size - n); + l = (std::min)(m_bytes_remaining, buffer_size - n); m_bytes_remaining -= l; if (!m_bytes_remaining) { @@ -785,38 +836,30 @@ ie_proxy_config proxyIE; DWORD access_type; - LPCWSTR proxy_name; + LPCWSTR proxy_name = WINHTTP_NO_PROXY_NAME; LPCWSTR proxy_bypass = WINHTTP_NO_PROXY_BYPASS; + m_proxy_auto_config = false; utility::string_t proxy_str; http::uri uri; const auto& config = client_config(); - - if (config.proxy().is_disabled()) + const auto& proxy = config.proxy(); + if (proxy.is_default()) + { + access_type = WinHttpDefaultProxyConstant(); + } + else if (proxy.is_disabled()) { access_type = WINHTTP_ACCESS_TYPE_NO_PROXY; - proxy_name = WINHTTP_NO_PROXY_NAME; } - else if (config.proxy().is_default() || config.proxy().is_auto_discovery()) + else if (proxy.is_auto_discovery()) { - // Use the default WinHTTP proxy by default. - access_type = WINHTTP_ACCESS_TYPE_DEFAULT_PROXY; - proxy_name = WINHTTP_NO_PROXY_NAME; - -#ifdef CPPREST_TARGET_XP - if (config.proxy().is_auto_discovery()) + access_type = WinHttpDefaultProxyConstant(); + if (access_type != WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY) { + // Windows 8 or earlier, do proxy autodetection ourselves m_proxy_auto_config = true; - } -#else // ^^^ CPPREST_TARGET_XP ^^^ // vvv !CPPREST_TARGET_XP vvv - if (IsWindows8Point1OrGreater()) - { - // Windows 8.1 and newer supports automatic proxy discovery and auto-fallback to IE proxy settings - access_type = WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY; - } - else - { - // However, if it is not configured... + proxy_info proxyDefault; if (!WinHttpGetDefaultProxyConfiguration(&proxyDefault) || proxyDefault.dwAccessType == WINHTTP_ACCESS_TYPE_NO_PROXY) @@ -848,13 +891,7 @@ } } } - - if (config.proxy().is_auto_discovery()) - { - m_proxy_auto_config = true; - } } -#endif // CPPREST_TARGET_XP } else { @@ -908,7 +945,7 @@ } // Enable TLS 1.1 and 1.2 -#if !defined(CPPREST_TARGET_XP) +#if _WIN32_WINNT >= _WIN32_WINNT_VISTA BOOL win32_result(FALSE); DWORD secure_protocols(WINHTTP_FLAG_SECURE_PROTOCOL_SSL3 | WINHTTP_FLAG_SECURE_PROTOCOL_TLS1 | @@ -974,9 +1011,7 @@ if (m_proxy_auto_config) { - WINHTTP_AUTOPROXY_OPTIONS autoproxy_options; - memset(&autoproxy_options, 0, sizeof(WINHTTP_AUTOPROXY_OPTIONS)); - + WINHTTP_AUTOPROXY_OPTIONS autoproxy_options {}; if (m_proxy_auto_config_url.empty()) { autoproxy_options.dwFlags = WINHTTP_AUTOPROXY_AUTO_DETECT; @@ -1074,11 +1109,11 @@ if (client_config().validate_certificates()) { // if we are validating certificates, also turn on revocation checking - DWORD dwEnableSSLRevocOpt = WINHTTP_ENABLE_SSL_REVOCATION; + DWORD dwEnableSSLRevocationOpt = WINHTTP_ENABLE_SSL_REVOCATION; if (!WinHttpSetOption(winhttp_context->m_request_handle, WINHTTP_OPTION_ENABLE_FEATURE, - &dwEnableSSLRevocOpt, - sizeof(dwEnableSSLRevocOpt))) + &dwEnableSSLRevocationOpt, + sizeof(dwEnableSSLRevocationOpt))) { auto errorCode = GetLastError(); request->report_error(errorCode, build_error_msg(errorCode, "Error enabling SSL revocation check")); @@ -1134,7 +1169,7 @@ } // There is a request body that needs to be transferred. - if (content_length == std::numeric_limits::max()) + if (content_length == (std::numeric_limits::max)()) { // The content length is not set and the application set a stream. This is an // indication that we will use transfer encoding chunked. We still want to @@ -1315,11 +1350,11 @@ chunk_size = p_request_context->m_body_data.size() - http::details::chunked_encoding::additional_encoding_space; } - else if (p_request_context->m_remaining_to_write != std::numeric_limits::max()) + else if (p_request_context->m_remaining_to_write != (std::numeric_limits::max)()) { // Choose a semi-intelligent size based on how much total data is left to compress - chunk_size = std::min(static_cast(p_request_context->m_remaining_to_write) + 128, - p_request_context->m_http_client->client_config().chunksize()); + chunk_size = (std::min)(static_cast(p_request_context->m_remaining_to_write) + 128, + p_request_context->m_http_client->client_config().chunksize()); } else { @@ -1331,8 +1366,8 @@ { // We're not compressing; use the smaller of the remaining data (if known) and the configured (or default) // chunk size - chunk_size = std::min(static_cast(p_request_context->m_remaining_to_write), - p_request_context->m_http_client->client_config().chunksize()); + chunk_size = (std::min)(static_cast(p_request_context->m_remaining_to_write), + p_request_context->m_http_client->client_config().chunksize()); } p_request_context->allocate_request_space( nullptr, chunk_size + http::details::chunked_encoding::additional_encoding_space); @@ -1370,7 +1405,7 @@ chunk_size + http::details::chunked_encoding::additional_encoding_space, bytes_read); - if (!compressor && p_request_context->m_remaining_to_write != std::numeric_limits::max()) + if (!compressor && p_request_context->m_remaining_to_write != (std::numeric_limits::max)()) { if (bytes_read == 0 && p_request_context->m_remaining_to_write) { @@ -1465,7 +1500,7 @@ p_request_context->m_compression_state.m_bytes_read) { if (p_request_context->m_remaining_to_write && - p_request_context->m_remaining_to_write != std::numeric_limits::max()) + p_request_context->m_remaining_to_write != (std::numeric_limits::max)()) { // The stream ended earlier than we detected it should return pplx::task_from_exception(http_exception( @@ -1518,7 +1553,7 @@ p_request_context->m_compression_state.m_bytes_processed += r.input_bytes_processed; _ASSERTE(p_request_context->m_compression_state.m_bytes_processed <= p_request_context->m_compression_state.m_bytes_read); - if (p_request_context->m_remaining_to_write != std::numeric_limits::max()) + if (p_request_context->m_remaining_to_write != (std::numeric_limits::max)()) { _ASSERTE(p_request_context->m_remaining_to_write >= r.input_bytes_processed); p_request_context->m_remaining_to_write -= r.input_bytes_processed; @@ -1568,7 +1603,7 @@ return; } else if (p_request_context->m_remaining_to_write && - p_request_context->m_remaining_to_write != std::numeric_limits::max()) + p_request_context->m_remaining_to_write != (std::numeric_limits::max)()) { // Unexpected end-of-stream. p_request_context->report_error(GetLastError(), @@ -1586,8 +1621,8 @@ } else { - length = std::min(static_cast(p_request_context->m_remaining_to_write), - p_request_context->m_http_client->client_config().chunksize()); + length = (std::min)(static_cast(p_request_context->m_remaining_to_write), + p_request_context->m_http_client->client_config().chunksize()); if (p_request_context->m_compression_state.m_buffer.capacity() < length) { p_request_context->m_compression_state.m_buffer.reserve(length); @@ -1842,7 +1877,7 @@ if (content_length > 0) { // There is a request body that needs to be transferred. - if (content_length == std::numeric_limits::max()) + if (content_length == (std::numeric_limits::max)()) { // The content length is unknown and the application set a stream. This is an // indication that we will need to chunk the data. @@ -1873,7 +1908,7 @@ static void CALLBACK completion_callback( HINTERNET hRequestHandle, DWORD_PTR context, DWORD statusCode, _In_ void* statusInfo, DWORD statusInfoLength) { - CASABLANCA_UNREFERENCED_PARAMETER(statusInfoLength); + (void)statusInfoLength; std::weak_ptr* p_weak_request_context = reinterpret_cast*>(context); @@ -2208,8 +2243,8 @@ if (p_request_context->m_decompressor) { - size_t chunk_size = std::max(static_cast(bytesRead), - p_request_context->m_http_client->client_config().chunksize()); + size_t chunk_size = (std::max)(static_cast(bytesRead), + p_request_context->m_http_client->client_config().chunksize()); p_request_context->m_compression_state.m_bytes_read = static_cast(bytesRead); p_request_context->m_compression_state.m_chunk_bytes = 0; @@ -2396,24 +2431,23 @@ return keep_going(p_request_context.get()); }); }); - }) - .then([p_request_context](pplx::task op) { - try - { - bool ignored = op.get(); - } - catch (...) + }).then([p_request_context](pplx::task op) { + try + { + bool ignored = op.get(); + } + catch (...) + { + // We're only here to pick up any exception that may have been thrown, and to clean up + // if needed + if (p_request_context->m_compression_state.m_acquired) { - // We're only here to pick up any exception that may have been thrown, and to clean up - // if needed - if (p_request_context->m_compression_state.m_acquired) - { - p_request_context->_get_writebuffer().commit(0); - p_request_context->m_compression_state.m_acquired = nullptr; - } - p_request_context->report_exception(std::current_exception()); + p_request_context->_get_writebuffer().commit(0); + p_request_context->m_compression_state.m_acquired = nullptr; } - }); + p_request_context->report_exception(std::current_exception()); + } + }); } else { diff -Nru cpprest-2.10.13/Release/src/http/client/http_client_winrt.cpp cpprest-2.10.14/Release/src/http/client/http_client_winrt.cpp --- cpprest-2.10.13/Release/src/http/client/http_client_winrt.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/src/http/client/http_client_winrt.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -188,7 +188,7 @@ { public: IRequestStream(const std::weak_ptr& context, - size_t read_length = std::numeric_limits::max()) + size_t read_length = (std::numeric_limits::max)()) : m_context(context), m_read_length(read_length) { // read_length is the initial length of the ISequentialStream that is available for read @@ -253,9 +253,9 @@ _In_ ULONG cb, _Out_opt_ ULONG* pcbWritten) { - CASABLANCA_UNREFERENCED_PARAMETER(pv); - CASABLANCA_UNREFERENCED_PARAMETER(cb); - CASABLANCA_UNREFERENCED_PARAMETER(pcbWritten); + (void)pv; + (void)cb; + (void)pcbWritten; return E_NOTIMPL; } @@ -345,9 +345,9 @@ _In_ ULONG cb, _Out_ ULONG* pcbRead) { - CASABLANCA_UNREFERENCED_PARAMETER(pv); - CASABLANCA_UNREFERENCED_PARAMETER(cb); - CASABLANCA_UNREFERENCED_PARAMETER(pcbRead); + (void)pv; + (void)cb; + (void)pcbRead; return E_NOTIMPL; } @@ -403,7 +403,7 @@ } const size_t content_length = msg._get_impl()->_get_content_length(); - if (content_length == std::numeric_limits::max()) + if (content_length == (std::numeric_limits::max)()) { // IXHR2 does not allow transfer encoding chunked. So the user is expected to set the content length request->report_exception(http_exception(L"Content length is not specified in the http headers")); @@ -478,7 +478,7 @@ // Set timeout. ULONGLONG timeout = static_cast(config.timeout().count()); - timeout = std::max(timeout, std::numeric_limits::min() + 1); + timeout = (std::max)(timeout, (std::numeric_limits::min)() + 1); hr = winrt_context->m_hRequest->SetProperty(XHR_PROP_TIMEOUT, timeout); if (FAILED(hr)) { diff -Nru cpprest-2.10.13/Release/src/http/common/http_compression.cpp cpprest-2.10.14/Release/src/http/common/http_compression.cpp --- cpprest-2.10.13/Release/src/http/common/http_compression.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/src/http/common/http_compression.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -32,6 +32,10 @@ #if defined(CPPREST_HTTP_COMPRESSION) #include +// zconf.h may define compress +#ifdef compress +#undef compress +#endif #if !defined(CPPREST_EXCLUDE_BROTLI) #define CPPREST_BROTLI_COMPRESSION #endif // CPPREST_EXCLUDE_BROTLI @@ -93,7 +97,7 @@ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wtautological-constant-compare" #endif // __clang__ - if (input_size > std::numeric_limits::max() || output_size > std::numeric_limits::max()) + if (input_size > (std::numeric_limits::max)() || output_size > (std::numeric_limits::max)()) #if defined(__clang__) #pragma clang diagnostic pop #endif // __clang__ @@ -194,7 +198,7 @@ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wtautological-constant-compare" #endif // __clang__ - if (input_size > std::numeric_limits::max() || output_size > std::numeric_limits::max()) + if (input_size > (std::numeric_limits::max)() || output_size > (std::numeric_limits::max)()) #if defined(__clang__) #pragma clang diagnostic pop #endif // __clang__ diff -Nru cpprest-2.10.13/Release/src/http/common/http_msg.cpp cpprest-2.10.14/Release/src/http/common/http_msg.cpp --- cpprest-2.10.13/Release/src/http/common/http_msg.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/src/http/common/http_msg.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -287,11 +287,7 @@ static const utility::char_t* unsupported_charset = _XPLATSTR("Charset must be iso-8859-1, utf-8, utf-16, utf-16le, or utf-16be to be extracted."); -http_msg_base::http_msg_base() - : m_http_version(http::http_version{ 0, 0 }) - , m_headers() - , m_default_outstream(false) -{} +http_msg_base::http_msg_base() : m_http_version(http::http_version {0, 0}), m_headers(), m_default_outstream(false) {} void http_msg_base::_prepare_to_receive_data() { @@ -326,7 +322,7 @@ return static_cast(end - offset); } - return std::numeric_limits::max(); + return (std::numeric_limits::max)(); } size_t http_msg_base::_get_content_length(bool honor_compression) @@ -356,7 +352,7 @@ } } - return std::numeric_limits::max(); + return (std::numeric_limits::max)(); } if (honor_compression && m_compressor) @@ -365,7 +361,7 @@ // up front for content encoding. We return the uncompressed length if we can figure it out. headers().add(header_names::transfer_encoding, m_compressor->algorithm()); headers().add(header_names::transfer_encoding, _XPLATSTR("chunked")); - return std::numeric_limits::max(); + return (std::numeric_limits::max)(); } if (headers().match(header_names::content_length, content_length)) @@ -376,7 +372,7 @@ } content_length = _get_stream_length(); - if (content_length != std::numeric_limits::max()) + if (content_length != (std::numeric_limits::max)()) { // The content length wasn't explicitly set, but we figured it out; // use it, since sending this way is more efficient than chunking @@ -386,7 +382,7 @@ // We don't know the content length; we'll chunk the stream headers().add(header_names::transfer_encoding, _XPLATSTR("chunked")); - return std::numeric_limits::max(); + return (std::numeric_limits::max)(); } // There is no content diff -Nru cpprest-2.10.13/Release/src/http/listener/http_server_asio.cpp cpprest-2.10.14/Release/src/http/listener/http_server_asio.cpp --- cpprest-2.10.13/Release/src/http/listener/http_server_asio.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/src/http/listener/http_server_asio.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -175,7 +175,7 @@ auto path_segments = uri::split_path(uri::decode(u.path())); for (auto i = static_cast(path_segments.size()); i >= 0; --i) { - std::string path = ""; + std::string path; for (size_t j = 0; j < static_cast(i); ++j) { path += "/" + utility::conversions::to_utf8string(path_segments[j]); @@ -520,7 +520,9 @@ auto& service = crossplat::threadpool::shared_instance().service(); tcp::resolver resolver(service); // #446: boost resolver does not recognize "+" as a host wildchar - tcp::resolver::query query = ("+" == m_host) ? tcp::resolver::query(m_port) : tcp::resolver::query(m_host, m_port); + tcp::resolver::query query = + ("+" == m_host) ? tcp::resolver::query(m_port, boost::asio::ip::resolver_query_base::flags()) + : tcp::resolver::query(m_host, m_port, boost::asio::ip::resolver_query_base::flags()); tcp::endpoint endpoint = *resolver.resolve(query); @@ -826,7 +828,7 @@ m_read = 0; ++m_refs; async_read_until_buffersize( - std::min(ChunkSize, m_read_size), + (std::min)(ChunkSize, m_read_size), [this](const boost::system::error_code& ec, size_t) { (will_deref_t) this->handle_body(ec); }); } @@ -908,7 +910,7 @@ auto writebuf = requestImpl->outstream().streambuf(); writebuf .putn_nocopy(boost::asio::buffer_cast(m_request_buf.data()), - std::min(m_request_buf.size(), m_read_size - m_read)) + (std::min)(m_request_buf.size(), m_read_size - m_read)) .then([this](pplx::task writtenSizeTask) -> will_deref_t { size_t writtenSize = 0; try @@ -924,7 +926,7 @@ m_request_buf.consume(writtenSize); async_read_until_buffersize( - std::min(ChunkSize, m_read_size - m_read), + (std::min)(ChunkSize, m_read_size - m_read), [this](const boost::system::error_code& ec, size_t) { (will_deref_t) this->handle_body(ec); }); return will_deref_t {}; }); @@ -1160,7 +1162,7 @@ if (readbuf.is_eof()) return cancel_sending_response_with_error( response, std::make_exception_ptr(http_exception("Response stream close early!"))); - size_t readBytes = std::min(ChunkSize, m_write_size - m_write); + size_t readBytes = (std::min)(ChunkSize, m_write_size - m_write); readbuf.getn(buffer_cast(m_response_buf.prepare(readBytes)), readBytes) .then([=](pplx::task actualSizeTask) -> will_deref_and_erase_t { size_t actualSize = 0; diff -Nru cpprest-2.10.13/Release/src/http/listener/http_server_httpsys.cpp cpprest-2.10.14/Release/src/http/listener/http_server_httpsys.cpp --- cpprest-2.10.13/Release/src/http/listener/http_server_httpsys.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/src/http/listener/http_server_httpsys.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -155,7 +155,7 @@ } else { - msgHeaders[unknown_header_name] = U(""); + msgHeaders[unknown_header_name].clear(); } } for (int i = 0; i < HttpHeaderMaximum; ++i) @@ -976,10 +976,10 @@ // OK, so we need to chunk it up. _ASSERTE(content_length > 0); - m_sending_in_chunks = (content_length != std::numeric_limits::max()); - m_transfer_encoding = (content_length == std::numeric_limits::max()); + m_sending_in_chunks = (content_length != (std::numeric_limits::max)()); + m_transfer_encoding = (content_length == (std::numeric_limits::max)()); m_remaining_to_write = content_length; - if (content_length == std::numeric_limits::max()) + if (content_length == (std::numeric_limits::max)()) { // Attempt to figure out the remaining length of the input stream m_remaining_to_write = m_response._get_impl()->_get_stream_length(); diff -Nru cpprest-2.10.13/Release/src/http/listener/http_server_httpsys.h cpprest-2.10.14/Release/src/http/listener/http_server_httpsys.h --- cpprest-2.10.13/Release/src/http/listener/http_server_httpsys.h 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/src/http/listener/http_server_httpsys.h 2019-07-16 19:07:11.000000000 +0000 @@ -58,9 +58,9 @@ ULONG_PTR numberOfBytesTransferred, PTP_IO io) { - CASABLANCA_UNREFERENCED_PARAMETER(io); - CASABLANCA_UNREFERENCED_PARAMETER(context); - CASABLANCA_UNREFERENCED_PARAMETER(instance); + (void)io; + (void)context; + (void)instance; http_overlapped* p_http_overlapped = (http_overlapped*)pOverlapped; p_http_overlapped->m_http_io_completion(result, (DWORD)numberOfBytesTransferred); diff -Nru cpprest-2.10.13/Release/src/http/oauth/oauth1.cpp cpprest-2.10.14/Release/src/http/oauth/oauth1.cpp --- cpprest-2.10.13/Release/src/http/oauth/oauth1.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/src/http/oauth/oauth1.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -15,7 +15,7 @@ #include "cpprest/asyncrt_utils.h" -#if !defined(CPPREST_TARGET_XP) +#if _WIN32_WINNT >= _WIN32_WINNT_VISTA using namespace utility; using web::http::client::http_client; @@ -136,7 +136,7 @@ std::vector oauth1_config::_hmac_sha1(const utility::string_t& key, const utility::string_t& data) { - unsigned char digest[HMAC_MAX_MD_CBLOCK]; + unsigned char digest[EVP_MAX_MD_SIZE]; unsigned int digest_len = 0; HMAC(EVP_sha1(), @@ -455,4 +455,4 @@ } // namespace http } // namespace web -#endif +#endif // _WIN32_WINNT >= _WIN32_WINNT_VISTA diff -Nru cpprest-2.10.13/Release/src/json/json.cpp cpprest-2.10.14/Release/src/json/json.cpp --- cpprest-2.10.13/Release/src/json/json.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/src/json/json.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -286,8 +286,9 @@ switch (m_type) { case signed_type: - return m_intval >= std::numeric_limits::min() && m_intval <= std::numeric_limits::max(); - case unsigned_type: return m_uintval <= std::numeric_limits::max(); + return m_intval >= (std::numeric_limits::min)() && + m_intval <= (std::numeric_limits::max)(); + case unsigned_type: return m_uintval <= (std::numeric_limits::max)(); case double_type: default: return false; } @@ -297,8 +298,8 @@ { switch (m_type) { - case signed_type: return m_intval >= 0 && m_intval <= std::numeric_limits::max(); - case unsigned_type: return m_uintval <= std::numeric_limits::max(); + case signed_type: return m_intval >= 0 && m_intval <= (std::numeric_limits::max)(); + case unsigned_type: return m_uintval <= (std::numeric_limits::max)(); case double_type: default: return false; } @@ -309,7 +310,7 @@ switch (m_type) { case signed_type: return true; - case unsigned_type: return m_uintval <= static_cast(std::numeric_limits::max()); + case unsigned_type: return m_uintval <= static_cast((std::numeric_limits::max)()); case double_type: default: return false; } diff -Nru cpprest-2.10.13/Release/src/json/json_parsing.cpp cpprest-2.10.14/Release/src/json/json_parsing.cpp --- cpprest-2.10.13/Release/src/json/json_parsing.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/src/json/json_parsing.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -965,7 +965,7 @@ if (tkn.m_error) goto error; // State 2: Looking for a colon. - if (tkn.kind != JSON_Parser::Token::TKN_Colon) goto done; + if (tkn.kind != JSON_Parser::Token::TKN_Colon) goto error; GetNextToken(tkn); if (tkn.m_error) goto error; diff -Nru cpprest-2.10.13/Release/src/pch/stdafx.h cpprest-2.10.14/Release/src/pch/stdafx.h --- cpprest-2.10.13/Release/src/pch/stdafx.h 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/src/pch/stdafx.h 2019-07-16 19:07:11.000000000 +0000 @@ -20,32 +20,29 @@ #endif #ifdef _WIN32 -#define NOMINMAX -#ifdef CPPREST_TARGET_XP -#include -#ifndef _WIN32_WINNT -#define _WIN32_WINNT _WIN32_WINNT_WS03 // Windows XP with SP2 -#endif -#endif -#include // use the debug version of the CRT if _DEBUG is defined #ifdef _DEBUG #define _CRTDBG_MAP_ALLOC #include -#include -#endif +#endif // _DEBUG +#include #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +#if CPPREST_TARGET_XP && _WIN32_WINNT != 0x0501 +#error CPPREST_TARGET_XP implies _WIN32_WINNT == 0x0501 +#endif // CPPREST_TARGET_XP && _WIN32_WINNT != 0x0501 + #include #include // Windows Header Files: -#if !defined(__cplusplus_winrt) +#ifndef __cplusplus_winrt #include +#endif !__cplusplus_winrt -#endif // #if !defined(__cplusplus_winrt) -#else // LINUX or APPLE +#else // LINUX or APPLE #define __STDC_LIMIT_MACROS #include "pthread.h" #include @@ -84,6 +81,7 @@ #include #include #include +#include #include // json diff -Nru cpprest-2.10.13/Release/src/streams/fileio_posix.cpp cpprest-2.10.14/Release/src/streams/fileio_posix.cpp --- cpprest-2.10.13/Release/src/streams/fileio_posix.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/src/streams/fileio_posix.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -375,7 +375,7 @@ size_t byteCount = count * charSize; if (fInfo->m_buffer == nullptr) { - fInfo->m_bufsize = std::max(PageSize, byteCount); + fInfo->m_bufsize = (std::max)(PageSize, byteCount); fInfo->m_buffer = new char[static_cast(fInfo->m_bufsize)]; fInfo->m_bufoff = fInfo->m_rdpos; @@ -396,7 +396,7 @@ if (bufrem < count) { - fInfo->m_bufsize = std::max(PageSize, byteCount); + fInfo->m_bufsize = (std::max)(PageSize, byteCount); // Then, we allocate a new buffer. @@ -456,7 +456,7 @@ if (fInfo->m_buffer_reads) { auto cb = create_callback(fInfo, callback, [=](size_t read) { - auto copy = std::min(read, byteCount); + auto copy = (std::min)(read, byteCount); auto bufoff = fInfo->m_rdpos - fInfo->m_bufoff; memcpy(ptr, fInfo->m_buffer + bufoff * charSize, copy); fInfo->m_atend = copy < byteCount; @@ -467,7 +467,7 @@ if (static_cast(read) > 0) { - auto copy = std::min(read, byteCount); + auto copy = (std::min)(read, byteCount); auto bufoff = fInfo->m_rdpos - fInfo->m_bufoff; memcpy(ptr, fInfo->m_buffer + bufoff * charSize, copy); fInfo->m_atend = copy < byteCount; diff -Nru cpprest-2.10.13/Release/src/streams/fileio_win32.cpp cpprest-2.10.14/Release/src/streams/fileio_win32.cpp --- cpprest-2.10.13/Release/src/streams/fileio_win32.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/src/streams/fileio_win32.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -105,9 +105,9 @@ ULONG_PTR numberOfBytesTransferred, PTP_IO io) { - CASABLANCA_UNREFERENCED_PARAMETER(io); - CASABLANCA_UNREFERENCED_PARAMETER(ctxt); - CASABLANCA_UNREFERENCED_PARAMETER(instance); + (void)io; + (void)ctxt; + (void)instance; EXTENDED_OVERLAPPED* pExtOverlapped = static_cast(pOverlapped); pExtOverlapped->func(result, static_cast(numberOfBytesTransferred), static_cast(pOverlapped)); diff -Nru cpprest-2.10.13/Release/src/uri/uri.cpp cpprest-2.10.14/Release/src/uri/uri.cpp --- cpprest-2.10.13/Release/src/uri/uri.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/src/uri/uri.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -734,7 +734,7 @@ else if (equals_index == 0) { utility::string_t value(key_value_pair.begin() + equals_index + 1, key_value_pair.end()); - results[_XPLATSTR("")] = value; + results[utility::string_t {}] = value; } else { diff -Nru cpprest-2.10.13/Release/src/utilities/web_utilities.cpp cpprest-2.10.14/Release/src/utilities/web_utilities.cpp --- cpprest-2.10.13/Release/src/utilities/web_utilities.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/src/utilities/web_utilities.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -27,8 +27,9 @@ { namespace details { -#if defined(_WIN32) && !defined(CPPREST_TARGET_XP) -#if defined(__cplusplus_winrt) +#ifdef _WIN32 +#if _WIN32_WINNT >= _WIN32_WINNT_VISTA +#ifdef __cplusplus_winrt // Helper function to zero out memory of an IBuffer. void winrt_secure_zero_buffer(Windows::Storage::Streams::IBuffer ^ buffer) @@ -88,7 +89,7 @@ return std::move(data); } -#else +#else // ^^^ __cplusplus_winrt ^^^ // vvv !__cplusplus_winrt vvv win32_encryption::win32_encryption(const std::wstring& data) : m_numCharacters(data.size()) { @@ -141,13 +142,14 @@ return result; } -#endif -#endif +#endif // __cplusplus_winrt +#endif // _WIN32_WINNT >= _WIN32_WINNT_VISTA +#endif // _WIN32 void zero_memory_deleter::operator()(::utility::string_t* data) const { - CASABLANCA_UNREFERENCED_PARAMETER(data); -#if defined(_WIN32) + (void)data; +#ifdef _WIN32 SecureZeroMemory(&(*data)[0], data->size() * sizeof(::utility::string_t::value_type)); delete data; #endif diff -Nru cpprest-2.10.13/Release/src/websockets/client/ws_client.cpp cpprest-2.10.14/Release/src/websockets/client/ws_client.cpp --- cpprest-2.10.13/Release/src/websockets/client/ws_client.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/src/websockets/client/ws_client.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -51,8 +51,7 @@ }); m_callback_client->set_close_handler( - [=](websocket_close_status status, const utility::string_t& reason, const std::error_code& error_code) { - CASABLANCA_UNREFERENCED_PARAMETER(status); + [=](websocket_close_status, const utility::string_t& reason, const std::error_code& error_code) { close_pending_tasks_with_error(websocket_exception(error_code, reason)); }); } diff -Nru cpprest-2.10.13/Release/src/websockets/client/ws_client_winrt.cpp cpprest-2.10.14/Release/src/websockets/client/ws_client_winrt.cpp --- cpprest-2.10.13/Release/src/websockets/client/ws_client_winrt.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/src/websockets/client/ws_client_winrt.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -404,7 +404,7 @@ return close(websocket_close_status::normal, _XPLATSTR("Normal")); } - pplx::task close(websocket_close_status status, const utility::string_t& strreason = _XPLATSTR("")) + pplx::task close(websocket_close_status status, const utility::string_t& strreason = {}) { // Send a close frame to the server m_msg_websocket->Close(static_cast(status), Platform::StringReference(strreason.c_str())); diff -Nru cpprest-2.10.13/Release/src/websockets/client/ws_client_wspp.cpp cpprest-2.10.14/Release/src/websockets/client/ws_client_wspp.cpp --- cpprest-2.10.13/Release/src/websockets/client/ws_client_wspp.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/src/websockets/client/ws_client_wspp.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -325,6 +325,33 @@ } }); + client.set_ping_handler([this](websocketpp::connection_hdl, const std::string& msg) { + if (m_external_message_handler) + { + _ASSERTE(m_state >= CONNECTED && m_state < CLOSED); + websocket_incoming_message incoming_msg; + + incoming_msg.m_msg_type = websocket_message_type::ping; + incoming_msg.m_body = concurrency::streams::container_buffer(msg); + + m_external_message_handler(incoming_msg); + } + return true; + }); + + client.set_pong_handler([this](websocketpp::connection_hdl, const std::string& msg) { + if (m_external_message_handler) + { + _ASSERTE(m_state >= CONNECTED && m_state < CLOSED); + websocket_incoming_message incoming_msg; + + incoming_msg.m_msg_type = websocket_message_type::pong; + incoming_msg.m_body = concurrency::streams::container_buffer(msg); + + m_external_message_handler(incoming_msg); + } + }); + client.set_close_handler([this](websocketpp::connection_hdl con_hdl) { _ASSERTE(m_state != CLOSED); shutdown_wspp_impl(con_hdl, false); @@ -434,12 +461,14 @@ { case websocket_message_type::text_message: case websocket_message_type::binary_message: + case websocket_message_type::ping: case websocket_message_type::pong: break; default: return pplx::task_from_exception(websocket_exception("Message Type not supported.")); } const auto length = msg.m_length; - if (length == 0 && msg.m_msg_type != websocket_message_type::pong) + if (length == 0 && msg.m_msg_type != websocket_message_type::ping && + msg.m_msg_type != websocket_message_type::pong) { return pplx::task_from_exception(websocket_exception("Cannot send empty message.")); } @@ -659,9 +688,6 @@ } } // unlock - // Delete client to make sure Websocketpp cleans up all Boost.Asio portions. - m_client.reset(); - if (connecting) { websocket_exception exc(ec, build_error_msg(ec, "set_fail_handler")); @@ -694,7 +720,18 @@ case websocket_message_type::binary_message: client.send(this_client->m_con, sp_allocated.get(), length, websocketpp::frame::opcode::binary, ec); break; - case websocket_message_type::pong: client.pong(this_client->m_con, "", ec); break; + case websocket_message_type::ping: + { + std::string s(reinterpret_cast(sp_allocated.get()), length); + client.ping(this_client->m_con, s, ec); + break; + } + case websocket_message_type::pong: + { + std::string s(reinterpret_cast(sp_allocated.get()), length); + client.pong(this_client->m_con, s, ec); + break; + } default: // This case should have already been filtered above. std::abort(); @@ -760,8 +797,6 @@ websocketpp::client m_client; }; - websocketpp::connection_hdl m_con; - pplx::task_completion_event m_connect_tce; pplx::task_completion_event m_close_tce; @@ -769,6 +804,7 @@ std::mutex m_wspp_client_lock; State m_state; std::unique_ptr m_client; + websocketpp::connection_hdl m_con; // Queue to track pending sends outgoing_msg_queue m_out_queue; diff -Nru cpprest-2.10.13/Release/tests/common/TestRunner/test_runner.cpp cpprest-2.10.14/Release/tests/common/TestRunner/test_runner.cpp --- cpprest-2.10.13/Release/tests/common/TestRunner/test_runner.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/tests/common/TestRunner/test_runner.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -238,7 +238,7 @@ } else { - UnitTest::GlobalSettings::Add(arg.substr(1), ""); + UnitTest::GlobalSettings::Add(arg.substr(1), std::string{}); } } else if (arg.find("/debug") == 0) @@ -262,9 +262,9 @@ // This starts with visual studio versions after VS 2012. #if defined(_MSC_VER) && (_MSC_VER >= 1800) #ifdef WINRT_TEST_RUNNER - UnitTest::GlobalSettings::Add("winrt", ""); + UnitTest::GlobalSettings::Add("winrt", std::string{}); #elif defined DESKTOP_TEST_RUNNER - UnitTest::GlobalSettings::Add("desktop", ""); + UnitTest::GlobalSettings::Add("desktop", std::string{}); #endif #endif diff -Nru cpprest-2.10.13/Release/tests/common/UnitTestpp/src/Checks.h cpprest-2.10.14/Release/tests/common/UnitTestpp/src/Checks.h --- cpprest-2.10.13/Release/tests/common/UnitTestpp/src/Checks.h 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/tests/common/UnitTestpp/src/Checks.h 2019-07-16 19:07:11.000000000 +0000 @@ -103,7 +103,7 @@ std::string BuildString(const char*, const char*, const T1&, const T2&) { // Don't do anything since operator<< isn't supported. - return ""; + return std::string{}; } }; diff -Nru cpprest-2.10.13/Release/tests/common/UnitTestpp/src/DeferredTestResult.cpp cpprest-2.10.14/Release/tests/common/UnitTestpp/src/DeferredTestResult.cpp --- cpprest-2.10.13/Release/tests/common/UnitTestpp/src/DeferredTestResult.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/tests/common/UnitTestpp/src/DeferredTestResult.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -54,12 +54,12 @@ } DeferredTestResult::DeferredTestResult() - : suiteName(""), testName(""), failureFile(""), timeElapsed(0.0f), failed(false) + : suiteName(), testName(), failureFile(), timeElapsed(0.0f), failed(false) { } -DeferredTestResult::DeferredTestResult(char const* suite, char const* test) - : suiteName(suite), testName(test), failureFile(""), timeElapsed(0.0f), failed(false) +DeferredTestResult::DeferredTestResult(char const* const suite, char const* const test) + : suiteName(suite), testName(test), failureFile(), timeElapsed(0.0f), failed(false) { } diff -Nru cpprest-2.10.13/Release/tests/common/UnitTestpp/src/MemoryOutStream.cpp cpprest-2.10.14/Release/tests/common/UnitTestpp/src/MemoryOutStream.cpp --- cpprest-2.10.13/Release/tests/common/UnitTestpp/src/MemoryOutStream.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/tests/common/UnitTestpp/src/MemoryOutStream.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -174,7 +174,7 @@ if (m_buffer) strcpy(buffer, m_buffer); else - strcpy(buffer, ""); + *buffer = '\0'; delete[] m_buffer; m_buffer = buffer; diff -Nru cpprest-2.10.13/Release/tests/common/UnitTestpp/src/stdafx.h cpprest-2.10.14/Release/tests/common/UnitTestpp/src/stdafx.h --- cpprest-2.10.13/Release/tests/common/UnitTestpp/src/stdafx.h 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/tests/common/UnitTestpp/src/stdafx.h 2019-07-16 19:07:11.000000000 +0000 @@ -49,6 +49,5 @@ #ifdef WIN32 #define WIN32_LEAN_AND_MEAN -#define NOMINMAX #include #endif \ No newline at end of file diff -Nru cpprest-2.10.13/Release/tests/common/utilities/os_utilities.cpp cpprest-2.10.14/Release/tests/common/utilities/os_utilities.cpp --- cpprest-2.10.13/Release/tests/common/utilities/os_utilities.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/tests/common/utilities/os_utilities.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -12,7 +12,6 @@ #include "os_utilities.h" #ifdef WIN32 -#define NOMINMAX #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #include diff -Nru cpprest-2.10.13/Release/tests/functional/http/client/compression_tests.cpp cpprest-2.10.14/Release/tests/functional/http/client/compression_tests.cpp --- cpprest-2.10.13/Release/tests/functional/http/client/compression_tests.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/tests/functional/http/client/compression_tests.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -73,7 +73,7 @@ << " / " << _size; throw std::runtime_error(std::move(ss.str())); } - bytes = std::min(input_size, output_size); + bytes = (std::min)(input_size, output_size); if (bytes) { memcpy(output, input, bytes); @@ -128,7 +128,7 @@ << " / " << _size; throw std::runtime_error(std::move(ss.str())); } - bytes = std::min(input_size, output_size); + bytes = (std::min)(input_size, output_size); if (bytes) { memcpy(output, input, bytes); @@ -218,18 +218,18 @@ if (csize == cmpsize) { // extend the output buffer if there may be more compressed bytes to retrieve - cmpsize += std::min(chunk_size, (size_t)200); + cmpsize += (std::min)(chunk_size, (size_t)200); cmp_buffer.resize(cmpsize); } r = compressor ->compress(input_buffer.data() + i, - std::min(chunk_size, buffer_size - i), + (std::min)(chunk_size, buffer_size - i), cmp_buffer.data() + csize, - std::min(chunk_size, cmpsize - csize), + (std::min)(chunk_size, cmpsize - csize), hint) .get(); - VERIFY_IS_TRUE(r.input_bytes_processed == std::min(chunk_size, buffer_size - i) || - r.output_bytes_produced == std::min(chunk_size, cmpsize - csize)); + VERIFY_IS_TRUE(r.input_bytes_processed == (std::min)(chunk_size, buffer_size - i) || + r.output_bytes_produced == (std::min)(chunk_size, cmpsize - csize)); VERIFY_IS_TRUE(hint == operation_hint::is_last || !r.done); chunk_sizes.push_back(r.output_bytes_produced); csize += r.output_bytes_produced; @@ -262,7 +262,7 @@ ->decompress(cmp_buffer.data() + nn, *it, dcmp_buffer.data() + dsize, - std::min(chunk_size, buffer_size - dsize), + (std::min)(chunk_size, buffer_size - dsize), hint) .get(); nn += *it; @@ -281,14 +281,14 @@ memset(dcmp_buffer.data(), 0, dcmp_buffer.size()); do { - size_t n = std::min(chunk_size, csize - nn); + size_t n = (std::min)(chunk_size, csize - nn); do { r = decompressor ->decompress(cmp_buffer.data() + nn, n, dcmp_buffer.data() + dsize, - std::min(chunk_size, buffer_size - dsize), + (std::min)(chunk_size, buffer_size - dsize), operation_hint::has_more) .get(); dsize += r.output_bytes_produced; @@ -770,7 +770,7 @@ } #endif // _WIN32 - auto extra_size = [](size_t bufsz) -> size_t { return std::max(static_cast(128), bufsz / 1000); }; + auto extra_size = [](size_t bufsz) -> size_t { return (std::max)(static_cast(128), bufsz / 1000); }; // Test decompression both explicitly through the test server and implicitly through the listener; // this is the top-level loop in order to avoid thrashing the listeners more than necessary diff -Nru cpprest-2.10.13/Release/tests/functional/http/client/outside_tests.cpp cpprest-2.10.14/Release/tests/functional/http/client/outside_tests.cpp --- cpprest-2.10.13/Release/tests/functional/http/client/outside_tests.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/tests/functional/http/client/outside_tests.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -352,7 +352,7 @@ throw; } #else - CASABLANCA_UNREFERENCED_PARAMETER(e); + (void)e; throw; #endif os_utilities::sleep(1000); diff -Nru cpprest-2.10.13/Release/tests/functional/http/utilities/stdafx.h cpprest-2.10.14/Release/tests/functional/http/utilities/stdafx.h --- cpprest-2.10.13/Release/tests/functional/http/utilities/stdafx.h 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/tests/functional/http/utilities/stdafx.h 2019-07-16 19:07:11.000000000 +0000 @@ -13,7 +13,6 @@ #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN -#define NOMINMAX #include #include diff -Nru cpprest-2.10.13/Release/tests/functional/json/json_numbers_tests.cpp cpprest-2.10.14/Release/tests/functional/json/json_numbers_tests.cpp --- cpprest-2.10.13/Release/tests/functional/json/json_numbers_tests.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/tests/functional/json/json_numbers_tests.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -258,8 +258,8 @@ // unsigned int64 max oracleStream.precision(std::numeric_limits::digits10 + 2); - oracleStream << std::numeric_limits::max(); - json::value iMax(std::numeric_limits::max()); + oracleStream << (std::numeric_limits::max)(); + json::value iMax((std::numeric_limits::max)()); VERIFY_ARE_EQUAL(oracleStream.str(), iMax.serialize()); iMax.serialize(stream); VERIFY_ARE_EQUAL(oracleStream.str(), stream.str()); @@ -268,8 +268,8 @@ stream.str(U("")); oracleStream.str(U("")); oracleStream.clear(); - oracleStream << std::numeric_limits::min(); - json::value iMin(std::numeric_limits::min()); + oracleStream << (std::numeric_limits::min)(); + json::value iMin((std::numeric_limits::min)()); VERIFY_ARE_EQUAL(oracleStream.str(), iMin.serialize()); iMin.serialize(stream); VERIFY_ARE_EQUAL(oracleStream.str(), stream.str()); @@ -278,8 +278,8 @@ stream.str(U("")); oracleStream.str(U("")); oracleStream.precision(std::numeric_limits::digits10 + 2); - oracleStream << std::numeric_limits::max(); - json::value dMax(std::numeric_limits::max()); + oracleStream << (std::numeric_limits::max)(); + json::value dMax((std::numeric_limits::max)()); VERIFY_ARE_EQUAL(oracleStream.str(), dMax.serialize()); dMax.serialize(stream); VERIFY_ARE_EQUAL(oracleStream.str(), stream.str()); @@ -287,8 +287,8 @@ // double min stream.str(U("")); oracleStream.str(U("")); - oracleStream << std::numeric_limits::min(); - json::value dMin(std::numeric_limits::min()); + oracleStream << (std::numeric_limits::min)(); + json::value dMin((std::numeric_limits::min)()); VERIFY_ARE_EQUAL(oracleStream.str(), dMin.serialize()); dMin.serialize(stream); VERIFY_ARE_EQUAL(oracleStream.str(), stream.str()); diff -Nru cpprest-2.10.13/Release/tests/functional/json/parsing_tests.cpp cpprest-2.10.14/Release/tests/functional/json/parsing_tests.cpp --- cpprest-2.10.13/Release/tests/functional/json/parsing_tests.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/tests/functional/json/parsing_tests.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -469,6 +469,12 @@ VERIFY_ARE_EQUAL(0u, arr.size()); } + TEST(bug_object_field_key_no_value) + { + VERIFY_PARSING_THROW(json::value::parse(U("{\"meow\"}"))); + VERIFY_PARSING_THROW(json::value::parse(U("{\"meow\": 42, \"purr\": 57, \"hiss\"}"))); + } + TEST(bug_416116) { json::value data2 = json::value::parse(U("\"δοκιμή\"")); diff -Nru cpprest-2.10.13/Release/tests/functional/json/stdafx.h cpprest-2.10.14/Release/tests/functional/json/stdafx.h --- cpprest-2.10.13/Release/tests/functional/json/stdafx.h 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/tests/functional/json/stdafx.h 2019-07-16 19:07:11.000000000 +0000 @@ -16,5 +16,4 @@ #include "unittestpp.h" #include -#define NOMINMAX #include "json_tests.h" diff -Nru cpprest-2.10.13/Release/tests/functional/misc/atl_headers/header_test1.cpp cpprest-2.10.14/Release/tests/functional/misc/atl_headers/header_test1.cpp --- cpprest-2.10.13/Release/tests/functional/misc/atl_headers/header_test1.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/tests/functional/misc/atl_headers/header_test1.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -11,7 +11,6 @@ // Include ATL headers before casablanca headers #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -#define NOMINMAX #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit #ifndef VC_EXTRALEAN diff -Nru cpprest-2.10.13/Release/tests/functional/misc/atl_headers/header_test2.cpp cpprest-2.10.14/Release/tests/functional/misc/atl_headers/header_test2.cpp --- cpprest-2.10.13/Release/tests/functional/misc/atl_headers/header_test2.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/tests/functional/misc/atl_headers/header_test2.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -9,7 +9,6 @@ * =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ****/ #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -#define NOMINMAX #include "cpprest/http_client.h" // Include ATL headers after casablanca headers diff -Nru cpprest-2.10.13/Release/tests/functional/pplx/pplx_test/stdafx.h cpprest-2.10.14/Release/tests/functional/pplx/pplx_test/stdafx.h --- cpprest-2.10.13/Release/tests/functional/pplx/pplx_test/stdafx.h 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/tests/functional/pplx/pplx_test/stdafx.h 2019-07-16 19:07:11.000000000 +0000 @@ -12,7 +12,6 @@ #pragma once #ifdef _WIN32 -#define NOMINMAX #include #endif diff -Nru cpprest-2.10.13/Release/tests/functional/streams/istream_tests.cpp cpprest-2.10.14/Release/tests/functional/streams/istream_tests.cpp --- cpprest-2.10.13/Release/tests/functional/streams/istream_tests.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/tests/functional/streams/istream_tests.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -1333,7 +1333,7 @@ const auto actual = istream_double.extract().get(); compare_double(expected, actual); - if (actual <= std::numeric_limits::max()) + if (actual <= (std::numeric_limits::max)()) compare_float(float(expected), istream_float.extract().get()); else VERIFY_THROWS(istream_float.extract().get(), std::exception); diff -Nru cpprest-2.10.13/Release/tests/functional/streams/memstream_tests.cpp cpprest-2.10.14/Release/tests/functional/streams/memstream_tests.cpp --- cpprest-2.10.13/Release/tests/functional/streams/memstream_tests.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/tests/functional/streams/memstream_tests.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -13,7 +13,6 @@ #include #endif #ifdef _WIN32 -#define NOMINMAX #include #endif diff -Nru cpprest-2.10.13/Release/tests/functional/utils/win32_encryption_tests.cpp cpprest-2.10.14/Release/tests/functional/utils/win32_encryption_tests.cpp --- cpprest-2.10.13/Release/tests/functional/utils/win32_encryption_tests.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/tests/functional/utils/win32_encryption_tests.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -21,7 +21,7 @@ { namespace utils_tests { -#if defined(_WIN32) && !defined(CPPREST_TARGET_XP) && !defined(__cplusplus_winrt) +#if defined(_WIN32) && _WIN32_WINNT >= _WIN32_WINNT_VISTA && !defined(__cplusplus_winrt) SUITE(win32_encryption) { TEST(win32_encryption_random_string) @@ -42,7 +42,7 @@ } // SUITE(win32_encryption) -#endif +#endif // defined(_WIN32) && _WIN32_WINNT >= _WIN32_WINNT_VISTA && !defined(__cplusplus_winrt) } // namespace utils_tests } // namespace functional diff -Nru cpprest-2.10.13/Release/tests/functional/websockets/client/send_msg_tests.cpp cpprest-2.10.14/Release/tests/functional/websockets/client/send_msg_tests.cpp --- cpprest-2.10.13/Release/tests/functional/websockets/client/send_msg_tests.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/tests/functional/websockets/client/send_msg_tests.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -104,16 +104,32 @@ } template - pplx::task send_pong_msg_helper(SocketClientClass & client, web::uri uri, test_websocket_server & server) + pplx::task send_ping_msg_helper(SocketClientClass & client, web::uri uri, test_websocket_server & server, + const std::string& body = "") { server.next_message( - [](test_websocket_msg msg) // Handler to verify the message sent by the client. - { websocket_asserts::assert_message_equals(msg, "", test_websocket_message_type::WEB_SOCKET_PONG_TYPE); }); + [body](test_websocket_msg msg) // Handler to verify the message sent by the client. + { websocket_asserts::assert_message_equals(msg, body, test_websocket_message_type::WEB_SOCKET_PING_TYPE); }); client.connect(uri).wait(); websocket_outgoing_message msg; - msg.set_pong_message(); + msg.set_ping_message(body); + return client.send(msg); + } + + template + pplx::task send_pong_msg_helper(SocketClientClass & client, web::uri uri, test_websocket_server & server, + const std::string& body = "") + { + server.next_message( + [body](test_websocket_msg msg) // Handler to verify the message sent by the client. + { websocket_asserts::assert_message_equals(msg, body, test_websocket_message_type::WEB_SOCKET_PONG_TYPE); }); + + client.connect(uri).wait(); + + websocket_outgoing_message msg; + msg.set_pong_message(body); return client.send(msg); } @@ -493,6 +509,24 @@ } #if !defined(__cplusplus_winrt) + // Send a ping message to the server + TEST_FIXTURE(uri_address, send_ping_msg) + { + test_websocket_server server; + websocket_client client; + send_ping_msg_helper(client, m_uri, server).wait(); + client.close().wait(); + } + + // Send a ping message to the server with a body + TEST_FIXTURE(uri_address, send_ping_msg_body) + { + test_websocket_server server; + websocket_client client; + send_ping_msg_helper(client, m_uri, server, "abcdefghijklmnopqrstuvwxyz").wait(); + client.close().wait(); + } + // Send an unsolicited pong message to the server TEST_FIXTURE(uri_address, send_pong_msg) { @@ -502,6 +536,15 @@ client.close().wait(); } + // Send an unsolicited pong message to the server with a body + TEST_FIXTURE(uri_address, send_pong_msg_body) + { + test_websocket_server server; + websocket_client client; + send_pong_msg_helper(client, m_uri, server, "abcdefghijklmnopqrstuvwxyz").wait(); + client.close().wait(); + } + // Send an unsolicited pong message to the server with websocket_callback_client TEST_FIXTURE(uri_address, send_pong_msg_callback_client) { diff -Nru cpprest-2.10.13/Release/tests/functional/websockets/utilities/stdafx.h cpprest-2.10.14/Release/tests/functional/websockets/utilities/stdafx.h --- cpprest-2.10.13/Release/tests/functional/websockets/utilities/stdafx.h 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/tests/functional/websockets/utilities/stdafx.h 2019-07-16 19:07:11.000000000 +0000 @@ -13,7 +13,6 @@ #if defined(_WIN32) // Include first to avoid any issues with Windows.h. -#define NOMINMAX #include #endif diff -Nru cpprest-2.10.13/Release/tests/functional/websockets/utilities/test_websocket_server.cpp cpprest-2.10.14/Release/tests/functional/websockets/utilities/test_websocket_server.cpp --- cpprest-2.10.13/Release/tests/functional/websockets/utilities/test_websocket_server.cpp 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/tests/functional/websockets/utilities/test_websocket_server.cpp 2019-07-16 19:07:11.000000000 +0000 @@ -122,6 +122,20 @@ m_server_connected.set_exception(std::runtime_error("Connection attempt failed.")); }); + m_srv.set_ping_handler([this](websocketpp::connection_hdl hdl, std::string input) { + auto fn = m_test_srv->get_next_message_handler(); + assert(fn); + + test_websocket_msg wsmsg; + + wsmsg.set_data(std::vector(input.begin(), input.end())); + + wsmsg.set_msg_type(WEB_SOCKET_PING_TYPE); + fn(wsmsg); + + return true; + }); + m_srv.set_pong_handler([this](websocketpp::connection_hdl hdl, std::string input) { auto fn = m_test_srv->get_next_message_handler(); assert(fn); diff -Nru cpprest-2.10.13/Release/tests/functional/websockets/utilities/test_websocket_server.h cpprest-2.10.14/Release/tests/functional/websockets/utilities/test_websocket_server.h --- cpprest-2.10.13/Release/tests/functional/websockets/utilities/test_websocket_server.h 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/Release/tests/functional/websockets/utilities/test_websocket_server.h 2019-07-16 19:07:11.000000000 +0000 @@ -46,6 +46,7 @@ WEB_SOCKET_UTF8_MESSAGE_TYPE, WEB_SOCKET_UTF8_FRAGMENT_TYPE, WEB_SOCKET_CLOSE_TYPE, + WEB_SOCKET_PING_TYPE, WEB_SOCKET_PONG_TYPE }; diff -Nru cpprest-2.10.13/.vscode/settings.json cpprest-2.10.14/.vscode/settings.json --- cpprest-2.10.13/.vscode/settings.json 2019-04-25 05:16:37.000000000 +0000 +++ cpprest-2.10.14/.vscode/settings.json 2019-07-16 19:07:11.000000000 +0000 @@ -3,6 +3,18 @@ "**/.git/objects/**": true, "**/.git/subtree-cache/**": true, "**/node_modules/*/**": true, - "**/vcpkg/**": true - } + "**/vcpkg/**": true, + "build.x86.debug": true, + "build.x86.release": true, + "build.x64.debug": true, + "build.x64.release": true, + "out": true, + }, + "cSpell.words": [ + "XPLATSTR", + "blittable", + "pplx", + "rdpos", + "rgpsz" + ] }