Skip to content

Commit 462b710

Browse files
committed
Merge remote-tracking branch 'origin/master' into frkaya/curlhttp
2 parents ac3f314 + 2a8c17e commit 462b710

File tree

75 files changed

+589
-593
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+589
-593
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,5 @@ Build_android/build/
7373
Generated Files/
7474
# Ignore iOS temp build directories
7575
Build_iOS/Apple-Boost-BuildScript
76+
77+
/out/

.vscode/settings.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@
33
"**/.git/objects/**": true,
44
"**/.git/subtree-cache/**": true,
55
"**/node_modules/*/**": true,
6-
"**/vcpkg/**": true
7-
}
6+
"**/vcpkg/**": true,
7+
"build.x86.debug": true,
8+
"build.x86.release": true,
9+
"build.x64.debug": true,
10+
"build.x64.release": true,
11+
"out": true,
12+
},
13+
"cSpell.words": [
14+
"XPLATSTR",
15+
"blittable",
16+
"pplx",
17+
"rdpos",
18+
"rgpsz"
19+
]
820
}

Build_android/configure.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ if [ "${DO_OPENSSL}" == "1" ]; then (
155155
if [ "${DO_BOOST}" == "1" ]; then (
156156
if [ ! -d 'Boost-for-Android' ]; then git clone https://github.com/moritz-wundke/Boost-for-Android; fi
157157
cd Boost-for-Android
158-
git checkout b1e2cb397d3ec573f1cfdf4f4d965766204c53f1
158+
git checkout aed656a97fb3af7322fd2c3da5995a2d09d87d4b
159159
PATH="$PATH:$NDK_DIR" \
160160
CXXFLAGS="-std=gnu++11" \
161161
./build-android.sh \

Release/CMakeLists.txt

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ endif()
1111

1212
set(CPPREST_VERSION_MAJOR 2)
1313
set(CPPREST_VERSION_MINOR 10)
14-
set(CPPREST_VERSION_REVISION 13)
14+
set(CPPREST_VERSION_REVISION 14)
1515

1616
enable_testing()
1717

@@ -179,13 +179,20 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
179179
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4264")
180180
add_compile_options(/bigobj)
181181
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MP")
182-
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MP /profile /OPT:REF /OPT:ICF")
183-
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MP /profile /OPT:REF /OPT:ICF")
182+
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MP")
183+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MP")
184184
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MP")
185185

186+
set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "${CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL} /profile /OPT:REF /OPT:ICF")
187+
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /profile /OPT:REF /OPT:ICF")
188+
186189
if (WINDOWS_STORE OR WINDOWS_PHONE)
187190
add_compile_options(/ZW)
188191
endif()
192+
193+
if (NOT (MSVC_VERSION LESS 1920))
194+
add_compile_options(/permissive-)
195+
endif()
189196
else()
190197
message("-- Unknown compiler, success is doubtful.")
191198
message("CMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID}")
@@ -196,6 +203,28 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Binaries)
196203
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Binaries)
197204
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Binaries)
198205

206+
function(configure_pch target precompile_header precomile_source) # optional additional compile arguments
207+
if(MSVC)
208+
get_target_property(_srcs ${target} SOURCES)
209+
210+
set(pch_output_filepath_arg)
211+
if(NOT CMAKE_GENERATOR MATCHES "Visual Studio .*")
212+
set_property(SOURCE ${precomile_source} APPEND PROPERTY OBJECT_OUTPUTS "${CMAKE_CURRENT_BINARY_DIR}/${target}.pch")
213+
set_property(SOURCE ${_srcs} APPEND PROPERTY OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${target}.pch")
214+
set(pch_output_filepath_arg "/Fp${CMAKE_CURRENT_BINARY_DIR}/${target}.pch")
215+
else()
216+
# Don't specify output file so that VS may choose a config spefic location.
217+
# Otherwise Debug/Release builds will interfere with one another.
218+
endif()
219+
220+
set_source_files_properties(${precomile_source} PROPERTIES COMPILE_FLAGS "/Yc${precompile_header}")
221+
target_sources(${target} PRIVATE ${precomile_source})
222+
# Note: as ${precomile_source} is also a SOURCE for ${target}, the below options will also be applied.
223+
# ${precomile_source} has /Yc option that will cause the shared /Yu to be ignored.
224+
target_compile_options(${target} PRIVATE /Yu${precompile_header} ${pch_output_filepath_arg} ${ARGN})
225+
endif()
226+
endfunction()
227+
199228
# These settings can be used by the test targets
200229
set(Casablanca_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include)
201230
set(Casablanca_LIBRARY cpprest)

Release/include/cpprest/details/cpprest_compat.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
#define CPPREST_CONSTEXPR const
2525
#endif // _MSC_VER >= 1900
2626

27-
#define CASABLANCA_UNREFERENCED_PARAMETER(x) (x)
28-
2927
#include <sal.h>
3028

3129
#else // ^^^ _WIN32 ^^^ // vvv !_WIN32 vvv
@@ -38,7 +36,6 @@
3836
{ \
3937
if (!(x)) __builtin_unreachable(); \
4038
} while (false)
41-
#define CASABLANCA_UNREFERENCED_PARAMETER(x) (void)x
4239
#define CPPREST_NOEXCEPT noexcept
4340
#define CPPREST_CONSTEXPR constexpr
4441

Release/include/cpprest/details/web_utilities.h

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,24 @@ class zero_memory_deleter
2424
};
2525
typedef std::unique_ptr<::utility::string_t, zero_memory_deleter> plaintext_string;
2626

27-
#if defined(_WIN32) && !defined(CPPREST_TARGET_XP)
28-
#if defined(__cplusplus_winrt)
27+
#ifdef _WIN32
28+
#if _WIN32_WINNT >= _WIN32_WINNT_VISTA
29+
#ifdef __cplusplus_winrt
2930
class winrt_encryption
3031
{
3132
public:
32-
winrt_encryption() {}
33+
winrt_encryption() = default;
3334
_ASYNCRTIMP winrt_encryption(const std::wstring& data);
3435
_ASYNCRTIMP plaintext_string decrypt() const;
3536

3637
private:
3738
::pplx::task<Windows::Storage::Streams::IBuffer ^> m_buffer;
3839
};
39-
#else
40+
#else // ^^^ __cplusplus_winrt ^^^ // vvv !__cplusplus_winrt vvv
4041
class win32_encryption
4142
{
4243
public:
43-
win32_encryption() {}
44+
win32_encryption() = default;
4445
_ASYNCRTIMP win32_encryption(const std::wstring& data);
4546
_ASYNCRTIMP ~win32_encryption();
4647
_ASYNCRTIMP plaintext_string decrypt() const;
@@ -49,8 +50,9 @@ class win32_encryption
4950
std::vector<char> m_buffer;
5051
size_t m_numCharacters;
5152
};
52-
#endif
53-
#endif
53+
#endif // __cplusplus_winrt
54+
#endif // _WIN32_WINNT >= _WIN32_WINNT_VISTA
55+
#endif // _WIN32
5456
} // namespace details
5557

5658
/// <summary>
@@ -89,7 +91,7 @@ class credentials
8991
"This API is deprecated for security reasons to avoid unnecessary password copies stored in plaintext.")
9092
utility::string_t password() const
9193
{
92-
#if defined(_WIN32) && !defined(CPPREST_TARGET_XP)
94+
#if defined(_WIN32) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
9395
return utility::string_t(*m_password.decrypt());
9496
#else
9597
return m_password;
@@ -105,7 +107,7 @@ class credentials
105107
details::plaintext_string _internal_decrypt() const
106108
{
107109
// Encryption APIs not supported on XP
108-
#if defined(_WIN32) && !defined(CPPREST_TARGET_XP)
110+
#if defined(_WIN32) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
109111
return m_password.decrypt();
110112
#else
111113
return details::plaintext_string(new ::utility::string_t(m_password));
@@ -115,7 +117,7 @@ class credentials
115117
private:
116118
::utility::string_t m_username;
117119

118-
#if defined(_WIN32) && !defined(CPPREST_TARGET_XP)
120+
#if defined(_WIN32) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
119121
#if defined(__cplusplus_winrt)
120122
details::winrt_encryption m_password;
121123
#else
@@ -151,13 +153,13 @@ class web_proxy
151153
/// <summary>
152154
/// Constructs a proxy with the default settings.
153155
/// </summary>
154-
web_proxy() : m_address(_XPLATSTR("")), m_mode(use_default_) {}
156+
web_proxy() : m_address(), m_mode(use_default_) {}
155157

156158
/// <summary>
157159
/// Creates a proxy with specified mode.
158160
/// </summary>
159161
/// <param name="mode">Mode to use.</param>
160-
web_proxy(web_proxy_mode mode) : m_address(_XPLATSTR("")), m_mode(static_cast<web_proxy_mode_internal>(mode)) {}
162+
web_proxy(web_proxy_mode mode) : m_address(), m_mode(static_cast<web_proxy_mode_internal>(mode)) {}
161163

162164
/// <summary>
163165
/// Creates a proxy explicitly with provided address.

Release/include/cpprest/http_client.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ typedef void* native_handle;
5454
#include <limits>
5555
#include <memory>
5656

57-
#if !defined(CPPREST_TARGET_XP)
57+
#if _WIN32_WINNT >= _WIN32_WINNT_VISTA
5858
#include "cpprest/oauth1.h"
5959
#endif
6060

@@ -110,7 +110,7 @@ class http_client_config
110110
{
111111
}
112112

113-
#if !defined(CPPREST_TARGET_XP)
113+
#if _WIN32_WINNT >= _WIN32_WINNT_VISTA
114114
/// <summary>
115115
/// Get OAuth 1.0 configuration.
116116
/// </summary>
@@ -363,7 +363,7 @@ class http_client_config
363363
#endif
364364

365365
private:
366-
#if !defined(CPPREST_TARGET_XP)
366+
#if _WIN32_WINNT >= _WIN32_WINNT_VISTA
367367
std::shared_ptr<oauth1::experimental::oauth1_config> m_oauth1;
368368
#endif
369369

Release/include/cpprest/streams.h

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ _UINT_TRAIT(unsigned long long, ULLONG_MIN, ULLONG_MAX)
470470
{ \
471471
typedef std::true_type _is_integral; \
472472
typedef std::false_type _is_unsigned; \
473-
static const int64_t _min = std::numeric_limits<_t>::min(); \
473+
static const int64_t _min = (std::numeric_limits<_t>::min)(); \
474474
static const int64_t _max = (std::numeric_limits<_t>::max)(); \
475475
};
476476
#define _UINT_TRAIT(_t) \
@@ -528,9 +528,12 @@ class type_parser
528528
public:
529529
static pplx::task<T> parse(streams::streambuf<CharType> buffer)
530530
{
531-
typename _type_parser_integral_traits<T>::_is_integral ii;
532-
typename _type_parser_integral_traits<T>::_is_unsigned ui;
533-
return _parse(buffer, ii, ui);
531+
typedef typename _type_parser_integral_traits<T>::_is_integral ii;
532+
typedef typename _type_parser_integral_traits<T>::_is_unsigned ui;
533+
534+
static_assert(ii::value || !ui::value, "type is not supported for extraction from a stream");
535+
536+
return _parse(buffer, ii {}, ui {});
534537
}
535538

536539
private:
@@ -539,15 +542,6 @@ class type_parser
539542
_parse_floating_point(buffer);
540543
}
541544

542-
static pplx::task<T> _parse(streams::streambuf<CharType>, std::false_type, std::true_type)
543-
{
544-
#ifdef _WIN32
545-
static_assert(false, "type is not supported for extraction from a stream");
546-
#else
547-
throw std::runtime_error("type is not supported for extraction from a stream");
548-
#endif
549-
}
550-
551545
static pplx::task<T> _parse(streams::streambuf<CharType> buffer, std::true_type, std::false_type)
552546
{
553547
return type_parser<CharType, int64_t>::parse(buffer).then([](pplx::task<int64_t> op) -> T {
@@ -1145,8 +1139,8 @@ pplx::task<ReturnType> _type_parser_base<CharType>::_parse_input(concurrency::st
11451139
auto update = [=](pplx::task<int_type> op) -> pplx::task<bool> {
11461140
int_type ch = op.get();
11471141
if (ch == traits::eof()) return pplx::task_from_result(false);
1148-
bool accptd = accept_character(state, ch);
1149-
if (!accptd) return pplx::task_from_result(false);
1142+
bool accepted = accept_character(state, ch);
1143+
if (!accepted) return pplx::task_from_result(false);
11501144
// We peeked earlier, so now we must advance the position.
11511145
concurrency::streams::streambuf<CharType> buf = buffer;
11521146
return buf.bumpc().then([](int_type) { return true; });
@@ -1314,9 +1308,18 @@ struct _double_state
13141308
template<typename FloatingPoint, typename int_type>
13151309
static std::string create_exception_message(int_type ch, bool exponent)
13161310
{
1317-
std::ostringstream os;
1318-
os << "Invalid character '" << char(ch) << "'" << (exponent ? " in exponent" : "");
1319-
return os.str();
1311+
std::string result;
1312+
if (exponent)
1313+
{
1314+
result.assign("Invalid character 'X' in exponent");
1315+
}
1316+
else
1317+
{
1318+
result.assign("Invalid character 'X'");
1319+
}
1320+
1321+
result[19] = static_cast<char>(ch);
1322+
return result;
13201323
}
13211324

13221325
template<typename FloatingPoint, typename int_type>

Release/include/cpprest/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
*/
66
#define CPPREST_VERSION_MINOR 10
77
#define CPPREST_VERSION_MAJOR 2
8-
#define CPPREST_VERSION_REVISION 13
8+
#define CPPREST_VERSION_REVISION 14
99

1010
#define CPPREST_VERSION (CPPREST_VERSION_MAJOR * 100000 + CPPREST_VERSION_MINOR * 100 + CPPREST_VERSION_REVISION)

Release/include/cpprest/ws_client.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,7 @@ class websocket_client_callback_impl
330330

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

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

336335
virtual void set_close_handler(
337336
const std::function<void(websocket_close_status, const utility::string_t&, const std::error_code&)>&
@@ -478,7 +477,7 @@ class websocket_client
478477
/// frame.</param> <param name="close_reason">While closing an established connection, an endpoint may indicate the
479478
/// reason for closure.</param> <returns>An asynchronous operation that is completed the connection has been
480479
/// successfully closed.</returns>
481-
pplx::task<void> close(websocket_close_status close_status, const utility::string_t& close_reason = _XPLATSTR(""))
480+
pplx::task<void> close(websocket_close_status close_status, const utility::string_t& close_reason = {})
482481
{
483482
return m_client->callback_client()->close(close_status, close_reason);
484483
}
@@ -566,7 +565,7 @@ class websocket_callback_client
566565
/// frame.</param> <param name="close_reason">While closing an established connection, an endpoint may indicate the
567566
/// reason for closure.</param> <returns>An asynchronous operation that is completed the connection has been
568567
/// successfully closed.</returns>
569-
pplx::task<void> close(websocket_close_status close_status, const utility::string_t& close_reason = _XPLATSTR(""))
568+
pplx::task<void> close(websocket_close_status close_status, const utility::string_t& close_reason = {})
570569
{
571570
return m_client->close(close_status, close_reason);
572571
}

0 commit comments

Comments
 (0)