Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into frkaya/curlhttp
Browse files Browse the repository at this point in the history
  • Loading branch information
BillyONeal committed Aug 23, 2019
2 parents ac3f314 + 2a8c17e commit 462b710
Show file tree
Hide file tree
Showing 75 changed files with 589 additions and 593 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,5 @@ Build_android/build/
Generated Files/
# Ignore iOS temp build directories
Build_iOS/Apple-Boost-BuildScript

/out/
16 changes: 14 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
2 changes: 1 addition & 1 deletion Build_android/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ if [ "${DO_OPENSSL}" == "1" ]; then (
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 b1e2cb397d3ec573f1cfdf4f4d965766204c53f1
git checkout aed656a97fb3af7322fd2c3da5995a2d09d87d4b
PATH="$PATH:$NDK_DIR" \
CXXFLAGS="-std=gnu++11" \
./build-android.sh \
Expand Down
35 changes: 32 additions & 3 deletions Release/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ endif()

set(CPPREST_VERSION_MAJOR 2)
set(CPPREST_VERSION_MINOR 10)
set(CPPREST_VERSION_REVISION 13)
set(CPPREST_VERSION_REVISION 14)

enable_testing()

Expand Down Expand Up @@ -179,13 +179,20 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4264")
add_compile_options(/bigobj)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MP")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MP /profile /OPT:REF /OPT:ICF")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MP /profile /OPT:REF /OPT:ICF")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MP")
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}")
Expand All @@ -196,6 +203,28 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Binaries)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Binaries)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Binaries)

function(configure_pch target precompile_header precomile_source) # optional additional compile arguments
if(MSVC)
get_target_property(_srcs ${target} SOURCES)

set(pch_output_filepath_arg)
if(NOT CMAKE_GENERATOR MATCHES "Visual Studio .*")
set_property(SOURCE ${precomile_source} APPEND PROPERTY OBJECT_OUTPUTS "${CMAKE_CURRENT_BINARY_DIR}/${target}.pch")
set_property(SOURCE ${_srcs} APPEND PROPERTY OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${target}.pch")
set(pch_output_filepath_arg "/Fp${CMAKE_CURRENT_BINARY_DIR}/${target}.pch")
else()
# Don't specify output file so that VS may choose a config spefic location.
# Otherwise Debug/Release builds will interfere with one another.
endif()

set_source_files_properties(${precomile_source} PROPERTIES COMPILE_FLAGS "/Yc${precompile_header}")
target_sources(${target} PRIVATE ${precomile_source})
# Note: as ${precomile_source} is also a SOURCE for ${target}, the below options will also be applied.
# ${precomile_source} has /Yc option that will cause the shared /Yu to be ignored.
target_compile_options(${target} PRIVATE /Yu${precompile_header} ${pch_output_filepath_arg} ${ARGN})
endif()
endfunction()

# These settings can be used by the test targets
set(Casablanca_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include)
set(Casablanca_LIBRARY cpprest)
Expand Down
3 changes: 0 additions & 3 deletions Release/include/cpprest/details/cpprest_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
#define CPPREST_CONSTEXPR const
#endif // _MSC_VER >= 1900

#define CASABLANCA_UNREFERENCED_PARAMETER(x) (x)

#include <sal.h>

#else // ^^^ _WIN32 ^^^ // vvv !_WIN32 vvv
Expand All @@ -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

Expand Down
26 changes: 14 additions & 12 deletions Release/include/cpprest/details/web_utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,24 @@ class zero_memory_deleter
};
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<Windows::Storage::Streams::IBuffer ^> 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;
Expand All @@ -49,8 +50,9 @@ class win32_encryption
std::vector<char> m_buffer;
size_t m_numCharacters;
};
#endif
#endif
#endif // __cplusplus_winrt
#endif // _WIN32_WINNT >= _WIN32_WINNT_VISTA
#endif // _WIN32
} // namespace details

/// <summary>
Expand Down Expand Up @@ -89,7 +91,7 @@ class credentials
"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;
Expand All @@ -105,7 +107,7 @@ class credentials
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));
Expand All @@ -115,7 +117,7 @@ class credentials
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
Expand Down Expand Up @@ -151,13 +153,13 @@ class web_proxy
/// <summary>
/// Constructs a proxy with the default settings.
/// </summary>
web_proxy() : m_address(_XPLATSTR("")), m_mode(use_default_) {}
web_proxy() : m_address(), m_mode(use_default_) {}

/// <summary>
/// Creates a proxy with specified mode.
/// </summary>
/// <param name="mode">Mode to use.</param>
web_proxy(web_proxy_mode mode) : m_address(_XPLATSTR("")), m_mode(static_cast<web_proxy_mode_internal>(mode)) {}
web_proxy(web_proxy_mode mode) : m_address(), m_mode(static_cast<web_proxy_mode_internal>(mode)) {}

/// <summary>
/// Creates a proxy explicitly with provided address.
Expand Down
6 changes: 3 additions & 3 deletions Release/include/cpprest/http_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ typedef void* native_handle;
#include <limits>
#include <memory>

#if !defined(CPPREST_TARGET_XP)
#if _WIN32_WINNT >= _WIN32_WINNT_VISTA
#include "cpprest/oauth1.h"
#endif

Expand Down Expand Up @@ -110,7 +110,7 @@ class http_client_config
{
}

#if !defined(CPPREST_TARGET_XP)
#if _WIN32_WINNT >= _WIN32_WINNT_VISTA
/// <summary>
/// Get OAuth 1.0 configuration.
/// </summary>
Expand Down Expand Up @@ -363,7 +363,7 @@ class http_client_config
#endif

private:
#if !defined(CPPREST_TARGET_XP)
#if _WIN32_WINNT >= _WIN32_WINNT_VISTA
std::shared_ptr<oauth1::experimental::oauth1_config> m_oauth1;
#endif

Expand Down
39 changes: 21 additions & 18 deletions Release/include/cpprest/streams.h
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ _UINT_TRAIT(unsigned long long, ULLONG_MIN, ULLONG_MAX)
{ \
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) \
Expand Down Expand Up @@ -528,9 +528,12 @@ class type_parser
public:
static pplx::task<T> parse(streams::streambuf<CharType> buffer)
{
typename _type_parser_integral_traits<T>::_is_integral ii;
typename _type_parser_integral_traits<T>::_is_unsigned ui;
return _parse(buffer, ii, ui);
typedef typename _type_parser_integral_traits<T>::_is_integral ii;
typedef typename _type_parser_integral_traits<T>::_is_unsigned ui;

static_assert(ii::value || !ui::value, "type is not supported for extraction from a stream");

return _parse(buffer, ii {}, ui {});
}

private:
Expand All @@ -539,15 +542,6 @@ class type_parser
_parse_floating_point(buffer);
}

static pplx::task<T> _parse(streams::streambuf<CharType>, 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<T> _parse(streams::streambuf<CharType> buffer, std::true_type, std::false_type)
{
return type_parser<CharType, int64_t>::parse(buffer).then([](pplx::task<int64_t> op) -> T {
Expand Down Expand Up @@ -1145,8 +1139,8 @@ pplx::task<ReturnType> _type_parser_base<CharType>::_parse_input(concurrency::st
auto update = [=](pplx::task<int_type> op) -> pplx::task<bool> {
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<CharType> buf = buffer;
return buf.bumpc().then([](int_type) { return true; });
Expand Down Expand Up @@ -1314,9 +1308,18 @@ struct _double_state
template<typename FloatingPoint, typename int_type>
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<char>(ch);
return result;
}

template<typename FloatingPoint, typename int_type>
Expand Down
2 changes: 1 addition & 1 deletion Release/include/cpprest/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
7 changes: 3 additions & 4 deletions Release/include/cpprest/ws_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,7 @@ class websocket_client_callback_impl

virtual pplx::task<void> close() = 0;

virtual pplx::task<void> close(websocket_close_status close_status,
const utility::string_t& close_reason = _XPLATSTR("")) = 0;
virtual pplx::task<void> close(websocket_close_status close_status, const utility::string_t& close_reason = {}) = 0;

virtual void set_close_handler(
const std::function<void(websocket_close_status, const utility::string_t&, const std::error_code&)>&
Expand Down Expand Up @@ -478,7 +477,7 @@ class websocket_client
/// frame.</param> <param name="close_reason">While closing an established connection, an endpoint may indicate the
/// reason for closure.</param> <returns>An asynchronous operation that is completed the connection has been
/// successfully closed.</returns>
pplx::task<void> close(websocket_close_status close_status, const utility::string_t& close_reason = _XPLATSTR(""))
pplx::task<void> close(websocket_close_status close_status, const utility::string_t& close_reason = {})
{
return m_client->callback_client()->close(close_status, close_reason);
}
Expand Down Expand Up @@ -566,7 +565,7 @@ class websocket_callback_client
/// frame.</param> <param name="close_reason">While closing an established connection, an endpoint may indicate the
/// reason for closure.</param> <returns>An asynchronous operation that is completed the connection has been
/// successfully closed.</returns>
pplx::task<void> close(websocket_close_status close_status, const utility::string_t& close_reason = _XPLATSTR(""))
pplx::task<void> close(websocket_close_status close_status, const utility::string_t& close_reason = {})
{
return m_client->close(close_status, close_reason);
}
Expand Down
2 changes: 1 addition & 1 deletion Release/include/cpprest/ws_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class websocket_outgoing_message
/// </summary>
/// <param name="data">UTF-8 String containing the optional pong message.</param>
void set_pong_message(const std::string& data = {})
{
{
this->set_message_pong(concurrency::streams::container_buffer<std::string>(data));
}
#endif
Expand Down
4 changes: 2 additions & 2 deletions Release/include/pplx/pplxtasks.h
Original file line number Diff line number Diff line change
Expand Up @@ -3799,7 +3799,7 @@ class task
auto _LogWorkItemAndInvokeUserLambda(_Func&& _func) const -> decltype(_func())
{
details::_TaskWorkItemRAIILogger _LogWorkItem(this->_M_pTask->_M_taskEventLogger);
CASABLANCA_UNREFERENCED_PARAMETER(_LogWorkItem);
(void)_LogWorkItem;
return _func();
}

Expand Down Expand Up @@ -3931,7 +3931,7 @@ class task
-> 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));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#define NOMINMAX
#include <objbase.h>
#include <winsock2.h>

Expand Down
11 changes: 1 addition & 10 deletions Release/samples/BlackJack/BlackJack_Server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,4 @@ add_executable(blackjackserver

target_link_libraries(blackjackserver cpprest)

if(MSVC)
get_target_property(_srcs blackjackserver SOURCES)
if(NOT CMAKE_GENERATOR MATCHES "Visual Studio .*")
set_property(SOURCE stdafx.cpp APPEND PROPERTY OBJECT_OUTPUTS "${CMAKE_CURRENT_BINARY_DIR}/blackjack-server-stdafx.pch")
set_property(SOURCE ${_srcs} APPEND PROPERTY OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/blackjack-server-stdafx.pch")
endif()
set_source_files_properties(stdafx.cpp PROPERTIES COMPILE_FLAGS "/Ycstdafx.h /Fpblackjack-server-stdafx.pch /Zm120")
target_sources(blackjackserver PRIVATE stdafx.cpp)
target_compile_options(blackjackserver PRIVATE /Yustdafx.h /Fpblackjack-server-stdafx.pch /Zm120)
endif()
configure_pch(blackjackserver stdafx.h stdafx.cpp /Zm120)
Loading

0 comments on commit 462b710

Please sign in to comment.