Skip to content

Development #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
35a64f5
Added CMake macro to disable websockets functionality on Windows
ras0219 Oct 2, 2015
6e07ff3
Only use PCH when using MSBuild
ras0219 Oct 2, 2015
1dc9934
Add unsolicited pong support with integration tests
glukacsycisco Nov 10, 2015
0292c7c
Refactor the response handling in http_server_httpsys to fix some iss…
gigaplex Nov 12, 2015
94ab404
Fix a couple of race conditions, and use enum instead of bool
gigaplex Nov 13, 2015
a1c52e5
Avoid another unobserved exception handler situation, and add an asse…
gigaplex Nov 13, 2015
11fa3ee
Move the callback that breaks the http_response circular reference so…
gigaplex Nov 13, 2015
0685728
Work around leak of http_request when _complete is never called
gigaplex Nov 13, 2015
90ebeb4
Fix accidental tab
gigaplex Nov 13, 2015
3cb4da7
Fix another accidental tab indent
gigaplex Nov 18, 2015
6c82566
Update CONTRIBUTORS.txt
gigaplex Nov 25, 2015
6a3617a
Added "-Wno-error" and "-Wno-unused-local-typedefs" to the clang supp…
rinoseminara Nov 26, 2015
cabb753
Static lib for uwp
Nov 27, 2015
612f40e
merge with origin
Nov 27, 2015
3c41279
Merge branch 'simonferquel-static_lib_uwp' into development
kavyako Nov 30, 2015
218b965
Merge branch 'pongsupport' of https://github.com/glukacsy/cpprestsdk …
kavyako Dec 1, 2015
32d4a4c
Do not expose set_pong_message on WinRT
kavyako Dec 2, 2015
907b6e6
Merge branch 'glukacsy-pongsupport' into development
kavyako Dec 2, 2015
725c941
Enum classes are preferred to avoid implicit conversions
ras0219-msft Dec 3, 2015
c966484
Minor cleanup
ras0219-msft Dec 3, 2015
20e7d75
Merge branch 'master' of https://github.com/rinopazzo/cpprestsdk into…
kavyako Dec 3, 2015
abfe6a3
--Wno-error is not required, remove it.
kavyako Dec 3, 2015
b099cce
Merge branch 'rinopazzo-master' into development
kavyako Dec 3, 2015
dad24c1
Change the cpprest140_uwp static lib name to libcpprest140..lib
kavyako Dec 7, 2015
8f3a60d
Merge remote-tracking branch 'github/staging' into development
ras0219-msft Dec 7, 2015
63a455b
Merge remote-tracking branch 'origin/master'
ras0219 Dec 8, 2015
61d14bf
Remove use of boost in tests if on windows and excluding websockets
ras0219 Dec 9, 2015
fa9f015
Do not build websocket tests if excluding websockets
ras0219 Dec 9, 2015
4ffcad6
Merge pull request #30 from ras0219/master
kavyako Dec 9, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ Cisco Systems
Gergely Lukacsy (glukacsy)

thomasschaub

Trimble
Tim Boundy (gigaplex)
42 changes: 25 additions & 17 deletions Release/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ elseif(WIN32)
option(BUILD_SHARED_LIBS "Build shared Libraries." ON)
option(BUILD_TESTS "Build tests." ON)
option(BUILD_SAMPLES "Build samples." ON)
option(CPPREST_EXCLUDE_WEBSOCKETS "Exclude websockets functionality." OFF)
option(Boost_USE_STATIC_LIBS ON)

add_definitions(-DUNICODE -D_UNICODE)
Expand All @@ -114,8 +115,12 @@ elseif(WIN32)
endif()
add_definitions(${Casablanca_DEFINITIONS} -D_WINSOCK_DEPRECATED_NO_WARNINGS -DWIN32)

find_package(Boost 1.55 REQUIRED COMPONENTS random system thread filesystem chrono atomic)
find_package(OpenSSL 1.0 REQUIRED)
if (CPPREST_EXCLUDE_WEBSOCKETS)
add_definitions(-DCPPREST_EXCLUDE_WEBSOCKETS=1)
else()
find_package(Boost 1.55 REQUIRED COMPONENTS random system thread filesystem chrono atomic)
find_package(OpenSSL 1.0 REQUIRED)
endif()
else()
message(FATAL_ERROR "-- Unsupported Build Platform.")
endif()
Expand All @@ -134,7 +139,7 @@ elseif((CMAKE_CXX_COMPILER_ID MATCHES "Clang") OR IOS)
message("-- Setting clang options")

set(WARNINGS "-Wall -Wextra -Wcast-qual -Wconversion -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-format-attribute -Wmissing-include-dirs -Wpacked -Wredundant-decls")
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")
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")
set(WARNINGS "${WARNINGS} ${OSX_SUPPRESSIONS}")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -Wno-return-type-c-linkage -Wno-unneeded-internal-declaration")
Expand Down Expand Up @@ -165,20 +170,23 @@ 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)

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} ${OPENSSL_INCLUDE_DIR} ${WEBSOCKETPP_INCLUDE_DIR})
else(WEBSOCKETPP_CONFIG AND WEBSOCKETPP_CONFIG_VERSION)
set(Casablanca_INCLUDE_DIRS ${Casablanca_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/libs/websocketpp)
message("-- websocketpp not found, using the embedded version")
endif(WEBSOCKETPP_CONFIG AND WEBSOCKETPP_CONFIG_VERSION)
if (NOT CPPREST_EXCLUDE_WEBSOCKETS)
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} ${OPENSSL_INCLUDE_DIR} ${WEBSOCKETPP_INCLUDE_DIR})
else(WEBSOCKETPP_CONFIG AND WEBSOCKETPP_CONFIG_VERSION)
set(Casablanca_INCLUDE_DIRS ${Casablanca_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/libs/websocketpp)
message("-- websocketpp not found, using the embedded version")
endif(WEBSOCKETPP_CONFIG AND WEBSOCKETPP_CONFIG_VERSION)
else()
set(Casablanca_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include)
endif()

set(Casablanca_LIBRARY ${LIB}cpprest)
set(Casablanca_LIBRARIES ${Casablanca_LIBRARY} ${Boost_LIBRARIES} ${Boost_FRAMEWORK})
Expand Down
8 changes: 8 additions & 0 deletions Release/include/cpprest/details/http_server_httpsys.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ struct windows_request_context : http::details::_http_server_context
// Dispatch request to the provided http_listener.
void dispatch_request_to_listener(_In_ web::http::experimental::listener::details::http_listener_impl *pListener);

enum class ShouldWaitForBody
{
Wait,
DontWait
};
// Initialise the response task callbacks. If the body has been requested, we should wait for it to avoid race conditions.
void init_response_callbacks(ShouldWaitForBody shouldWait);

// Read in a portion of the request body.
void read_request_body_chunk();

Expand Down
21 changes: 21 additions & 0 deletions Release/include/cpprest/ws_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ class websocket_outgoing_message
{
public:

#if !defined(__cplusplus_winrt)
/// <summary>
/// Sets a the outgoing message to be an unsolicited pong message.
/// This is useful when the client side wants to check whether the server is alive.
/// </summary>
void set_pong_message()
{
this->set_message_pong();
}
#endif

/// <summary>
/// Sets a UTF-8 message as the message body.
/// </summary>
Expand Down Expand Up @@ -152,6 +163,16 @@ class websocket_outgoing_message

const pplx::task_completion_event<void> & body_sent() const { return m_body_sent; }

#if !defined(__cplusplus_winrt)
void set_message_pong()
{
concurrency::streams::container_buffer<std::string> buffer("");
m_msg_type = websocket_message_type::pong;
m_length = static_cast<size_t>(buffer.size());
m_body = buffer;
}
#endif

void set_message(const concurrency::streams::container_buffer<std::string> &buffer)
{
m_msg_type = websocket_message_type::text_message;
Expand Down
13 changes: 10 additions & 3 deletions Release/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
include_directories(pch ${OPENSSL_INCLUDE_DIR})
include_directories(../include pch)
if (NOT CPPREST_EXCLUDE_WEBSOCKETS)
include_directories(${Boost_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR})
endif()

set(SOURCES_COMMON
http/client/http_client_msg.cpp
Expand Down Expand Up @@ -67,8 +70,12 @@ elseif(WIN32)
httpapi.lib
Winhttp.lib
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNINGS} /Yustdafx.h /Zm200")
set_source_files_properties(pch/stdafx.cpp PROPERTIES COMPILE_FLAGS "/Ycstdafx.h")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNINGS}")
if (${CMAKE_GENERATOR} MATCHES "Visual Studio .*")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Yustdafx.h /Zm200")
set_source_files_properties(pch/stdafx.cpp PROPERTIES COMPILE_FLAGS "/Ycstdafx.h")
endif()

if (BUILD_SHARED_LIBS)
add_definitions(-D_ASYNCRT_EXPORT -D_PPLX_EXPORT -D_USRDLL)
endif()
Expand Down
110 changes: 110 additions & 0 deletions Release/src/build/vs14.uwp/cpprestsdk140.uwp.staticlib.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), build.root))\Build\version.props" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{47A5CFDC-C244-45A6-9830-38CB303CB495}</ProjectGuid>
<Keyword>StaticLibrary</Keyword>
<DefaultLanguage>en-US</DefaultLanguage>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
<AppContainerApplication>true</AppContainerApplication>
<ApplicationType>Windows Store</ApplicationType>
<ApplicationTypeRevision>8.2</ApplicationTypeRevision>
<ProjectName>cpprestsdk140.uwp.staticlib</ProjectName>
<PlatformToolset>v140</PlatformToolset>
<ConfigurationType>StaticLibrary</ConfigurationType>
<OutDir>$(OutDir)\$(MsBuildProjectName)</OutDir>
<WindowsTargetPlatformVersion>10.0.10240.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.10240.0</WindowsTargetPlatformMinVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), build.root))\Build\Config.Definitions.props" />
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), build.root))\Build\Release.Product.Settings" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
<Import Project="..\common.vcxitems" Label="Shared" />
<Import Project="..\winrt.vcxitems" Label="Shared" />
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<DebugFileSuffix>d</DebugFileSuffix>
</PropertyGroup>
<PropertyGroup>
<TargetName>lib$(CppRestBaseFileName)140$(DebugFileSuffix)_uwp_$(CppRestSDKVersionFileSuffix)</TargetName>
</PropertyGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<PropertyGroup>
<GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>_NO_ASYNCRTIMP;_NO_PPLXIMP;_USRDLL;%(PreprocessorDefinitions);</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalIncludeDirectories>$(CasablancaIncludeDir);$(CasablancaSrcDir)\pch;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
<AdditionalOptions>-Zm250 /bigobj %(AdditionalOptions)</AdditionalOptions>
<WholeProgramOptimization Condition="'$(Configuration)'=='Release'">true</WholeProgramOptimization>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<LinkTimeCodeGeneration Condition="'$(Configuration)'=='Release'">UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ItemDefinitionGroup>
<PostBuildEvent>
<Command>copy /Y $(OutDir)\* $(OutDir)..\
exit 0</Command>
<Message>Copying $(TargetName).winrt binaries to OutDir and removing appcontainer flag</Message>
</PostBuildEvent>
<Lib>
<TargetMachine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MachineX86</TargetMachine>
</Lib>
<Lib>
<TargetMachine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MachineX86</TargetMachine>
</Lib>
<Lib>
<TargetMachine Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">MachineX64</TargetMachine>
</Lib>
<Lib>
<TargetMachine Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MachineX64</TargetMachine>
</Lib>
</ItemDefinitionGroup>
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
2 changes: 1 addition & 1 deletion Release/src/http/listener/http_listener_msg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pplx::task<void> details::_http_request::_reply_impl(http_response response)
{
// Add a task-based continuation so no exceptions thrown from the task go 'unobserved'.
response._set_server_context(std::move(m_server_context));
response_completed = experimental::details::http_server_api::server_api()->respond(response);
response_completed = server_api->respond(response);
response_completed.then([](pplx::task<void> t)
{
try { t.wait(); } catch(...) {}
Expand Down
Loading