Skip to content

Commit

Permalink
Merge branch 'development' into clang-3-6-merge
Browse files Browse the repository at this point in the history
Conflicts:
	Build_android/libiconv/jni/Application.mk
  • Loading branch information
ras0219-msft committed Oct 29, 2015
2 parents 0e09d1d + d80c038 commit 525b189
Show file tree
Hide file tree
Showing 58 changed files with 951 additions and 530 deletions.
23 changes: 0 additions & 23 deletions Build_android/libiconv/jni/Android.mk

This file was deleted.

3 changes: 0 additions & 3 deletions Build_android/libiconv/jni/Application.mk

This file was deleted.

22 changes: 0 additions & 22 deletions Build_android/libiconv/libiconv.patch

This file was deleted.

6 changes: 6 additions & 0 deletions Build_iOS/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# iOS folders that dependencies get stored in
boostoniphone/
boost.framework/
ios-cmake/
openssl/
OpenSSL-for-iPhone/
2 changes: 2 additions & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jracle
gandziej
adish
LeonidCSIT
LocutusOfBorg
kreuzerkrieg

AutoDesk Inc.
Cyrille Fauvel (cyrillef)
Expand Down
15 changes: 14 additions & 1 deletion Release/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,20 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Binaries)

# These settings can be used by the test targets
set(Casablanca_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
set(Casablanca_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include ${Boost_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/libs/websocketpp)

find_path(WEBSOCKETPP_CONFIG websocketpp-config.cmake
HINTS /usr/lib/cmake/websocketpp)
find_path(WEBSOCKETPP_CONFIG_VERSION websocketpp-configVersion.cmake
HINTS /usr/lib/cmake/websocketpp)
if(WEBSOCKETPP_CONFIG AND WEBSOCKETPP_CONFIG_VERSION)
include(${WEBSOCKETPP_CONFIG}/websocketpp-config.cmake)
include(${WEBSOCKETPP_CONFIG}/websocketpp-configVersion.cmake)
message("-- Found websocketpp version " ${PACKAGE_VERSION} " on system")
set(Casablanca_INCLUDE_DIRS ${Casablanca_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${WEBSOCKETPP_INCLUDE_DIR})
else(WEBSOCKETPP_CONFIG AND WEBSOCKETPP_CONFIG_VERSION)
set(Casablanca_INCLUDE_DIRS ${Casablanca_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/libs/websocketpp)
message("-- websocketpp not found, using the embedded version")
endif(WEBSOCKETPP_CONFIG AND WEBSOCKETPP_CONFIG_VERSION)

set(Casablanca_LIBRARY ${LIB}cpprest)
set(Casablanca_LIBRARIES ${Casablanca_LIBRARY} ${Boost_LIBRARIES} ${Boost_FRAMEWORK})
Expand Down
5 changes: 5 additions & 0 deletions Release/include/cpprest/asyncrt_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,11 @@ namespace details
return std::unique_ptr<_Type>(new _Type(std::forward<_Arg1>(arg1), std::forward<_Arg2>(arg2), std::forward<_Arg3>(arg3)));
}

template <typename _Type, typename _Arg1, typename _Arg2, typename _Arg3, typename _Arg4>
std::unique_ptr<_Type> make_unique(_Arg1&& arg1, _Arg2&& arg2, _Arg3&& arg3, _Arg4&& arg4) {
return std::unique_ptr<_Type>(new _Type(std::forward<_Arg1>(arg1), std::forward<_Arg2>(arg2), std::forward<_Arg3>(arg3), std::forward<_Arg4>(arg4)));
}

/// <summary>
/// Cross platform utility function for performing case insensitive string comparision.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion Release/include/cpprest/base_uri.h
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ namespace web {
friend class uri_builder;

// Encodes all characters not in given set determined by given function.
static utility::string_t encode_impl(const utility::string_t &raw, const std::function<bool(int)>& should_encode);
_ASYNCRTIMP static utility::string_t __cdecl encode_impl(const utility::string_t &raw, const std::function<bool __cdecl(int)>& should_encode);

utility::string_t m_uri;
details::uri_components m_components;
Expand Down
1 change: 0 additions & 1 deletion Release/include/cpprest/details/basic_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <iostream>
#include <sstream>
#include "cpprest/details/cpprest_compat.h"
#include "cpprest/details/basic_types.h"

#ifndef _WIN32
# define __STDC_LIMIT_MACROS
Expand Down
12 changes: 3 additions & 9 deletions Release/include/cpprest/details/cpprest_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,11 @@
// No SAL on non Windows platforms
#include "cpprest/details/nosal.h"

#if defined(__APPLE__) // Settings specific to Apple
#define __cdecl
#if not defined __cdecl
#if defined cdecl
#define __cdecl __attribute__ ((cdecl))
#else

// Settings specific to Linux and Android

// Ignore cdecl on ANDROID ARM and 64bit
#if defined(__ANDROID__) && defined(__arm__) || defined(__LP64__)
#define __cdecl
#else
#define __cdecl __attribute__ ((cdecl))
#endif

#if defined(__ANDROID__)
Expand Down
2 changes: 1 addition & 1 deletion Release/include/cpprest/details/http_client_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ void http_client::build_pipeline(const uri &base_uri, const http_client_config &
m_pipeline = ::web::http::http_pipeline::create_pipeline(std::make_shared<details::http_network_handler>(base_uri, client_config));
}

#if !defined(CPPREST_TARGET_XP) && (!defined(WINAPI_FAMILY) || WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP || _MSC_VER > 1700)
#if !defined(CPPREST_TARGET_XP)
add_handler(std::static_pointer_cast<http::http_pipeline_stage>(
std::make_shared<oauth1::details::oauth1_handler>(client_config.oauth1())));
#endif
Expand Down
5 changes: 5 additions & 0 deletions Release/include/cpprest/details/http_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ namespace details
/// </summary>
utility::string_t get_default_charset(const utility::string_t &content_type);

/// <summary>
/// Helper function to get the default HTTP reason phrase for a status code.
/// </summary>
utility::string_t get_default_reason_phrase(status_code code);

/// <summary>
/// Helper functions to convert a series of bytes from a charset to utf-8 or utf-16.
/// These APIs deal with checking for and handling byte order marker (BOM).
Expand Down
30 changes: 27 additions & 3 deletions Release/include/cpprest/details/http_server_asio.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#pragma clang diagnostic ignored "-Wconversion"
#endif
#include <boost/asio.hpp>
#include <boost/asio/ssl.hpp>
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
Expand Down Expand Up @@ -57,6 +58,8 @@ class hostport_listener;
class connection
{
private:
typedef void (connection::*ResponseFuncPtr) (const http_response &response, const boost::system::error_code& ec);

std::unique_ptr<boost::asio::ip::tcp::socket> m_socket;
boost::asio::streambuf m_request_buf;
boost::asio::streambuf m_response_buf;
Expand All @@ -69,16 +72,28 @@ class connection
bool m_chunked;
std::atomic<int> m_refs; // track how many threads are still referring to this

std::unique_ptr<boost::asio::ssl::stream<boost::asio::ip::tcp::socket&>> m_ssl_stream;

public:
connection(std::unique_ptr<boost::asio::ip::tcp::socket> socket, http_linux_server* server, hostport_listener* parent)
connection(std::unique_ptr<boost::asio::ip::tcp::socket> socket, http_linux_server* server, hostport_listener* parent, bool is_https, const std::function<void(boost::asio::ssl::context&)>& ssl_context_callback)
: m_socket(std::move(socket))
, m_request_buf()
, m_response_buf()
, m_p_server(server)
, m_p_parent(parent)
, m_refs(1)
{
start_request_response();
if (is_https)
{
boost::asio::ssl::context ssl_context(boost::asio::ssl::context::sslv23);
ssl_context_callback(ssl_context);
m_ssl_stream = utility::details::make_unique<boost::asio::ssl::stream<boost::asio::ip::tcp::socket&>>(*m_socket, ssl_context);
m_ssl_stream->async_handshake(boost::asio::ssl::stream_base::server, [this](const boost::system::error_code&) { this->start_request_response(); });
}
else
{
start_request_response();
}
}

connection(const connection&) = delete;
Expand All @@ -95,6 +110,10 @@ class connection
void handle_chunked_body(const boost::system::error_code& ec, int toWrite);
void dispatch_request_to_listener();
void do_response(bool bad_request);
void async_write(ResponseFuncPtr response_func_ptr, const http_response &response);
template <typename CompletionCondition, typename Handler>
void async_read(CompletionCondition &&condition, Handler &&read_handler);
void async_read_until();
template <typename ReadHandler>
void async_read_until_buffersize(size_t size, const ReadHandler &handler);
void async_process_response(http_response response);
Expand Down Expand Up @@ -124,14 +143,19 @@ class hostport_listener
std::string m_host;
std::string m_port;

bool m_is_https;
const std::function<void(boost::asio::ssl::context&)>& m_ssl_context_callback;

public:
hostport_listener(http_linux_server* server, const std::string& hostport)
hostport_listener(http_linux_server* server, const std::string& hostport, bool is_https, const http_listener_config& config)
: m_acceptor()
, m_listeners()
, m_listeners_lock()
, m_connections_lock()
, m_connections()
, m_p_server(server)
, m_is_https(is_https)
, m_ssl_context_callback(config.get_ssl_context_callback())
{
m_all_connections_complete.set();

Expand Down
16 changes: 1 addition & 15 deletions Release/include/cpprest/details/web_utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ typedef std::unique_ptr<::utility::string_t, zero_memory_deleter> plaintext_stri

#if defined(_WIN32) && !defined(CPPREST_TARGET_XP)
#if defined(__cplusplus_winrt)
#if !(WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP && _MSC_VER < 1800)
class winrt_encryption
{
public:
Expand All @@ -58,7 +57,6 @@ class winrt_encryption
private:
::pplx::task<Windows::Storage::Streams::IBuffer ^> m_buffer;
};
#endif
#else
class win32_encryption
{
Expand Down Expand Up @@ -111,11 +109,7 @@ class credentials
utility::string_t password() const
{
#if defined(_WIN32) && !defined(CPPREST_TARGET_XP)
#if defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP && _MSC_VER < 1800
return m_password;
#else
return utility::string_t(*m_password.decrypt());
#endif
#else
return m_password;
#endif
Expand All @@ -135,13 +129,9 @@ class credentials

details::plaintext_string decrypt() const
{
// Encryption APIs not supported on Windows Phone 8.0 or XP
// Encryption APIs not supported on XP
#if defined(_WIN32) && !defined(CPPREST_TARGET_XP)
#if defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP && _MSC_VER < 1800
return details::plaintext_string(new ::utility::string_t(m_password));
#else
return m_password.decrypt();
#endif
#else
return details::plaintext_string(new ::utility::string_t(m_password));
#endif
Expand All @@ -151,11 +141,7 @@ class credentials

#if defined(_WIN32) && !defined(CPPREST_TARGET_XP)
#if defined(__cplusplus_winrt)
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP && _MSC_VER < 1800
::utility::string_t m_password;
#else
details::winrt_encryption m_password;
#endif
#else
details::win32_encryption m_password;
#endif
Expand Down
Loading

0 comments on commit 525b189

Please sign in to comment.