Skip to content

Commit 49ce8dc

Browse files
committed
Merge branch 'master' into http_compression
Conflicts: cpprestsdk140.sln
2 parents 3f876bd + 3070ca2 commit 49ce8dc

Some content is hidden

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

46 files changed

+679
-182
lines changed

Build/Common.Build.settings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
<PropertyGroup>
3737
<OutputPath>$(BuildRoot)\Binaries\$(Platform)\$(Configuration)\</OutputPath>
3838
<OutDir>$(OutputPath)</OutDir>
39+
<IntDir>$(BuildRoot)\Intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\</IntDir>
3940
<TestRoot>$(BuildRoot)\Release\Tests</TestRoot>
4041
<CasablancaSrcDir>$(BuildRoot)\Release\src</CasablancaSrcDir>
4142
<CasablancaResourceDir>$(BuildRoot)\Release\Resource</CasablancaResourceDir>

Build/Release.Product.settings

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232

3333
<PropertyGroup>
3434
<InternalIncludeDir>$(CasablancaIncludeDir)</InternalIncludeDir>
35-
<IntDir>$(BuildRoot)\Intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\</IntDir>
3635
</PropertyGroup>
3736

3837
<ItemDefinitionGroup>

Build/version.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<CppRestBaseFileName>cpprest</CppRestBaseFileName>
55
<CppRestSDKVersionMajor>2</CppRestSDKVersionMajor>
6-
<CppRestSDKVersionMinor>7</CppRestSDKVersionMinor>
6+
<CppRestSDKVersionMinor>8</CppRestSDKVersionMinor>
77
<CppRestSDKVersionRevision>0</CppRestSDKVersionRevision>
88
<CppRestSDKVersionFileSuffix>$(CppRestSDKVersionMajor)_$(CppRestSDKVersionMinor)</CppRestSDKVersionFileSuffix>
99
<CppRestSDKVersionString>$(CppRestSDKVersionMajor).$(CppRestSDKVersionMinor)</CppRestSDKVersionString>

Build_iOS/configure.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ git clone --depth=1 https://github.com/x2on/OpenSSL-for-iPhone.git
1212
pushd OpenSSL-for-iPhone
1313
./build-libssl.sh
1414
popd
15-
mkdir openssl
16-
mv OpenSSL-for-iPhone/include openssl
17-
mv OpenSSL-for-iPhone/lib openssl
15+
mkdir -p openssl/lib
16+
cp -r OpenSSL-for-iPhone/bin/iPhoneOS8.2-armv7.sdk/include openssl
17+
cp OpenSSL-for-iPhone/include/LICENSE openssl
18+
lipo -create -output openssl/lib/libssl.a OpenSSL-for-iPhone/bin/iPhone*/lib/libssl.a
19+
lipo -create -output openssl/lib/libcrypto.a OpenSSL-for-iPhone/bin/iPhone*/lib/libcrypto.a
1820

1921
git clone https://github.com/cristeab/ios-cmake.git
2022
pushd ios-cmake

CONTRIBUTORS.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,12 @@ Gery Vessere ([email protected])
3434

3535
Cisco Systems
3636
Gergely Lukacsy (glukacsy)
37+
Chris Deering (deeringc)
38+
39+
Ocedo GmbH
40+
Henning Pfeiffer (megaposer)
3741

3842
thomasschaub
43+
44+
Trimble
45+
Tim Boundy (gigaplex)

Release/CMakeLists.txt

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ elseif(WIN32)
101101
option(BUILD_SHARED_LIBS "Build shared Libraries." ON)
102102
option(BUILD_TESTS "Build tests." ON)
103103
option(BUILD_SAMPLES "Build samples." ON)
104+
option(CPPREST_EXCLUDE_WEBSOCKETS "Exclude websockets functionality." OFF)
104105
option(Boost_USE_STATIC_LIBS ON)
105106

106107
add_definitions(-DUNICODE -D_UNICODE)
@@ -114,8 +115,12 @@ elseif(WIN32)
114115
endif()
115116
add_definitions(${Casablanca_DEFINITIONS} -D_WINSOCK_DEPRECATED_NO_WARNINGS -DWIN32)
116117

117-
find_package(Boost 1.55 REQUIRED COMPONENTS random system thread filesystem chrono atomic)
118-
find_package(OpenSSL 1.0 REQUIRED)
118+
if (CPPREST_EXCLUDE_WEBSOCKETS)
119+
add_definitions(-DCPPREST_EXCLUDE_WEBSOCKETS=1)
120+
else()
121+
find_package(Boost 1.55 REQUIRED COMPONENTS random system thread filesystem chrono atomic)
122+
find_package(OpenSSL 1.0 REQUIRED)
123+
endif()
119124
else()
120125
message(FATAL_ERROR "-- Unsupported Build Platform.")
121126
endif()
@@ -134,7 +139,7 @@ elseif((CMAKE_CXX_COMPILER_ID MATCHES "Clang") OR IOS)
134139
message("-- Setting clang options")
135140

136141
set(WARNINGS "-Wall -Wextra -Wcast-qual -Wconversion -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-format-attribute -Wmissing-include-dirs -Wpacked -Wredundant-decls")
137-
set(OSX_SUPPRESSIONS "-Wno-overloaded-virtual -Wno-sign-conversion -Wno-deprecated -Wno-unknown-pragmas -Wno-reorder -Wno-char-subscripts -Wno-switch -Wno-unused-parameter -Wno-unused-variable -Wno-deprecated -Wno-unused-value -Wno-unknown-warning-option -Wno-return-type-c-linkage -Wno-unused-function -Wno-sign-compare -Wno-shorten-64-to-32 -Wno-reorder")
142+
set(OSX_SUPPRESSIONS "-Wno-overloaded-virtual -Wno-sign-conversion -Wno-deprecated -Wno-unknown-pragmas -Wno-reorder -Wno-char-subscripts -Wno-switch -Wno-unused-parameter -Wno-unused-variable -Wno-deprecated -Wno-unused-value -Wno-unknown-warning-option -Wno-return-type-c-linkage -Wno-unused-function -Wno-sign-compare -Wno-shorten-64-to-32 -Wno-reorder -Wno-unused-local-typedefs")
138143
set(WARNINGS "${WARNINGS} ${OSX_SUPPRESSIONS}")
139144

140145
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -Wno-return-type-c-linkage -Wno-unneeded-internal-declaration")
@@ -165,23 +170,34 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Binaries)
165170

166171
# These settings can be used by the test targets
167172
set(Casablanca_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
168-
169-
find_path(WEBSOCKETPP_CONFIG websocketpp-config.cmake
170-
HINTS /usr/lib/cmake/websocketpp)
171-
find_path(WEBSOCKETPP_CONFIG_VERSION websocketpp-configVersion.cmake
172-
HINTS /usr/lib/cmake/websocketpp)
173-
if(WEBSOCKETPP_CONFIG AND WEBSOCKETPP_CONFIG_VERSION)
174-
include(${WEBSOCKETPP_CONFIG}/websocketpp-config.cmake)
175-
include(${WEBSOCKETPP_CONFIG}/websocketpp-configVersion.cmake)
176-
message("-- Found websocketpp version " ${PACKAGE_VERSION} " on system")
177-
set(Casablanca_INCLUDE_DIRS ${Casablanca_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR} ${WEBSOCKETPP_INCLUDE_DIR})
178-
else(WEBSOCKETPP_CONFIG AND WEBSOCKETPP_CONFIG_VERSION)
179-
set(Casablanca_INCLUDE_DIRS ${Casablanca_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/libs/websocketpp)
180-
message("-- websocketpp not found, using the embedded version")
181-
endif(WEBSOCKETPP_CONFIG AND WEBSOCKETPP_CONFIG_VERSION)
173+
if (NOT CPPREST_EXCLUDE_WEBSOCKETS)
174+
find_path(WEBSOCKETPP_CONFIG websocketpp-config.cmake
175+
HINTS /usr/lib/cmake/websocketpp)
176+
find_path(WEBSOCKETPP_CONFIG_VERSION websocketpp-configVersion.cmake
177+
HINTS /usr/lib/cmake/websocketpp)
178+
if(WEBSOCKETPP_CONFIG AND WEBSOCKETPP_CONFIG_VERSION)
179+
include(${WEBSOCKETPP_CONFIG}/websocketpp-config.cmake)
180+
include(${WEBSOCKETPP_CONFIG}/websocketpp-configVersion.cmake)
181+
message("-- Found websocketpp version " ${PACKAGE_VERSION} " on system")
182+
set(Casablanca_INCLUDE_DIRS ${Casablanca_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR} ${WEBSOCKETPP_INCLUDE_DIR})
183+
else(WEBSOCKETPP_CONFIG AND WEBSOCKETPP_CONFIG_VERSION)
184+
set(Casablanca_INCLUDE_DIRS ${Casablanca_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/libs/websocketpp)
185+
message("-- websocketpp not found, using the embedded version")
186+
endif(WEBSOCKETPP_CONFIG AND WEBSOCKETPP_CONFIG_VERSION)
187+
else()
188+
set(Casablanca_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include)
189+
endif()
182190

183191
set(Casablanca_LIBRARY ${LIB}cpprest)
184-
set(Casablanca_LIBRARIES ${Casablanca_LIBRARY} ${Boost_LIBRARIES} ${Boost_FRAMEWORK})
192+
set(Casablanca_LIBRARIES ${Casablanca_LIBRARY}
193+
${Boost_FILESYSTEM_LIBRARY}
194+
${Boost_SYSTEM_LIBRARY}
195+
${Boost_THREAD_LIBRARY}
196+
${Boost_ATOMIC_LIBRARY}
197+
${Boost_CHRONO_LIBRARY}
198+
${Boost_RANDOM_LIBRARY}
199+
${Boost_REGEX_LIBRARY}
200+
${Boost_FRAMEWORK})
185201

186202
# Everything in the project needs access to the casablanca include directories
187203
include_directories(${Casablanca_INCLUDE_DIRS})

Release/include/cpprest/details/http_client_impl.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,10 @@ class _http_client_communicator
296296
// URI to connect to.
297297
const http::uri m_uri;
298298

299-
300-
http_client_config m_client_config;
301-
302299
private:
303300

301+
http_client_config m_client_config;
302+
304303
bool m_opened;
305304

306305
pplx::extensibility::critical_section_t m_open_lock;

Release/include/cpprest/details/http_server_httpsys.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,14 @@ struct windows_request_context : http::details::_http_server_context
9999
// Dispatch request to the provided http_listener.
100100
void dispatch_request_to_listener(_In_ web::http::experimental::listener::details::http_listener_impl *pListener);
101101

102+
enum class ShouldWaitForBody
103+
{
104+
Wait,
105+
DontWait
106+
};
107+
// Initialise the response task callbacks. If the body has been requested, we should wait for it to avoid race conditions.
108+
void init_response_callbacks(ShouldWaitForBody shouldWait);
109+
102110
// Read in a portion of the request body.
103111
void read_request_body_chunk();
104112

Release/include/cpprest/http_client.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ class http_client_config
101101
, m_set_user_nativehandle_options([](native_handle)->void{})
102102
#if !defined(_WIN32) && !defined(__cplusplus_winrt)
103103
, m_ssl_context_callback([](boost::asio::ssl::context&)->void{})
104+
, m_tlsext_sni_enabled(true)
104105
#endif
105106
#if defined(_WIN32) && !defined(__cplusplus_winrt)
106107
, m_buffer_request(false)
@@ -369,6 +370,25 @@ class http_client_config
369370
{
370371
return m_ssl_context_callback;
371372
}
373+
374+
/// <summary>
375+
/// Gets the TLS extension server name indication (SNI) status.
376+
/// </summary>
377+
/// <returns>True if TLS server name indication is enabled, false otherwise.</returns>
378+
bool is_tlsext_sni_enabled() const
379+
{
380+
return m_tlsext_sni_enabled;
381+
}
382+
383+
/// <summary>
384+
/// Sets the TLS extension server name indication (SNI) status.
385+
/// </summary>
386+
/// <param name="tlsext_sni_enabled">False to disable the TLS (ClientHello) extension for server name indication, true otherwise.</param>
387+
/// <remarks>Note: This setting is enabled by default as it is required in most virtual hosting scenarios.</remarks>
388+
void set_tlsext_sni_enabled(bool tlsext_sni_enabled)
389+
{
390+
m_tlsext_sni_enabled = tlsext_sni_enabled;
391+
}
372392
#endif
373393

374394
private:
@@ -394,6 +414,7 @@ class http_client_config
394414

395415
#if !defined(_WIN32) && !defined(__cplusplus_winrt)
396416
std::function<void(boost::asio::ssl::context&)> m_ssl_context_callback;
417+
bool m_tlsext_sni_enabled;
397418
#endif
398419
#if defined(_WIN32) && !defined(__cplusplus_winrt)
399420
bool m_buffer_request;

Release/include/cpprest/oauth1.h

100644100755
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#define _CASA_OAUTH1_H
2929

3030
#include "cpprest/http_msg.h"
31+
#include "cpprest/details/web_utilities.h"
3132

3233
namespace web
3334
{
@@ -479,6 +480,24 @@ class oauth1_config
479480
/// </summary>
480481
void clear_parameters() { m_parameters_to_sign.clear(); }
481482

483+
/// <summary>
484+
/// Get the web proxy object
485+
/// </summary>
486+
/// <returns>A reference to the web proxy object.</returns>
487+
const web_proxy& proxy() const
488+
{
489+
return m_proxy;
490+
}
491+
492+
/// <summary>
493+
/// Set the web proxy object that will be used by token_from_code and token_from_refresh
494+
/// </summary>
495+
/// <param name="proxy">A reference to the web proxy object.</param>
496+
void set_proxy(const web_proxy& proxy)
497+
{
498+
m_proxy = proxy;
499+
}
500+
482501
private:
483502
friend class web::http::client::http_client_config;
484503
friend class web::http::oauth1::details::oauth1_handler;
@@ -532,6 +551,8 @@ class oauth1_config
532551

533552
std::map<utility::string_t, utility::string_t> m_parameters_to_sign;
534553

554+
web::web_proxy m_proxy;
555+
535556
utility::nonce_generator m_nonce_generator;
536557
bool m_is_authorization_completed;
537558
};

0 commit comments

Comments
 (0)