GithubHelp home page GithubHelp logo

microsoft / cpprestsdk Goto Github PK

View Code? Open in Web Editor NEW
7.8K 7.8K 1.6K 10.81 MB

The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.

License: Other

Shell 0.32% Makefile 0.16% CMake 1.29% C++ 96.77% C 0.65% HTML 0.42% CSS 0.07% JavaScript 0.32%
async asynchronous-tasks cloud cpp cpp-library cpp11 http oauth oauth2 sdk tasks websockets

cpprestsdk's Introduction

cpprestsdk is in maintenance mode and we do not recommend its use in new projects. We will continue to fix critical bugs and address security issues.

Welcome!

The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.

Getting Started

Vcpkg package
Homebrew package
Ubuntu 18.04 package
Fedora Rawhide package
openSUSE Tumbleweed package
Debian Testing package

Build Status

With vcpkg on Windows

PS> vcpkg install cpprestsdk cpprestsdk:x64-windows

With apt-get on Debian/Ubuntu

$ sudo apt-get install libcpprest-dev

With dnf on Fedora

$ sudo dnf install cpprest-devel

With brew on OSX

$ brew install cpprestsdk

With NuGet on Windows for Android

PM> Install-Package cpprestsdk.android

For other platforms, install options, how to build from source, and more, take a look at our Documentation.

Once you have the library, look at our tutorial to use the http_client. It walks through how to setup a project to use the C++ Rest SDK and make a basic Http request.

To use from CMake:

cmake_minimum_required(VERSION 3.9)
project(main)

find_package(cpprestsdk REQUIRED)

add_executable(main main.cpp)
target_link_libraries(main PRIVATE cpprestsdk::cpprest)

What's in the SDK:

  • Features - HTTP client/server, JSON, URI, asynchronous streams, WebSockets client, oAuth
  • PPL Tasks - A powerful model for composing asynchronous operations based on C++ 11 features
  • Platforms - Windows desktop, Windows Store (UWP), Linux, OS X, Unix, iOS, and Android
  • Support for Visual Studio 2015 and 2017 with debugger visualizers

Contribute Back!

Is there a feature missing that you'd like to see, or found a bug that you have a fix for? Or do you have an idea or just interest in helping out in building the library? Let us know and we'd love to work with you. For a good starting point on where we are headed and feature ideas, take a look at our requested features and bugs.

Big or small we'd like to take your contributions back to help improve the C++ Rest SDK for everyone.

Having Trouble?

We'd love to get your review score, whether good or bad, but even more than that, we want to fix your problem. If you submit your issue as a Review, we won't be able to respond to your problem and ask any follow-up questions that may be necessary. The most efficient way to do that is to open an issue in our issue tracker.

Quick Links

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

cpprestsdk's People

Contributors

alexkaratarakis avatar antonbikineev avatar arturl avatar barcharcraz avatar billyoneal avatar c72578 avatar chris0x44 avatar deeringc avatar epistor avatar evancui-zz avatar garethsb avatar georgemp avatar gigaplex avatar gvessere avatar halex2005 avatar hanzhumsft avatar hohong avatar imolbrody avatar ioannis-e avatar jicailiu avatar jordanrudd avatar kavyako avatar locutusofborg avatar mobileben avatar ras0219 avatar ras0219-msft avatar reneme avatar stgates avatar vadz avatar zhelu2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cpprestsdk's Issues

SSE (Server Sent Events) implementation

Hi, I would like to know if it is possible to implement an SSE protocol on top of Casablanca, the main idea would be to send multiple replies to an web::http::http_request object whenever new data arrives to be distributed to a connected client, since I cannot use the reply() method multiple times what would be the right way to do it?

I have also tried to use the set_response_stream method on web::http::http_request but I have an exception in this case. Is it doable using Casablanca?

    void wwwReports(web::http::http_request request){
        json::value reply;
        Concurrency::streams::basic_ostream<unsigned char> dataStream;
        request.set_response_stream(dataStream);
        dataStream.write("data: ");
        dataStream.write("test1\n");
    }

Thanks for your attention,

selecting proxy authentication type

Hello everyone,

we are using the cpp rest sdk (currently version 2.4) in an http client using ssl within a bigger project where we allow users to specify ip and port of a proxy server and in addition the authentication method they want to use/allow (basic or ntlm). It seems like the authentication method within the rest sdk is done automatically (ChooseAuthScheme in http_client_winhttp.cpp) depending on the capabilities of the proxy server. So in our scenario it is possible for our users to (erroneously) specify IP and port address of a server that only allows basic auth while specifying ntlm as their only and preferred auth method. However, the cpp rest sdk code will happily detect that the proxy server that the user chose only supports basic auth and so it will use basic auth and reveal users' credentials. Is there a way to use the http client functionality in such a way that we can specify not only ip address, port and proxy credentials but also to specify the authentication method we prefer, so that a client call will fail if the server doesn't support the auth method we specified?

Any help appreciated,

Stefan Kuhr

Proxy support on Linux

Hi, I'm having trouble getting connections through a web proxy to work on Linux (RHEL 7.1). I'm specifying the proxy by URI:

            web::web_proxy proxy("http://my_proxy_ip_address:my_proxy_port_number");
            web::http::client::http_client_config client_config;
            client_config.set_proxy(proxy);
            web::http::client::http_client client(baseUri, client_config);

I saw that one of the proxy unit tests was marked as Ignore on Linux. Is proxy supported on Linux?
Any help would be appreciated.
-Alex

TLS1.2 through WinHttpSetOption on winhttp_client

I need to activate TLS1.2 in Casablanca on Windows. The only way I have found to do this is actually recompile the cpprest120_2_7.dll with the following lines in the open() function of winhttp_client:

// Open session and connection with the server.
unsigned long open()
{
    ..........

    DWORD protocols = WINHTTP_FLAG_SECURE_PROTOCOL_SSL3 | WINHTTP_FLAG_SECURE_PROTOCOL_TLS1 | WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1 | WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2;
    if(!WinHttpSetOption(m_hSession, WINHTTP_OPTION_SECURE_PROTOCOLS, &protocols, sizeof(protocols)))
    {
        return report_failure(_XPLATSTR("Error setting protocols"));
    }

    ........

}

This works, so far so good, but it needs recompilation of cpprest120_2_7.dll and this is surely not right way to go when it concerns future updates of the SDK.

I have also tried to use the set_nativehandle_options to do these settings so I don't have to recompile the cpprest120_2_7.dll, but unfortunately this native handle concerns only the request handle (in the send_request function) and not the session handle.

Is there any way to enable TLS1.2 without recompilation of cpprest120_2_7.dll? And if not, can also a callback function like set_nativehandle_options in the open function be implemented in the standard release of the SDK that exposes the session handle and I can use WinHttpSetOption in my own software on this session handle?

new user issue (Tutorial problems)

Tutorial URL:
https://github.com/Microsoft/cpprestsdk/wiki/How-to-use-the-C---Rest-SDK-NuGet-package

I'm not sure where else to post this where a new cpprest user might see it. Until recently, I was avoiding upgrading my very very old Visual C++ 6.0 running on XP which still served my needs ... Github and NuGet and Azure are all new to me. I tried both 2013 and 2015 VS express for desktop with essentially similar problems and am posting my "solution" here for any who may be also failing to get the cpprestsdk tutorial to work.

The "problem" I suppose would have never been so frustrating if the default IDE settings for Visual Studio did not have such a short output window at the bottom of the screen. Essentially, the NuGet script output said that the cpprest package had been installed successfully and I moved on to the next tutorial step and faced a myriad of problems. I guess I should have scrolled up or expanded the output window to read all of the output, but when a script says success or "0 errors" at the end, I am predisposed to move on. At any rate, regardless of the script's success output, there was an error in the NuGet script output that had well scrolled out of the output window before the script claimed success. The error essentially said that running scripts was disabled on my computer (which was essentially a new VM so everything is default, including the Visual Studio installations).

At this point, Googling led to a solution (where Googling the various errors I was getting compile-time and link-time trying the tutorial was wasted time). All documentation I've read so far on various MS and MS-related sites says things like "The package also contains a dependency on C++ REST SDK, which will also be automatically installed by NuGet." ... nothing could I find anywhere explained that default installations essentially make NuGet inoperable, and of course it doesn't help when a script says success even though there were errors in the above wall of text preceding the final line.

Here is a link to what resolved the issue:
http://superuser.com/questions/106360/how-to-enable-execution-of-powershell-scripts

Also of note, I had to exit and restart Visual Studio before the policy change took effect.

If there is any info even remotely similar to this in the cpprest documentation or the tutorial or elsewhere on this or a related site, I simply could not find it.

Hope this helps someone.

SEC_E_BUFFER_TOO_SMALL error

I get sometimes (randomly) an error on using http_request on http_client.
The error occurs in completion_callback in the line:
p_request_context->report_error(errorCode, build_error_msg(error_result));
The error code is ox80090321: meaning SEC_E_BUFFER_TOO_SMALL

I have no clue how I could track the error.

Any help or advice is greatly appreciated!

Reading the headers in a websocket client

Hi,
I am trying to read the headers right after the connect() in a websocket client app (rest-sdk 2.6).
auto config = client->config();
auto headers = config.headers();

The connect was successful, but the headers are always empty even if I can see them from wireshark.

As an additional information, I can't even see the server name (by default I understood that it should show up).
auto server_name = config.server_name();

My final target is to access the "Sec-WebSocket-Accept" string which should be used as an unique identifier of the connection.

Thank you

Double delete in wspp_callback_client destructor?

Hi,

We have this weird issue that users report crashes, but so far all my tries to reproduce it failed. The crash seems to be happening in the destructor of the websocket callback client and the stacktraces are always the same, here is one for example:

Thread 64 Crashed:: Dispatch queue: com.apple.root.default-qos
0 libsystem_kernel.dylib 0x00007fff960630ae __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fff96cc6500 pthread_kill + 90
2 libsystem_c.dylib 0x00007fff9a11c41b __abort + 145
3 libsystem_c.dylib 0x00007fff9a11c38a abort + 144
4 libc++abi.dylib 0x00007fff8bc52f81 abort_message + 257
5 libc++abi.dylib 0x00007fff8bc7896a default_terminate_handler() + 46
6 com.cisco.SparkMacDesktop 0x000000010261ad09 CLSTerminateHandler() + 270
7 libc++abi.dylib 0x00007fff8bc7619e std::__terminate(void (_)()) + 8
8 libc++abi.dylib 0x00007fff8bc7622d std::terminate() + 77
9 libcpprest.2.7.dylib 0x00000001033b1ba9 web::websockets::client::details::wspp_callback_client::~wspp_callback_client() + 889
10 libc++.1.dylib 0x00007fff90411cb8 std::__1::__shared_weak_count::__release_shared() + 44
11 com.cisco.SparkMacDesktop 0x000000010275ba4f MercuryManager::_websocketConnect(int) + 1705
12 com.cisco.SparkMacDesktop 0x0000000102675e75 std::__1::__function::__func<pplx::details::_MakeVoidToUnitFunc(std::__1::function<void ()> const&)::'lambda'(), std::__1::allocator<pplx::details::_MakeVoidToUnitFunc(std::__1::function<void ()> const&)::'lambda'()>, unsigned char ()>::operator()() + 13
13 com.cisco.SparkMacDesktop 0x00000001027619f9 pplx::details::_PPLTaskHandle<unsigned char, pplx::task::_InitialTaskHandle<void, MercuryManager::websocketConnect(int)::$_0, pplx::details::_TypeSelectorNoAsync>, pplx::details::_TaskProcHandle>::invoke() const + 265
14 com.cisco.SparkMacDesktop 0x00000001026508f3 pplx::details::_TaskProcHandle::RunChoreBridge(void) + 19
15 libdispatch.dylib 0x00007fff95f123c3 _dispatch_client_callout + 8
16 libdispatch.dylib 0x00007fff95f16253 _dispatch_root_queue_drain + 1890
17 libdispatch.dylib 0x00007fff95f15ab8 _dispatch_worker_thread3 + 91
18 libsystem_pthread.dylib 0x00007fff96cc34f2 _pthread_wqthread + 1129
19 libsystem_pthread.dylib 0x00007fff96cc1375 start_wqthread + 13

Now, the interesting bit is that i see from the Casablanca code that some engineer might have run into this issue before because there seems to be a specific attempt to "handle" this:

...
switch (m_state) {
case DESTROYED:
// This should be impossible
std::abort();
...

(I am not fully sure this actually works cause if the object is indeed dead then accessing m_state might be a bad idea already, but anyway, that's not the point I am trying to make here).

Based on the stacktrace and the code in ws_client_wspp.cpp it looks like a smoking gun: someone tries to double delete the object and the hard coded abort() is getting fired.

Now, as much as we can ever be sure, I am pretty-pretty sure that we, the consuming app, is not doing this double delete. We create a unique pointer to a Web socket callback client and when we get the close handler invoked (set up via set_close_handler), for example if I lose network, then we create a new PPL task, wait a bit and attempt to restore the websocket connection. The way we do that is that we create a brand new callback client (with make_unique) and replace the existing member field with this new pointer. At this point the old callback client - now in CLOSED state - is released and its destructor is called.

I simply see no C++ way how can the destructor can be invoked twice. Do you guys have any idea what's going on here? I presume there were some issues in this area and that's why the codepath is there in the destructor with abort?

Regards,
Gergely

Splitting C++ REST SDK

I was facing somewhat annoying "issue". sometimes I just need the PPLX, sometimes just to parse or create a piece of JSON. But whatever I need I have to add the whole C++ REST SDK NuGet package. Not a big issue but maybe it is a good idea to have the PPLX and JSON as standalone packages?
In addition, the PPLX is not a full port of PPL, for example it has no parallel algorithms or parallel_invoke functionality, any plans to add it?

http_client Connect to HTTPS server

I've a webservice running in node.js under the protocol HTTPS.
Could someone give an insight of how to perform this connection? I can't figure it out.

Thanks in regards.

TestRunner.exe never created and BingRequest program always throws exception

An exception is always thrown in the wait entered in the BingRequest demo. I gave it a search string and a file name that I believe were valid, so I'm ruling out "garbage in, garbage out" as a problem.

Build always fails, but building again succeeds, probably because DevStudio does not get the dependencies right.

Using VS2013, v120 build tools, x64, Windows 10.

are the http request/response of casablanca multithreaded in a COM STA object ?i.e do the task of casablanca run parallel in a COM STA object ?

Hi,
I make http request/response (and upload of file too ) with casablanca in a COM STA object. (an outlook addin)
it seems to block the software ( I cannot do something else and must wait,it freezes).

the following code is in a send(...) function in my STA COM object:

client.request(requete).then([this](task<http_response> responseTask)
{
http_response response;

                try
                {

                    response = responseTask.get();
                }
                catch (const http_exception &e)
                ...

does casablanca run well and parallel in a COM STA object ? shall I do something more to run my tasks parallel ?

or should I use atlserver library(or winhttp) and win32 instead of casablanca for http requests and multithreading(win32) in my COM object ?
(I will still use casablanca to parse the json in the responses.)

Make error on Ubuntu 15.10 (undefined reference to boost::filesystem::path_traits::dispatch)

Hi,

Was following the Linux build instructions on a brand new cloud instance of Ubuntu 15.10 (at Google compute engine). Came to this nasty looking problem in the make step.

Please help!

Kind regards,
David

~/casablanca/Release/build.release$ make

Scanning dependencies of target cpprest
[  0%] Building CXX object src/CMakeFiles/cpprest.dir/http/client/http_client_msg.cpp.o
[  1%] Building CXX object src/CMakeFiles/cpprest.dir/http/client/x509_cert_utilities.cpp.o
[  2%] Building CXX object src/CMakeFiles/cpprest.dir/http/common/http_helpers.cpp.o
[  3%] Building CXX object src/CMakeFiles/cpprest.dir/http/common/http_msg.cpp.o
[  3%] Building CXX object src/CMakeFiles/cpprest.dir/http/listener/http_listener.cpp.o
[  4%] Building CXX object src/CMakeFiles/cpprest.dir/http/listener/http_listener_msg.cpp.o
[  5%] Building CXX object src/CMakeFiles/cpprest.dir/http/listener/http_server_api.cpp.o
[  5%] Building CXX object src/CMakeFiles/cpprest.dir/http/oauth/oauth1.cpp.o
[  6%] Building CXX object src/CMakeFiles/cpprest.dir/http/oauth/oauth2.cpp.o
[  7%] Building CXX object src/CMakeFiles/cpprest.dir/json/json.cpp.o
[  8%] Building CXX object src/CMakeFiles/cpprest.dir/json/json_parsing.cpp.o
[  8%] Building CXX object src/CMakeFiles/cpprest.dir/json/json_serialization.cpp.o
[  9%] Building CXX object src/CMakeFiles/cpprest.dir/pplx/pplx.cpp.o
[ 10%] Building CXX object src/CMakeFiles/cpprest.dir/uri/uri.cpp.o
[ 10%] Building CXX object src/CMakeFiles/cpprest.dir/uri/uri_builder.cpp.o
[ 11%] Building CXX object src/CMakeFiles/cpprest.dir/uri/uri_parser.cpp.o
[ 12%] Building CXX object src/CMakeFiles/cpprest.dir/utilities/asyncrt_utils.cpp.o
[ 13%] Building CXX object src/CMakeFiles/cpprest.dir/utilities/base64.cpp.o
[ 13%] Building CXX object src/CMakeFiles/cpprest.dir/utilities/web_utilities.cpp.o
[ 14%] Building CXX object src/CMakeFiles/cpprest.dir/websockets/client/ws_msg.cpp.o
[ 15%] Building CXX object src/CMakeFiles/cpprest.dir/websockets/client/ws_client.cpp.o
[ 16%] Building CXX object src/CMakeFiles/cpprest.dir/websockets/client/ws_client_wspp.cpp.o
[ 16%] Building CXX object src/CMakeFiles/cpprest.dir/streams/fileio_posix.cpp.o
[ 17%] Building CXX object src/CMakeFiles/cpprest.dir/pplx/threadpool.cpp.o
[ 18%] Building CXX object src/CMakeFiles/cpprest.dir/http/client/http_client_asio.cpp.o
[ 18%] Building CXX object src/CMakeFiles/cpprest.dir/http/listener/http_server_asio.cpp.o
[ 19%] Building CXX object src/CMakeFiles/cpprest.dir/pplx/pplxlinux.cpp.o
Linking CXX shared library ../Binaries/libcpprest.so
[ 19%] Built target cpprest
Scanning dependencies of target unittestpp
[ 20%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/AssertException.cpp.o
[ 21%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/CompositeTestReporter.cpp.o
[ 22%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/CurrentTest.cpp.o
[ 22%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/DeferredTestReporter.cpp.o
[ 23%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/DeferredTestResult.cpp.o
[ 24%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/GlobalSettings.cpp.o
[ 24%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/MemoryOutStream.cpp.o
[ 25%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/ReportAssert.cpp.o
[ 26%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/Test.cpp.o
[ 27%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/TestDetails.cpp.o
[ 27%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/TestList.cpp.o
[ 28%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/TestReporter.cpp.o
[ 29%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/TestReporterStdout.cpp.o
[ 30%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/TestResults.cpp.o
[ 30%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/TestRunner.cpp.o
[ 31%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/XmlTestReporter.cpp.o
[ 32%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/Posix/SignalTranslator.cpp.o
[ 32%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/Posix/TimeHelpers.cpp.o
Linking CXX shared library ../../../Binaries/libunittestpp.so
[ 32%] Built target unittestpp
Scanning dependencies of target common_utilities
[ 33%] Building CXX object tests/common/utilities/CMakeFiles/common_utilities.dir/os_utilities.cpp.o
[ 34%] Building CXX object tests/common/utilities/CMakeFiles/common_utilities.dir/stdafx.cpp.o
Linking CXX shared library ../../../Binaries/libcommon_utilities.so
[ 34%] Built target common_utilities
Scanning dependencies of target test_runner
[ 35%] Building CXX object tests/common/TestRunner/CMakeFiles/test_runner.dir/test_runner.cpp.o
[ 35%] Building CXX object tests/common/TestRunner/CMakeFiles/test_runner.dir/test_module_loader.cpp.o
Linking CXX executable ../../../Binaries/test_runner
CMakeFiles/test_runner.dir/test_runner.cpp.o: In function `load_all_tests(test_module_loader&)':
test_runner.cpp:(.text+0xc47): undefined reference to `boost::filesystem::path_traits::dispatch(boost::filesystem::directory_entry const&, std::string&)'
collect2: error: ld returned 1 exit status
tests/common/TestRunner/CMakeFiles/test_runner.dir/build.make:113: recipe for target 'Binaries/test_runner' failed
make[2]: *** [Binaries/test_runner] Error 1
CMakeFiles/Makefile2:265: recipe for target 'tests/common/TestRunner/CMakeFiles/test_runner.dir/all' failed
make[1]: *** [tests/common/TestRunner/CMakeFiles/test_runner.dir/all] Error 2
Makefile:126: recipe for target 'all' failed
make: *** [all] Error 2

How do you submit a POST Parameter?

I'm creating a JSON array for adding POST parameters to a request.

This is an example of the code I see as the example of how to do this:

web::http::http_request postTestRequest;

postTestRequest.set_request_uri( "/whatever" );
postTestRequest.set_method( web::http::methods::POST );

// create post parameters for the body (as json). 
web::json::value postParameters = web::json::value::array();

postParameters[ L"Parameter1" ] = web::json::value::string( L"Test1" );
postParameters[ L"Parameter2" ] = web::json::value::string( L"Test2" );
postParameters[ L"Parameter3" ] = web::json::value::string( L"Test3" );
postParameters[ L"Parameter4" ] = web::json::value::string( L"Test4" );
postParameters[ L"Parameter5" ] = web::json::value::string( L"Test5" );

postTestRequest.set_body( postParameters );

// create a task
Concurrency::task<web::http::http_response> getTask = m_Client->request( postTestRequest );
... more code below... 

When I run it, I get an access violation exception thrown. Obviously I'm missing something simple here but for the life of me I can't see it. The first exception thrown is here:

https://github.com/Microsoft/cpprestsdk/blob/master/Release/include/cpprest/json.h#L1427

Continuing from that it will break here:
c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\memory :

void operator()(_Ty *_Ptr) const _NOEXCEPT
    {   // delete a pointer
    static_assert(0 < sizeof (_Ty),
        "can't delete an incomplete type");
    delete _Ptr;  // <--- exception thrown here. 
    }
};

I can't continue from that point as it will continually break there.


Also, in the array, I don't see an add(), push_back(), insert(), or any other function that looks like it can add things to these arrays. Any help would be great as I'm stepping through debugging things and the debugger doesn't let me move beyond this point. Even if you continue, it keeps breaking there. I'm using VS 2013.

I don't really care if the body is JSON or whatever, just trying to add some parameters to the post request. However in the requests object I don't see a helper function for adding parameters or anything useful like that.

CppRest Json benchmark. "Failure to roundtrip".

I happened to come across this benchmark on a large number of json libraries:
https://github.com/miloyip/nativejson-benchmark

The comments for the CppRest Json library was

"Need Boost on non-Windows platform. DOM strings must be UTF16 on Windows and UTF8 on non-Windows platform. Fail to roundtrip twitter.json."

The failure to roundtrip sounds like a bug you might want to check out. I haven't looked into it. (Would also be nice if UTF8 was supported on windows).

As far as the benchmark is concerned the CppRest Json library looks about average. (Would be nice if it was in the top 10)

Just thought I'd let you guys know.

Deadlock when closing the http_listener

Duplicated from CodePlex (issue 421) since the documentation says that issues should be reported to GitHub instead:

When calling http_listener.close().wait() as we're shutting down our service, the application will occasionally deadlock because the wait operation never returns. The deadlock appears to be in the http_windows_server::stop() function, there's a wait that never returns.

pplx::task<void> http_windows_server::stop()
{
    // Shutdown request queue.
    if(m_hRequestQueue != nullptr)
    {
        HttpShutdownRequestQueue(m_hRequestQueue);
         m_receivingTask.wait();

        // Wait for all requests to be finished processing.
        m_zeroOutstandingRequests.wait(); // Deadlock appears to be here

        HttpCloseRequestQueue(m_hRequestQueue);
    }

http_request::reply causes SIGSEGV on Linux

I would appreciate if you could help me with this issue. I built the 'master' branch and I get segfault every time I want to reply to a request.

Part of the stack trace looks like this:
#0 0x0000000000686410 in vtable for web::http::details::_http_response ()
#1 0x000000000044609b in __gnu_cxx::new_allocatorweb::http::details::_http_response::destroyweb::http::details::_http_response (this=0x7fffd4000f00,

__p=0x7fffd4000f00) at /usr/include/c++/4.9/ext/new_allocator.h:124

#2 0x0000000000442af9 in std::allocator_traitsstd::allocator<web::http::details::_http_response >::_S_destroyweb::http::details::_http_response (__a=...,

__p=0x7fffd4000f00) at /usr/include/c++/4.9/bits/alloc_traits.h:282

#3 0x000000000043fcbf in std::allocator_traitsstd::allocator<web::http::details::_http_response >::destroyweb::http::details::_http_response (__a=...,

__p=0x7fffd4000f00) at /usr/include/c++/4.9/bits/alloc_traits.h:411

#4 0x000000000043ac81 in std::_Sp_counted_ptr_inplace<web::http::details::_http_response, std::allocatorweb::http::details::_http_response, (__gnu_cxx::_Lock_p

olicy)2>::_M_dispose (this=0x7fffd4000ef0) at /usr/include/c++/4.9/bits/shared_ptr_base.h:524

Build error on OSX

I get a build error on OSX (El Capitan). Versions:

cmake-3.3.2 already installed
git-2.6.3 already installed
openssl-1.0.2d_1 already installed
boost-1.59.0 already installed
homebrew/dupes/libiconv-1.14 already installed

The build error:

jaddison@addi:~/projects/cpprestsdk/build.release (master)$ make -j 4
[  1%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/AssertException.cpp.o
[  2%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/CompositeTestReporter.cpp.o
[  2%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/CurrentTest.cpp.o
[  3%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/DeferredTestReporter.cpp.o
[  3%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/DeferredTestResult.cpp.o
[  4%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/GlobalSettings.cpp.o
[  4%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/MemoryOutStream.cpp.o
[  5%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/ReportAssert.cpp.o
[  6%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/Test.cpp.o
[  7%] Building CXX object src/CMakeFiles/cpprest.dir/http/client/http_client_msg.cpp.o
[  7%] Building CXX object src/CMakeFiles/cpprest.dir/http/client/x509_cert_utilities.cpp.o
[  7%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/TestDetails.cpp.o
[  8%] Building CXX object src/CMakeFiles/cpprest.dir/http/common/http_helpers.cpp.o
[  9%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/TestList.cpp.o
[ 10%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/TestReporter.cpp.o
[ 10%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/TestReporterStdout.cpp.o
[ 11%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/TestResults.cpp.o
[ 11%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/TestRunner.cpp.o
[ 12%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/XmlTestReporter.cpp.o
[ 13%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/Posix/SignalTranslator.cpp.o
[ 13%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/Posix/TimeHelpers.cpp.o
[ 14%] Linking CXX shared library ../../../Binaries/libunittestpp.dylib
[ 14%] Built target unittestpp
[ 14%] Building CXX object src/CMakeFiles/cpprest.dir/http/common/http_msg.cpp.o
In file included from /Users/jaddison/projects/cpprestsdk/Release/src/http/client/http_client_msg.cpp:25:
In file included from /Users/jaddison/projects/cpprestsdk/Release/src/pch/stdafx.h:29:
In file included from /Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/basic_types.h:42:
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:2927:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 && IntTraits<U>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:2936:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 && IntTraits<U>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:2950:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:2958:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:2972:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<U>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:2988:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<U>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3004:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3012:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3025:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 && IntTraits<U>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3034:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 && IntTraits<U>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3048:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<U>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3064:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<U>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3080:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3088:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3100:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 && IntTraits<U>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3109:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 && IntTraits<U>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3123:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3131:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3144:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<U>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [src/CMakeFiles/cpprest.dir/http/client/http_client_msg.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 15%] Building CXX object tests/common/TestRunner/CMakeFiles/test_runner.dir/test_runner.cpp.o
In file included from /Users/jaddison/projects/cpprestsdk/Release/src/http/client/x509_cert_utilities.cpp:26:
In file included from /Users/jaddison/projects/cpprestsdk/Release/src/pch/stdafx.h:29:
In file included from /Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/basic_types.h:42:
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:2927:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 && IntTraits<U>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:2936:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 && IntTraits<U>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:2950:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:2958:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:2972:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<U>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:2988:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<U>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3004:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3012:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3025:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 && IntTraits<U>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3034:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 && IntTraits<U>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3048:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<U>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3064:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<U>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3080:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3088:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3100:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 && IntTraits<U>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3109:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 && IntTraits<U>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3123:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3131:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3144:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<U>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [src/CMakeFiles/cpprest.dir/http/client/x509_cert_utilities.cpp.o] Error 1
[ 15%] Building CXX object tests/common/TestRunner/CMakeFiles/test_runner.dir/test_module_loader.cpp.o
In file included from /Users/jaddison/projects/cpprestsdk/Release/src/http/common/http_helpers.cpp:26:
In file included from /Users/jaddison/projects/cpprestsdk/Release/src/pch/stdafx.h:29:
In file included from /Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/basic_types.h:42:
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:2927:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 && IntTraits<U>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:2936:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 && IntTraits<U>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:2950:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:2958:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:2972:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<U>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:2988:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<U>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3004:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3012:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3025:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 && IntTraits<U>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3034:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 && IntTraits<U>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3048:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<U>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3064:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<U>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3080:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3088:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3100:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 && IntTraits<U>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3109:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 && IntTraits<U>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3123:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3131:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3144:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<U>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [src/CMakeFiles/cpprest.dir/http/common/http_helpers.cpp.o] Error 1
[ 16%] Linking CXX executable ../../../Binaries/test_runner
[ 16%] Built target test_runner
In file included from /Users/jaddison/projects/cpprestsdk/Release/src/http/common/http_msg.cpp:25:
In file included from /Users/jaddison/projects/cpprestsdk/Release/src/pch/stdafx.h:29:
In file included from /Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/basic_types.h:42:
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:2927:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 && IntTraits<U>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:2936:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 && IntTraits<U>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:2950:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:2958:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:2972:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<U>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:2988:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<U>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3004:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3012:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3025:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 && IntTraits<U>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3034:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 && IntTraits<U>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3048:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<U>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3064:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<U>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3080:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3088:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3100:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 && IntTraits<U>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3109:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 && IntTraits<U>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3123:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3131:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:3144:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<U>::isUint64 );
        ^
/Users/jaddison/projects/cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [src/CMakeFiles/cpprest.dir/http/common/http_msg.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/cpprest.dir/all] Error 2
make: *** [all] Error 2
jaddison@addi:~/projects/cpprestsdk/build.release (master)$ 

Alignment errors when compiling on RPI

With GCC 4.9, I'm getting these alignment errors when compiling on a Raspberry PI (2):

make
[  1%] Building CXX object src/CMakeFiles/cpprest.dir/websockets/client/ws_client_wspp.cpp.o
In file included from /home/pi/casablanca/Release/libs/websocketpp/websocketpp/message_buffer/message.hpp:32:0,
                 from /home/pi/casablanca/Release/libs/websocketpp/websocketpp/config/core_client.hpp:51,
                 from /home/pi/casablanca/Release/libs/websocketpp/websocketpp/config/asio_client.hpp:31,
                 from /home/pi/casablanca/Release/src/websockets/client/ws_client_wspp.cpp:38:
/home/pi/casablanca/Release/libs/websocketpp/websocketpp/frame.hpp: In function ‘void websocketpp::frame::word_mask_exact(uint8_t*, uint8_t*, size_t, const masking_key_type&)’:
/home/pi/casablanca/Release/libs/websocketpp/websocketpp/frame.hpp:706:57: error: cast from ‘uint8_t* {aka unsigned char*}’ to ‘size_t* {aka unsigned int*}’ increases required alignment of target type [-Werror=cast-align]
     size_t* input_word = reinterpret_cast<size_t*>(input);
                                                         ^
/home/pi/casablanca/Release/libs/websocketpp/websocketpp/frame.hpp:707:59: error: cast from ‘uint8_t* {aka unsigned char*}’ to ‘size_t* {aka unsigned int*}’ increases required alignment of target type [-Werror=cast-align]
     size_t* output_word = reinterpret_cast<size_t*>(output);
                                                           ^
/home/pi/casablanca/Release/libs/websocketpp/websocketpp/frame.hpp: In function ‘size_t websocketpp::frame::word_mask_circ(uint8_t*, uint8_t*, size_t, size_t)’:
/home/pi/casablanca/Release/libs/websocketpp/websocketpp/frame.hpp:772:59: error: cast from ‘uint8_t* {aka unsigned char*}’ to ‘size_t* {aka unsigned int*}’ increases required alignment of target type [-Werror=cast-align]
     size_t * input_word = reinterpret_cast<size_t *>(input);
                                                           ^
/home/pi/casablanca/Release/libs/websocketpp/websocketpp/frame.hpp:773:61: error: cast from ‘uint8_t* {aka unsigned char*}’ to ‘size_t* {aka unsigned int*}’ increases required alignment of target type [-Werror=cast-align]
     size_t * output_word = reinterpret_cast<size_t *>(output);
                                                             ^
In file included from /home/pi/casablanca/Release/libs/websocketpp/websocketpp/processors/hybi00.hpp:34:0,
                 from /home/pi/casablanca/Release/libs/websocketpp/websocketpp/impl/connection_impl.hpp:31,
                 from /home/pi/casablanca/Release/libs/websocketpp/websocketpp/connection.hpp:1528,
                 from /home/pi/casablanca/Release/libs/websocketpp/websocketpp/endpoint.hpp:31,
                 from /home/pi/casablanca/Release/libs/websocketpp/websocketpp/roles/client_endpoint.hpp:31,
                 from /home/pi/casablanca/Release/libs/websocketpp/websocketpp/client.hpp:31,
                 from /home/pi/casablanca/Release/src/websockets/client/ws_client_wspp.cpp:40:
/home/pi/casablanca/Release/libs/websocketpp/websocketpp/common/md5.hpp: In function ‘void websocketpp::md5::md5_process(websocketpp::md5::md5_state_t*, const md5_byte_t*)’:
/home/pi/casablanca/Release/libs/websocketpp/websocketpp/common/md5.hpp:203:33: error: cast from ‘const md5_byte_t* {aka const unsigned char*}’ to ‘const md5_word_t* {aka const unsigned int*}’ increases required alignment of target type [-Werror=cast-align]
         X = (md5_word_t const *)data;
                                 ^
cc1plus: all warnings being treated as errors
src/CMakeFiles/cpprest.dir/build.make:537: recipe for target 'src/CMakeFiles/cpprest.dir/websockets/client/ws_client_wspp.cpp.o' failed
make[2]: *** [src/CMakeFiles/cpprest.dir/websockets/client/ws_client_wspp.cpp.o] Error 1
CMakeFiles/Makefile2:75: recipe for target 'src/CMakeFiles/cpprest.dir/all' failed
make[1]: *** [src/CMakeFiles/cpprest.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

Exception from handle_write_large_body

Migrated from Codeplex: https://casablanca.codeplex.com/discussions/647518

niamurph wrote:

I am using cpprestsdk 2.6 and getting an exception with the description "Unexpected end of request body stream encountered before Content-Length satisfied.". It is thrown from the function handle_write_large_body. My suspicion is that there may be a concurrency issue in the web::http::client::http_client ( or maybe I am using it wrong).

Hitting the exception means that my request never gets sent.

I am running on Mac OS X 10.10.
By adding some logging statements I can see a buffer (boost::asio::buffer) of 90 bytes being written and then read. Usually a single read and a single write. But occasionally there is a second read, and since the buffer is already read, it retuns 0 leading to the path that hits the exception. The exception message says the size is wrong, but I think some concurrency issue has led to the buffer being read one more time after it has already finished.

I think it may be a concurrency issue, since I can avoid it by using a new connection for every message I send. If I reuse a web::http::client::http_client for multiple messages to the same server, then I hit this issue. Maybe I need to check that there are no messages still being processed for the http_client before I queue up another message to the same client, but I do not know how to do that.

Are there any known issues like this. My workaround for the moment is to create a new web::http::client::http_client for every message. That is probably not as good for performance. I can live with the workaround, but I would be keen to find the root cause.

SIGSEGV in http_client during SSL handshake with http_server

I am using the development branch to write a REST server, because I need SSL. I am running under RHEL 7.1. Writing tests using the BOOST test framework, I am able to create a client that successfully connects to google and others using SSL. When trying to connect to my REST server, I get a SIGSEGV (see attached). Note that I can sucessfully execute SSL requests to the server using SOAPUI. I am using BOOST 1.58. The problem seems to be with some Boost inline code in error_code.hpp, which is invoked in http_client_asio.cpp/report_error(). Basically, to get the error handled without a SIGSEGV, I had to change:
ec == boost::system::errc::operation_canceled
to
ec.value() == boost::system::errc::operation_canceled

I changed all similar comparisons in report_error(). Now I get a nice std::exception and an "Error in SSL handshake" explanation string. Next is finding out why I can't connect, but that's an issue for another day...

Note: This happened when connecting to a server using test certificate and key. I was also missing
client_config.set_validate_certificates(false);
Once I added the line above, the error (the SIGSEGV) doesn't occur, probably because there is no error checking... So when it works, it works. It only fails when it fails ;)

CPPRESTSDK SIGSEGV.txt

Need a way to change the CHUNK_SIZE value at runtime.

Or am I using cpprest in the wrong way?

Our application normally transfers data (using HTTP GET) of several hundred megabytes, the default 64 Kb chunk size seems too small for optimal download rate. Changing the value to 5 Mb can reduce download time of 2 Gb data from 2minutes to 28 seconds.

The demo code, which just allocates the requested data in-memory and send them:

#include <Windows.h>
#include <cpprest/http_listener.h>
#include <cpprest/json.h>
#include <cpprest/streams.h>
#include <cpprest/filestream.h>
#include <cpprest/producerconsumerstream.h>
#include <algorithm>
#include <chrono>
#include <iostream>
#include <string>

using namespace concurrency::streams;
using namespace web;
using namespace http;
using namespace http::experimental::listener;

int main(int argc, char *argv[]) {

    http_listener listener(L"http://*:8080/bytes");

    listener.support(methods::GET, [](http_request &request) {

        auto q = web::uri::split_query(request.request_uri().query());

        // default: 100 MB of data
        std::size_t bytes_to_write = 100 * 1048576;

        if (q.find(L"b") != std::end(q)) {
            bytes_to_write = std::stoul(q[L"b"]);
        }
        if (q.find(L"kb") != std::end(q)) {
            bytes_to_write = std::stoul(q[L"kb"]) * 1024;
        }
        if (q.find(L"mb") != std::end(q)) {
            bytes_to_write = std::stoul(q[L"mb"]) * 1024 * 1024;
        }

        request.reply(status_codes::OK, std::string(bytes_to_write, '+'));
        std::cout << "Sent " << bytes_to_write << "bytes\n";
    });

    listener.open().wait();

    std::wcout << "Listening on " << listener.uri().port() << std::endl;

    while (true) {
        try {
            Sleep(1);
        }
        catch (...) {
            break;
        }
    }

    listener.close().wait();

    return 0;
}

And using curl for testing:

curl -o NUL http://localhost:8080/bytes?mb=2000

Using 64Kb chunk size:

[root@localhost ~]# curl -o NUL 10.50.10.51:8080/bytes?mb=2000
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 2000M  100 2000M    0     0  15.7M      0  0:02:06  0:02:06 --:--:-- 14.8M

Using 5Mb chunck size:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 2000M  100 2000M    0     0  69.2M      0  0:00:28  0:00:28 --:--:-- 77.1M

http_listener is getting slower over time on Windows

I wrote a simple http server using http_listener, with a simple client to test the performance of the server. Then I observed that the http server is getting slower after every run of the client, and its memory consumption is increasing:

PS C:\Develop\Tests\testrestserver\Release> ./testrestclient.exe
Sending 1000 requests...
Ellapsed Time: 1380 ms.
PS C:\Develop\Tests\testrestserver\Release> ./testrestclient.exe
Sending 1000 requests...
Ellapsed Time: 1468 ms.
PS C:\Develop\Tests\testrestserver\Release> ./testrestclient.exe
Sending 1000 requests...
Ellapsed Time: 1572 ms.
PS C:\Develop\Tests\testrestserver\Release> ./testrestclient.exe
Sending 1000 requests...
Ellapsed Time: 1642 ms.
PS C:\Develop\Tests\testrestserver\Release> ./testrestclient.exe
Sending 1000 requests...
Ellapsed Time: 1774 ms.
PS C:\Develop\Tests\testrestserver\Release> ./testrestclient.exe
Sending 1000 requests...
Ellapsed Time: 1952 ms.
PS C:\Develop\Tests\testrestserver\Release> ./testrestclient.exe
Sending 1000 requests...
Ellapsed Time: 2062 ms.
PS C:\Develop\Tests\testrestserver\Release> ./testrestclient.exe
Sending 1000 requests...
Ellapsed Time: 2153 ms.
PS C:\Develop\Tests\testrestserver\Release> ./testrestclient.exe
Sending 1000 requests...
Ellapsed Time: 2210 ms.
PS C:\Develop\Tests\testrestserver\Release> ./testrestclient.exe
Sending 1000 requests...
Ellapsed Time: 2352 ms.
PS C:\Develop\Tests\testrestserver\Release> ./testrestclient.exe
Sending 1000 requests...
Ellapsed Time: 2420 ms.

Testing Environment:
Hardware: AMD A10-5757M APU, 8GB RAM
Operating System: Windows 8.1 x64
Compiler: Visual C++ 2013 Update 2
C++ REST SDK version: 2.7

I also run the same test on Ubuntu 14.04 LTS on the same machine, the Boost.Asio-based http_listener do not have the problem.

Server source code:

#include <stdio.h>
#include <cpprest/uri.h>
#include <cpprest/http_listener.h>
#include <cpprest/asyncrt_utils.h>
#pragma comment(lib, "cpprest120_2_7.lib")
#pragma comment(lib, "bcrypt.lib")
#pragma comment(lib, "crypt32.lib")
#pragma comment(lib, "winhttp.lib")
#pragma comment(lib, "httpapi.lib")

using namespace web;
using namespace http;
using namespace utility;
using namespace http::experimental::listener;

class CommandHandler
{
public:
    CommandHandler() {}
    CommandHandler(utility::string_t url);

    pplx::task<void> open() { return m_listener.open(); }
    pplx::task<void> close() { return m_listener.close(); }

private:
    void handle_get_or_post(http_request message);

    http_listener m_listener;
};

CommandHandler::CommandHandler(utility::string_t url) : m_listener(url)
{
    m_listener.support(methods::GET, std::bind(&CommandHandler::handle_get_or_post, this, std::placeholders::_1));
    m_listener.support(methods::POST, std::bind(&CommandHandler::handle_get_or_post, this, std::placeholders::_1));
}

void CommandHandler::handle_get_or_post(http_request message)
{
    message.reply(status_codes::OK, "ACCEPTED");
};

int main(int argc, char argv[])
{
    try
    {
        utility::string_t address = U("http://*:8080");

        uri_builder uri(address);
        auto addr = uri.to_uri().to_string();

        CommandHandler handler(addr);
        handler.open().wait();

        ucout << utility::string_t(U("Listening for requests at: ")) << addr << std::endl;
        ucout << U("Press ENTER key to quit...") << std::endl;
        std::string line;
        std::getline(std::cin, line);

        handler.close().wait();
    }
    catch (std::exception& ex)
    {
        ucout << U("Exception: ") << ex.what() << std::endl;
        ucout << U("Press ENTER key to quit...") << std::endl;
        std::string line;
        std::getline(std::cin, line);
    }

    return 0;
}

Client source code:

#include <stdio.h>
#include <tchar.h>
#include <iostream>
#include <chrono>
#include <cpprest/uri.h>
#include <cpprest/asyncrt_utils.h>
#include <cpprest/http_client.h>
#pragma comment(lib, "cpprest120_2_7.lib")
#pragma comment(lib, "bcrypt.lib")
#pragma comment(lib, "crypt32.lib")
#pragma comment(lib, "winhttp.lib")

using namespace std;
using namespace web::http;
using namespace web::http::client;
using namespace utility;

#define N 1000

int _tmain(int argc, _TCHAR* argv[])
{
    cout << "Sending " << N << " requests..." << endl;
    auto t1 = std::chrono::high_resolution_clock::now();
    for (int i = 0; i < N; i++)
    {
        http_client c(U("http://localhost:8080/"));
        c.request(methods::GET, uri_builder(U("/PASS")).to_string())
        .then([=](http_response resp)
        {
            resp.extract_string().get();
        }).wait();
    }
    auto t2 = std::chrono::high_resolution_clock::now();
    cout << "Ellapsed Time: " << chrono::duration_cast<chrono::milliseconds>(t2 - t1).count() << " ms." << endl;
    return 0;
}

Linker warnings on iOS 7.0

When the lib is linked on iOS 7.0 I receive several linker warnings:


ld: warning: directory not found for option '-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.1.sdk/Developer/Library/Frameworks'
ld: warning: object file (/Users/rinopazzo/dropticketcore/CppRestSdk/cpprest/libcpprest.a(uri.o)) was built for newer iOS version (9.1) than being linked (7.0)
ld: warning: object file (/Users/rinopazzo/dropticketcore/CppRestSdk/cpprest/libcpprest.a(http_client_msg.o)) was built for newer iOS version (9.1) than being linked (7.0)
ld: warning: object file (/Users/rinopazzo/dropticketcore/CppRestSdk/cpprest/libcpprest.a(http_client_asio.o)) was built for newer iOS version (9.1) than being linked (7.0)
ld: warning: object file (/Users/rinopazzo/dropticketcore/CppRestSdk/cpprest/libcpprest.a(json.o)) was built for newer iOS version (9.1) than being linked (7.0)
ld: warning: object file (/Users/rinopazzo/dropticketcore/CppRestSdk/boost.framework/boost(thread_thread.o)) was built for newer iOS version (8.0) than being linked (7.0)
ld: warning: object file (/Users/rinopazzo/dropticketcore/CppRestSdk/boost.framework/boost(chrono_chrono.o)) was built for newer iOS version (8.0) than being linked (7.0)
ld: warning: object file (/Users/rinopazzo/dropticketcore/CppRestSdk/boost.framework/boost(system_error_code.o)) was built for newer iOS version (8.0) than being linked (7.0)
ld: warning: object file (/Users/rinopazzo/dropticketcore/CppRestSdk/cpprest/libcpprest.a(asyncrt_utils.o)) was built for newer iOS version (9.1) than being linked (7.0)
ld: warning: object file (/Users/rinopazzo/dropticketcore/CppRestSdk/cpprest/libcpprest.a(json_serialization.o)) was built for newer iOS version (9.1) than being linked (7.0)
ld: warning: object file (/Users/rinopazzo/dropticketcore/CppRestSdk/cpprest/libcpprest.a(uri_builder.o)) was built for newer iOS version (9.1) than being linked (7.0)
ld: warning: object file (/Users/rinopazzo/dropticketcore/CppRestSdk/cpprest/libcpprest.a(http_msg.o)) was built for newer iOS version (9.1) than being linked (7.0)
ld: warning: object file (/Users/rinopazzo/dropticketcore/CppRestSdk/cpprest/libcpprest.a(x509_cert_utilities.o)) was built for newer iOS version (9.1) than being linked (7.0)
ld: warning: object file (/Users/rinopazzo/dropticketcore/CppRestSdk/cpprest/libcpprest.a(oauth1.o)) was built for newer iOS version (9.1) than being linked (7.0)
ld: warning: object file (/Users/rinopazzo/dropticketcore/CppRestSdk/cpprest/libcpprest.a(http_helpers.o)) was built for newer iOS version (9.1) than being linked (7.0)
ld: warning: object file (/Users/rinopazzo/dropticketcore/CppRestSdk/cpprest/libcpprest.a(json_parsing.o)) was built for newer iOS version (9.1) than being linked (7.0)
ld: warning: object file (/Users/rinopazzo/dropticketcore/CppRestSdk/cpprest/libcpprest.a(uri_parser.o)) was built for newer iOS version (9.1) than being linked (7.0)
ld: warning: object file (/Users/rinopazzo/dropticketcore/CppRestSdk/cpprest/libcpprest.a(pplx.o)) was built for newer iOS version (9.1) than being linked (7.0)
ld: warning: object file (/Users/rinopazzo/dropticketcore/CppRestSdk/cpprest/libcpprest.a(pplxapple.o)) was built for newer iOS version (9.1) than being linked (7.0)
ld: warning: object file (/Users/rinopazzo/dropticketcore/CppRestSdk/boost.framework/boost(thread_once.o)) was built for newer iOS version (8.0) than being linked (7.0)
ld: warning: object file (/Users/rinopazzo/dropticketcore/CppRestSdk/cpprest/libcpprest.a(threadpool.o)) was built for newer iOS version (9.1) than being linked (7.0)
ld: warning: object file (/Users/rinopazzo/dropticketcore/CppRestSdk/cpprest/libcpprest.a(x509_cert_utilities_apple.o)) was built for newer iOS version (9.1) than being linked (7.0)
ld: warning: object file (/Users/rinopazzo/dropticketcore/CppRestSdk/cpprest/libcpprest.a(base64.o)) was built for newer iOS version (9.1) than being linked (7.0)

It is possible to use the lib on iOS 7.0?

URI's user info not used?

I am attempting to communicate with a Web service that expects a user name and password in the URL (e.g., HTTP://username:[email protected]). I'm supplying user info in the base URL, but it's not being sent that I can see. Further, I see no code in the Casablanca project that would send it. No code other than uri_builder and uri class manipulation calls uri_builder::user_info().

Does Casablanca, in fact, make no use of these data? If so, what can I do to work around this omission?

-evan

web_proxy doesn't work when using port numbers in address

I tested this with v2.7.0 and v2.1.0 (with vc12 and vc14 on win10 and server2012), on about 20 proxy machines I know are good. I though it had worked with some old cpprest version but probably not. (I know the proxies are fine as I use them fine through libcurl).

Minimal example: I get the error "web::uri_exception: provided uri is invalid":

#include <cpprest/http_client.h>
int main() {
    try {
        //web::http::client::web_proxy wp2(L"123.123.123.123"); //OK
        web::http::client::web_proxy wp2(L"123.123.123.123:1234"); //Error
        std::cout << "OK" << std::endl;
    }
    catch (const std::exception& exc) {
        std::cerr << exc.what() << std::endl;
    }
}

[feature request] std::string support for json library

In my experience most 3rd party libraries use std::string and not std::wstring in their interface. Therefore applications become tied to std::string. Because the ppl/json library uses std::wstring (on windows) this makes integrating the ppl/json library into an applications cumbersome and inefficient. One has to do lots of unnecessary wstring-to-string and string-to-wstring conversions. Could you add support for std::string, at least for the json library?

Minimal example:

    #include <cpprest/json.h>

    std::string SerializeToJson(std::string name, int id) //utf8 coming in and goin out
    {
        utility::stringstream_t stream;
        web::json::value js_obj;
        js_obj[L"id"] = web::json::value::number(id);
        js_obj[L"name"] = web::json::value::string(utility::conversions::utf8_to_utf16(name)); //unneccessary conversion 1

        js_obj.serialize(stream);
        std::wstring wret = stream.str();
        std::string ret = utility::conversions::utf16_to_utf8(wret); //unneccessary conversion 2

        return ret;
    }

    int main() {

        auto r = SerializeToJson("test", 123);
        std::cout << r << std::endl;
    }

Build failures on Ubuntu 14.04 with clang 3.4

On a fully up-to-date Ubuntu 14.04 LTS installation, I get the following error when building cpprestsdk (specifically, test_runner) with clang instead of GCC:

$ cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang
[...]
-- The C compiler identification is Clang 3.4.0
-- The CXX compiler identification is Clang 3.4.0
-- Check for working C compiler: /usr/bin/clang
-- Check for working C compiler: /usr/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++
-- Check for working CXX compiler: /usr/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Boost version: 1.55.0
-- Found the following Boost libraries:
--   random
--   chrono
--   system
--   thread
--   regex
--   filesystem
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libssl.so;/usr/lib/x86_64-linux-gnu/libcrypto.so (found suitable version "1.0.1f", minimum required is "1.0.0")
-- Setting clang options
-- websocketpp not found, using the embedded version
-- Added test library httpclient_test
-- Added test library httplistener_test
-- Added test library json_test
-- Added test library pplx_test
-- Added test library streams_test
-- Added test library uri_test
-- Added test library utils_test
-- Added test library websocketclient_test
-- Configuring done
-- Generating done
-- Build files have been written to: /src/cpprestsdk-git/Release/build.release
$
$ make
[  0%] Building CXX object src/CMakeFiles/cpprest.dir/http/client/http_client_msg.cpp.o
[...]
Linking CXX shared library ../Binaries/libcpprest.so
[ 19%] Built target cpprest
[...]
[ 32%] Building CXX object tests/common/UnitTestpp/CMakeFiles/unittestpp.dir/src/Posix/TimeHelpers.cpp.o
Linking CXX shared library ../../../Binaries/libunittestpp.so
[ 32%] Built target unittestpp
[ 33%] Building CXX object tests/common/utilities/CMakeFiles/common_utilities.dir/os_utilities.cpp.o
[ 34%] Building CXX object tests/common/utilities/CMakeFiles/common_utilities.dir/stdafx.cpp.o
Linking CXX shared library ../../../Binaries/libcommon_utilities.so
[ 34%] Built target common_utilities
[...]
[ 35%] Building CXX object tests/common/TestRunner/CMakeFiles/test_runner.dir/test_module_loader.cpp.o
[...]
Linking CXX executable ../../../Binaries/test_runner
CMakeFiles/test_runner.dir/test_runner.cpp.o: In function `boost::filesystem::path::path<boost::filesystem::directory_entry>(boost::filesystem::directory_entry const&, boost::enable_if<boost::filesystem::path_traits::is_pathable<boost::decay<boost::filesystem::directory_entry>::type>, void>::type*)':
/src/cpprestsdk-git/Release/tests/common/TestRunner/test_runner.cpp:(.text._ZN5boost10filesystem4pathC2INS0_15directory_entryEEERKT_PNS_9enable_ifINS0_11path_traits11is_pathableINS_5decayIS4_E4typeEEEvE4typeE[_ZN5boost10filesystem4pathC2INS0_15directory_entryEEERKT_PNS_9enable_ifINS0_11path_traits11is_pathableINS_5decayIS4_E4typeEEEvE4typeE]+0xc3): undefined reference to `boost::filesystem::path_traits::dispatch(boost::filesystem::directory_entry const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::codecvt<wchar_t, char, __mbstate_t> const&)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [Binaries/test_runner] Error 1
make[1]: *** [tests/common/TestRunner/CMakeFiles/test_runner.dir/all] Error 2
make: *** [all] Error 2

I understand that the documentation recommends using g++4.8 on Linux, but I had hoped that clang would work anyway.

My clang version is Ubuntu clang version 3.4-1ubuntu3, and my Boost version is 1.55, with the libboost-filesystem1.55-dev package installed. Using g++4.8 as CXX, the build succeeds without any problems.

Error on build on debian with boost 1.60 and openssl 1.1.0-pre3

When i try to compile the library i receive the follow error (looks like it's a problem with the warnings being treated as an error).

It's really this or it's something i made wrong ? How can i solve this ?
I already have the openssl and boost installed.
Thanks

Here a link to the full error

...

                                                   ^
In file included from /home/devena/libsc/linux/all/include/boost/asio/detail/descriptor_ops.hpp:112:0,
                 from /home/devena/libsc/linux/all/include/boost/asio/detail/reactive_serial_port_service.hpp:28,
                 from /home/devena/libsc/linux/all/include/boost/asio/serial_port_service.hpp:26,
                 from /home/devena/libsc/linux/all/include/boost/asio/basic_serial_port.hpp:30,
                 from /home/devena/libsc/linux/all/include/boost/asio.hpp:26,
                 from /home/devena/srcc/linux/casablanca/Release/include/pplx/threadpool.h:34,
                 from /home/devena/srcc/linux/casablanca/Release/include/cpprest/details/http_server_asio.h:18,
                 from /home/devena/srcc/linux/casablanca/Release/src/pch/stdafx.h:157,
                 from /home/devena/srcc/linux/casablanca/Release/src/http/client/http_client_msg.cpp:25:
/home/devena/libsc/linux/all/include/boost/asio/detail/impl/descriptor_ops.ipp: In function ‘int boost::asio::detail::descriptor_ops::close(int, boost::asio::detail::descriptor_ops::state_type&, boost::system::error_code&)’:
/home/devena/libsc/linux/all/include/boost/asio/detail/impl/descriptor_ops.ipp:69:13: error: conversion to ‘boost::asio::detail::descriptor_ops::state_type {aka unsigned char}’ from ‘int’ may alter its value [-Werror=conversion]
       state &= ~non_blocking;
             ^
/home/devena/libsc/linux/all/include/boost/asio/detail/impl/descriptor_ops.ipp: In function ‘bool boost::asio::detail::descriptor_ops::set_user_non_blocking(int, boost::asio::detail::descriptor_ops::state_type&, bool, boost::system::error_code&)’:
/home/devena/libsc/linux/all/include/boost/asio/detail/impl/descriptor_ops.ipp:114:13: error: conversion to ‘boost::asio::detail::descriptor_ops::state_type {aka unsigned char}’ from ‘int’ may alter its value [-Werror=conversion]
       state &= ~(user_set_non_blocking | internal_non_blocking);
             ^
/home/devena/libsc/linux/all/include/boost/asio/detail/impl/descriptor_ops.ipp: In function ‘bool boost::asio::detail::descriptor_ops::set_internal_non_blocking(int, boost::asio::detail::descriptor_ops::state_type&, bool, boost::system::error_code&)’:
/home/devena/libsc/linux/all/include/boost/asio/detail/impl/descriptor_ops.ipp:160:13: error: conversion to ‘boost::asio::detail::descriptor_ops::state_type {aka unsigned char}’ from ‘int’ may alter its value [-Werror=conversion]
       state &= ~internal_non_blocking;
             ^
/home/devena/libsc/linux/all/include/boost/asio/detail/impl/descriptor_ops.ipp: In function ‘int boost::asio::detail::descriptor_ops::ioctl(int, boost::asio::detail::descriptor_ops::state_type&, long int, boost::asio::detail::ioctl_arg_type*, boost::system::error_code&)’:
/home/devena/libsc/linux/all/include/boost/asio/detail/impl/descriptor_ops.ipp:358:15: error: conversion to ‘boost::asio::detail::descriptor_ops::state_type {aka unsigned char}’ from ‘int’ may alter its value [-Werror=conversion]
         state &= ~(user_set_non_blocking | internal_non_blocking);
               ^
In file included from /home/devena/libsc/linux/all/include/boost/thread/thread_time.hpp:10:0,
                 from /home/devena/libsc/linux/all/include/boost/thread/lock_types.hpp:18,
                 from /home/devena/libsc/linux/all/include/boost/thread/pthread/mutex.hpp:16,
                 from /home/devena/libsc/linux/all/include/boost/thread/mutex.hpp:16,
                 from /home/devena/srcc/linux/casablanca/Release/src/pch/stdafx.h:82,
                 from /home/devena/srcc/linux/casablanca/Release/src/http/client/http_client_msg.cpp:25:
/home/devena/libsc/linux/all/include/boost/date_time/microsec_time_clock.hpp: In instantiation of ‘static time_type boost::date_time::microsec_clock<time_type>::create_time(boost::date_time::microsec_clock<time_type>::time_converter) [with time_type = boost::posix_time::ptime; boost::date_time::microsec_clock<time_type>::time_converter = tm* (*)(const long int*, tm*); time_t = long int]’:
/home/devena/libsc/linux/all/include/boost/date_time/microsec_time_clock.hpp:76:41:   required from ‘static time_type boost::date_time::microsec_clock<time_type>::universal_time() [with time_type = boost::posix_time::ptime]’
/home/devena/libsc/linux/all/include/boost/thread/thread_time.hpp:22:63:   required from here
/home/devena/libsc/linux/all/include/boost/date_time/microsec_time_clock.hpp:86:36: error: conversion to ‘uint32_t {aka unsigned int}’ from ‘__suseconds_t {aka long int}’ may alter its value [-Werror=conversion]
       boost::uint32_t sub_sec = tv.tv_usec;
                                    ^
In file included from /home/devena/libsc/linux/all/include/boost/date_time/adjust_functors.hpp:13:0,
                 from /home/devena/libsc/linux/all/include/boost/date_time/gregorian/greg_duration_types.hpp:14,
                 from /home/devena/libsc/linux/all/include/boost/date_time/gregorian/gregorian_types.hpp:22,
                 from /home/devena/libsc/linux/all/include/boost/date_time/posix_time/posix_time_config.hpp:18,
                 from /home/devena/libsc/linux/all/include/boost/date_time/posix_time/posix_time_system.hpp:13,
                 from /home/devena/libsc/linux/all/include/boost/date_time/posix_time/ptime.hpp:12,
                 from /home/devena/libsc/linux/all/include/boost/date_time/posix_time/posix_time_types.hpp:12,
                 from /home/devena/libsc/linux/all/include/boost/thread/thread_time.hpp:11,
                 from /home/devena/libsc/linux/all/include/boost/thread/lock_types.hpp:18,
                 from /home/devena/libsc/linux/all/include/boost/thread/pthread/mutex.hpp:16,
                 from /home/devena/libsc/linux/all/include/boost/thread/mutex.hpp:16,
                 from /home/devena/srcc/linux/casablanca/Release/src/pch/stdafx.h:82,
                 from /home/devena/srcc/linux/casablanca/Release/src/http/client/http_client_msg.cpp:25:
/home/devena/libsc/linux/all/include/boost/date_time/wrapping_int.hpp: In instantiation of ‘IntT boost::date_time::wrapping_int2<int_type_, wrap_min, wrap_max>::calculate_wrap(IntT) [with IntT = short int; int_type_ = short int; int_type_ wrap_min = 1; int_type_ wrap_max = 12]’:
/home/devena/libsc/linux/all/include/boost/date_time/wrapping_int.hpp:126:35:   required from ‘IntT boost::date_time::wrapping_int2<int_type_, wrap_min, wrap_max>::add(IntT) [with IntT = short int; int_type_ = short int; int_type_ wrap_min = 1; int_type_ wrap_max = 12]’
/home/devena/libsc/linux/all/include/boost/date_time/adjust_functors.hpp:77:55:   required from ‘boost::date_time::month_functor<date_type>::duration_type boost::date_time::month_functor<date_type>::get_offset(const date_type&) const [with date_type = boost::gregorian::date; boost::date_time::month_functor<date_type>::duration_type = boost::gregorian::date_duration]’
/home/devena/libsc/linux/all/include/boost/date_time/date_duration_types.hpp:66:49:   required from ‘boost::date_time::months_duration<base_config>::duration_type boost::date_time::months_duration<base_config>::get_offset(const date_type&) const [with base_config = boost::gregorian::greg_durations_config; boost::date_time::months_duration<base_config>::duration_type = boost::gregorian::date_duration; boost::date_time::months_duration<base_config>::date_type = boost::gregorian::date]’
/home/devena/libsc/linux/all/include/boost/date_time/posix_time/date_duration_operators.hpp:33:37:   required from here
/home/devena/libsc/linux/all/include/boost/date_time/wrapping_int.hpp:151:14: error: conversion to ‘boost::date_time::wrapping_int2<short int, 1, 12>::int_type {aka short int}’ from ‘int’ may alter its value [-Werror=conversion]
       value_ -= (wrap_max - wrap_min + 1);
              ^
/home/devena/libsc/linux/all/include/boost/date_time/wrapping_int.hpp:156:14: error: conversion to ‘boost::date_time::wrapping_int2<short int, 1, 12>::int_type {aka short int}’ from ‘int’ may alter its value [-Werror=conversion]
       value_ += (wrap_max - wrap_min + 1);
              ^
In file included from /home/devena/libsc/linux/all/include/boost/asio/detail/impl/posix_mutex.ipp:24:0,
                 from /home/devena/libsc/linux/all/include/boost/asio/detail/posix_mutex.hpp:73,
                 from /home/devena/libsc/linux/all/include/boost/asio/detail/mutex.hpp:25,
                 from /home/devena/libsc/linux/all/include/boost/asio/detail/service_registry.hpp:20,
                 from /home/devena/libsc/linux/all/include/boost/asio/impl/io_service.hpp:19,
                 from /home/devena/libsc/linux/all/include/boost/asio/io_service.hpp:767,
                 from /home/devena/libsc/linux/all/include/boost/asio/ssl/context.hpp:26,
                 from /home/devena/libsc/linux/all/include/boost/asio/ssl.hpp:19,
                 from /home/devena/srcc/linux/casablanca/Release/include/cpprest/http_client.h:65,
                 from /home/devena/srcc/linux/casablanca/Release/src/pch/stdafx.h:132,
                 from /home/devena/srcc/linux/casablanca/Release/src/http/client/http_client_msg.cpp:25:
/home/devena/libsc/linux/all/include/boost/asio/error.hpp: At global scope:
/home/devena/libsc/linux/all/include/boost/asio/error.hpp:258:45: error: ‘boost::asio::error::system_category’ defined but not used [-Werror=unused-variable]
 static const boost::system::error_category& system_category
                                             ^
/home/devena/libsc/linux/all/include/boost/asio/error.hpp:260:45: error: ‘boost::asio::error::netdb_category’ defined but not used [-Werror=unused-variable]
 static const boost::system::error_category& netdb_category
                                             ^
/home/devena/libsc/linux/all/include/boost/asio/error.hpp:262:45: error: ‘boost::asio::error::addrinfo_category’ defined but not used [-Werror=unused-variable]
 static const boost::system::error_category& addrinfo_category
                                             ^
/home/devena/libsc/linux/all/include/boost/asio/error.hpp:264:45: error: ‘boost::asio::error::misc_category’ defined but not used [-Werror=unused-variable]
 static const boost::system::error_category& misc_category
                                             ^
In file included from /home/devena/libsc/linux/all/include/boost/asio/ssl/impl/context.ipp:26:0,
                 from /home/devena/libsc/linux/all/include/boost/asio/ssl/context.hpp:786,
                 from /home/devena/libsc/linux/all/include/boost/asio/ssl.hpp:19,
                 from /home/devena/srcc/linux/casablanca/Release/include/cpprest/http_client.h:65,
                 from /home/devena/srcc/linux/casablanca/Release/src/pch/stdafx.h:132,
                 from /home/devena/srcc/linux/casablanca/Release/src/http/client/http_client_msg.cpp:25:
/home/devena/libsc/linux/all/include/boost/asio/ssl/error.hpp:34:45: error: ‘boost::asio::error::ssl_category’ defined but not used [-Werror=unused-variable]
 static const boost::system::error_category& ssl_category
                                             ^
In file included from /home/devena/libsc/linux/all/include/boost/system/system_error.hpp:14:0,
                 from /home/devena/libsc/linux/all/include/boost/thread/exceptions.hpp:22,
                 from /home/devena/libsc/linux/all/include/boost/thread/pthread/mutex.hpp:14,
                 from /home/devena/libsc/linux/all/include/boost/thread/mutex.hpp:16,
                 from /home/devena/srcc/linux/casablanca/Release/src/pch/stdafx.h:82,
                 from /home/devena/srcc/linux/casablanca/Release/src/http/client/http_client_msg.cpp:25:
/home/devena/libsc/linux/all/include/boost/system/error_code.hpp:221:36: error: ‘boost::system::posix_category’ defined but not used [-Werror=unused-variable]
     static const error_category &  posix_category = generic_category();
                                    ^
/home/devena/libsc/linux/all/include/boost/system/error_code.hpp:222:36: error: ‘boost::system::errno_ecat’ defined but not used [-Werror=unused-variable]
     static const error_category &  errno_ecat     = generic_category();
                                    ^
/home/devena/libsc/linux/all/include/boost/system/error_code.hpp:223:36: error: ‘boost::system::native_ecat’ defined but not used [-Werror=unused-variable]
     static const error_category &  native_ecat    = system_category();
                                    ^
cc1plus: all warnings being treated as errors
src/CMakeFiles/cpprest.dir/build.make:54: recipe for target 'src/CMakeFiles/cpprest.dir/http/client/http_client_msg.cpp.o' failed
make[2]: *** [src/CMakeFiles/cpprest.dir/http/client/http_client_msg.cpp.o] Error 1
CMakeFiles/Makefile2:75: recipe for target 'src/CMakeFiles/cpprest.dir/all' failed
make[1]: *** [src/CMakeFiles/cpprest.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

Link error with VS 2012

I have multiple error at link this like this:
error LNK2019: unresolved external symbol "__declspec(dllimport) long __cdecl pplx::details::platform::GetCurrentThreadId(void)" (_imp?GetCurrentThreadId@platform@details@pplx@@YAJXZ) referenced in function "public: void __thiscall pplx::details::_CancellationTokenState::_DeregisterCallback(class pplx::details::_CancellationTokenRegistration *)" (?_DeregisterCallback@_CancellationTokenState@details@pplx@@QAEXPAV_CancellationTokenRegistration@23@@z)

I added the cpprest120_2_7.lib to my project (nuget didn't keep the job done) but I'm stil missing symbol. It look like it's the only lib in the package.

When I check the pplx include I see weird thing like:

if (defined(_MSC_VER) && (_MSC_VER >= 1800)) && !CPPREST_FORCE_PPLX

error This file must not be included for Visual Studio 12 or later

endif

My _MSC_VER is define to 1700 since I'm on VS 2012 so I don't get the #error but the message said this file must not be included in VS2012. Is the message incorrect?

Thank you

C4592 warning in Visual Studio 2015 Update 1

There is a warning that stops compiling websocket++ in line 164, connection.hpp

static std::vector<int> const versions_supported = {0,7,8,13};
Severity Code Description Project File Line Suppression State
Warning C4592 'websocketpp::versions_supported': symbol will be dynamically initialized (implementation limitation) cpprestsdk140 \path\to\cpprestsdk\Release\libs\websocketpp\websocketpp\connection.hpp 164
Error C2220 warning treated as error - no 'object' file generated cpprestsdk140 \path\to\cpprestsdk\Release\libs\websocketpp\websocketpp\connection.hpp 164

Seems that it is a bug in vs2015-1:
http://stackoverflow.com/questions/34013930/error-c4592-symbol-will-be-dynamically-initialized-vs2015-1-static-const-std

outside_tests hit servers with behavior that depends on country of origin

Built from the latest revision (78f8554) in the master branch:

Starting test case outside_tests:outside_cnn_dot_com...
../tests/functional/http/client/outside_tests.cpp:56: error: Failure in outside_cnn_dot_com: CHECK_EQUAL(status_codes::OK, response.status_code()) where status_codes::OK=200 and response.status_code()=302
 FAILED
../tests/functional/http/client/outside_tests.cpp:61: error: Failure in outside_cnn_dot_com: CHECK_EQUAL(status_codes::OK, response.status_code()) where status_codes::OK=200 and response.status_code()=302
 FAILED
Test case outside_tests:outside_cnn_dot_com FAILED
Starting test case outside_tests:outside_google_dot_com...
../tests/functional/http/client/outside_tests.cpp:73: error: Failure in outside_google_dot_com: CHECK_EQUAL(status_codes::OK, response.status_code()) where status_codes::OK=200 and response.status_code()=302
 FAILED
../tests/functional/http/client/outside_tests.cpp:73: error: Failure in outside_google_dot_com: CHECK_EQUAL(status_codes::OK, response.status_code()) where status_codes::OK=200 and response.status_code()=302
 FAILED
Test case outside_tests:outside_google_dot_com FAILED
Starting test case outside_tests:multiple_https_requests...
../tests/functional/http/client/outside_tests.cpp:87: error: Failure in multiple_https_requests: CHECK_EQUAL(status_codes::OK, response.status_code()) where status_codes::OK=200 and response.status_code()=302
 FAILED
../tests/functional/http/client/outside_tests.cpp:87: error: Failure in multiple_https_requests: CHECK_EQUAL(status_codes::OK, response.status_code()) where status_codes::OK=200 and response.status_code()=302
 FAILED
../tests/functional/http/client/outside_tests.cpp:87: error: Failure in multiple_https_requests: CHECK_EQUAL(status_codes::OK, response.status_code()) where status_codes::OK=200 and response.status_code()=302
 FAILED
../tests/functional/http/client/outside_tests.cpp:87: error: Failure in multiple_https_requests: CHECK_EQUAL(status_codes::OK, response.status_code()) where status_codes::OK=200 and response.status_code()=302
 FAILED
../tests/functional/http/client/outside_tests.cpp:87: error: Failure in multiple_https_requests: CHECK_EQUAL(status_codes::OK, response.status_code()) where status_codes::OK=200 and response.status_code()=302
 FAILED
Test case outside_tests:multiple_https_requests FAILED
Starting test case outside_tests:reading_google_stream...
../tests/functional/http/client/outside_tests.cpp:107: error: Failure in reading_google_stream: CHECK_EQUAL(strcmp((const char *) chars, "<!doctype html><html itemscope=\"\" itemtype=\"http://schema.org/WebPage\""), 0) where strcmp((const char *) chars, "<!doctype html><html itemscope=\"\" itemtype=\"http://schema.org/WebPage\"")=1 and 0=0
 FAILED
Test case outside_tests:reading_google_stream FAILED

Any ideas?

Kind regards,
Alexander

Build error on iOS

I have the flowing errors:

The following build commands failed:
    CompileC /Users/rinopazzo/buildcasablanca/casablanca/Build_iOS/build.ioldcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:2927:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 && IntTraits<U>::isUint64 );
        ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:2936:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 && IntTraits<U>::isUint64 );
        ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:2950:9: errs/build.arm/src/casablanca.build/Release-iphoneos/cpprest.build/Objects-normal/armv7/http_client_msg.o src/http/clor: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 );
        ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:2958:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 );
        ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:2972:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<U>::isUint64 );
        ^
/Users/rinoient/http_client_msg.cpp normal armv7 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
pazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:2988:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<U>::isUint64 );
        ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:3004:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 );
        ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:3012:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 );
        ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:3025:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 && IntTraits<U>::isInt64 );
        ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:3034:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isUint64 && IntTraits<U>::isInt64 );
        ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:3048:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<U>::isInt64 );
        ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:3064:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<U>::isInt64 );
        ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:3080:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 );
        ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:3088:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 );
        ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:3100:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 && IntTraits<U>::isInt64 );
        ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:3109:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 && IntTraits<U>::isInt64 );
        ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:3123:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 );
        ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:3131:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<T>::isInt64 );
        ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:3144:9: error: unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
        C_ASSERT( IntTraits<U>::isUint64 );
        ^
/Users/rinopazzo/buildcasablanca/casablanca/Release/include/cpprest/details/SafeInt3.hpp:153:34: note: expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
                                 ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

make[2]: *** [CMakeFiles/arm] Error 65
make[1]: *** [CMakeFiles/arm.dir/all] Error 2
make: *** [all] Error 2

Annoying CRT memory leak reports with 2.7.0 build from NuGet

After upgrading a simple project using the library from VS2013 with C++ REST SDK 2.1.0 to VS2015 with 2.7.0 I started getting

Detected memory leaks!
Dumping objects ->
{345} normal block at 0x014A6970, 12 bytes long.
 Data: <       Yp  Y> 01 00 00 00 D0 9D E8 59 70 B4 F4 59 
{344} normal block at 0x014A5C28, 16 bytes long.
 Data: <piJ             > 70 69 4A 01 00 00 00 00 00 00 00 00 00 00 00 00 
{343} normal block at 0x014A5BA8, 20 bytes long.
 Data: <    (\J         > 01 00 00 00 28 5C 4A 01 01 00 00 00 04 00 00 00 
Object dump complete.

on application exit. The allocation stack for the allocation 343 looks like this:

>   ucrtbased.dll!malloc(unsigned int size=0x00000014) Line 18  C++
    cpprest140d_2_7.dll!default_malloc_ex(unsigned int num=0x00000014, const char * file=0x5f226ba4, int line=0x000000a2) Line 79   C
    cpprest140d_2_7.dll!CRYPTO_malloc(int num=0x00000014, const char * file=0x5f226ba4, int line=0x000000a2) Line 342   C
    cpprest140d_2_7.dll!sk_new(int(*)(const void *, const void *) c=0x5f132460) Line 162    C
    cpprest140d_2_7.dll!load_builtin_compressions() Line 483    C
    cpprest140d_2_7.dll!SSL_COMP_get_compression_methods() Line 1949    C
    cpprest140d_2_7.dll!SSL_library_init() Line 153 C
    cpprest140d_2_7.dll!boost::asio::ssl::detail::openssl_init_base::do_init::do_init() Line 40 C++
    cpprest140d_2_7.dll!boost::asio::ssl::detail::openssl_init_base::instance() Line 131    C++
    cpprest140d_2_7.dll!boost::asio::ssl::detail::openssl_init<1>::openssl_init<1>() Line 60    C++
    cpprest140d_2_7.dll!`dynamic initializer for 'boost::asio::ssl::detail::openssl_init<1>::instance_''() Line 90  C++
    ucrtbased.dll!_initterm(void(*)() * first=0x5f206000, void(*)() * last=0x5f206684) Line 22  C++

so it seems that the real problem is that ASIO initializes OpenSSL by calling SSL_library_init(), but SSL_COMP_free_compression_methods() is not being called anywhere, however it's impossible to work around this by calling it from the application code as OpenSSL seems to be statically linked in, so perhaps it could be done from Casablanca itself?

Support for Server Name Indication (SNI) missing in http_client_asio.cpp

Hi,

run into this issue with an OSX build of the latest C++ REST API 2.7.0.

There is no (default) support for the Server Name Indication TLS extension. OpenSSL does not enable the option automatically, so it needs to be set in the http_client_asio.cpp handshake implementation.

We tried adding it via set_native_handle_options first, but did not get it to work properly. This is probably the wrong place to do it anyway, because one would only need to set the SNI option once before the initial handshake, so it is contained within the ClientHello message.

Please see attached patch: cpprest_asio_ssl_sni.patch.txt

The patch unconditionally adds the server host name using the OpenSSL option SSL_set_tlsext_host_name before invoking the asynchronous handshake. Of course this could be improved to be provided via a config option.

Please note, SNI seems to be supported (automatically) on TLS connections when using the native WinHttp library - I remember starting with Windows Vista. Doing wireshark one can see the extension in the ClientHello send from a Windows app using the C++ REST API.

Let me know if you need more information.

Cheers,
Henning

Inconsistent encoding when comparing oauth1_config::m_token in oauth1_config::token_from_redirected_uri()

Hi,

I am getting an exception at final stage of authentication process - "redirected URI parameter 'oauth_token'='...' does not match temporary token='...'.".

Probably I found why it fails.

  1. When temporary token is received it is stored to oauth1_config::m_token as URI DECODED. See https://github.com/Microsoft/cpprestsdk/blob/master/Release/src/http/oauth/oauth1.cpp:319

  2. After redirection, we get access token by calling oauth1_config::token_from_redirected_uri(uri). Which throws an exception, because it tries to compare token stored at step 1) and URI ENCODED token from redirected uri.

The possible workflow: decode redirected uri manually for oauth1_config::token_from_redirected_uri. Is that correct solution?

Regards,
Vladimir.

Casablanca crashes under application verifier

Hi, Casablanca regularly seem to crash under application verifier. Are you aware of this?

(It might be caused by issues outside of Casablanca, so I am not trying to point the finger - keep up the fantastic work - I am simply curious if you also see the same)

Regards,
Gergely

Memory leaks if used from a DLL

I all,
I started to write a DLL project that uses the nuget cpprestsdk.V140.winapp version 2.7.0.
The DLL is a x64 MFC DLL type.
Memory leaks appear just if have a global object that looks like:
#include <cpprest/json.h>
web::json::value MyVal;
and I exit application by normal quit().
I load and release the DLL that use cpprest140d_2_7.dll by AfxLoadLibrary() and AfxFreeLibrary() respectively.

Sorry if I posted this task here and mybe it is inappropriate for this place.

Some idea/help?
Thank you in advantage.

Exception issues on OSX

CPPRest compiled on OSX exhibits a problem catching exceptions properly :

try
  {
    json::value::parse("some badly formatted JSON");
  }
  catch( const json::json_exception& e )
  {
    cout << "json::json_exception caught" << endl;
  }
  catch( const std::exception& e )
  {
    cout << "std::exception caught" << endl;
  }

Following code displays "std::exception caught" on OSX. This really should display "json::json_exception caught", instead. I suspect this is caused by known Apple GCC issue when shared libraries are not built using RTTI. See following StackOverflow article :

Polymorphically catching an exception in a -fno-rtti shared library on Mac OS X

(CPPRest 2.6.0, OSX Yosemite, XCode 6.4)

CPPRest issue repro.zip

How do I link/include the SDK on MacOSX

Hello guys,

I just did successful build of the SDK for Mac (https://github.com/Microsoft/cpprestsdk/wiki/How-to-build-for-Mac-OS-X). However, when I try to compile a simple program that imports it:

#include <cpprest/http_client.h>
#include <cpprest/filestream.h>


int main(void) {
    return 0;
}

I get:

g++ test.cpp -std=c++11 -I /Users/daniel/Desktop/workspace/casablanca/Release/include -L /Users/daniel/Desktop/workspace/casablanca/build.release/Binaries
In file included from test.cpp:1:
In file included from /Users/daniel/Desktop/workspace/casablanca/Release/include/cpprest/http_client.h:65:
In file included from /usr/local/include/boost/asio/ssl.hpp:19:
In file included from /usr/local/include/boost/asio/ssl/context.hpp:27:
In file included from /usr/local/include/boost/asio/ssl/context_base.hpp:19:
/usr/local/include/boost/asio/ssl/detail/openssl_types.hpp:19:10: fatal error: 'openssl/conf.h' file not found
#include <openssl/conf.h>
         ^
1 error generated.

Any ideas?

Clean application shutdown

Hi folks,

I just wanted to check with you what the best practices are for cleanly shutting down an application running Casablanca with ongoing async tasks? Normally in a multi-thread application we would join all worker threads. What's the right usage pattern for Casablanca and PPLX?

Thanks,
Chris

Building on openSUSE leap 42 fails

1). openSUSE leap 42
2). git clone
3). cd Release
4). cmake .
5). make
6).

CMakeFiles/test_runner.dir/test_runner.cpp.o: In function `boost::filesystem::path::path<boost::filesystem::directory_entry>(boost::filesystem::directory_entry const&, boost::enable_if<boost::filesystem::path_traits::is_pathable<boost::decay<boost::filesystem::directory_entry>::type>, void>::type*)':
test_runner.cpp:(.text._ZN5boost10filesystem4pathC2INS0_15directory_entryEEERKT_PNS_9enable_ifINS0_11path_traits11is_pathableINS_5decayIS4_E4typeEEEvE4typeE[_ZN5boost10filesystem4pathC5INS0_15directory_entryEEERKT_PNS_9enable_ifINS0_11path_traits11is_pathableINS_5decayIS4_E4typeEEEvE4typeE]+0x30): undefined reference to `boost::filesystem::path_traits::dispatch(boost::filesystem::directory_entry const&, std::string&)'
collect2: error: ld returned 1 exit status
tests/common/TestRunner/CMakeFiles/test_runner.dir/build.make:123: recipe for target 'Binaries/test_runner' failed
make[2]: *** [Binaries/test_runner] Error 1
CMakeFiles/Makefile2:296: recipe for target 'tests/common/TestRunner/CMakeFiles/test_runner.dir/all' failed
make[1]: *** [tests/common/TestRunner/CMakeFiles/test_runner.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

Update Websocket++ to 0.6.0

Crossposted from: https://casablanca.codeplex.com/discussions/648800

Several months ago, version 0.6.0 of WebSocket++ was released:
https://github.com/zaphoyd/websocketpp/releases
It brings some compelling features like Boost-less ASIO, which eliminates the need for Boost binaries for iOS and Android. But what interest me most is the upcoming support for permessage-deflate (linked from the above page, https://github.com/zaphoyd/websocketpp/archive/0.6.0-permessage-deflate.zip), which has the potential of compressing WebSocket data a lot.

Are their any plans to update WebSocket++ in Casablanca to the latest versions?

Thanks,
Boris

cpprest.natvis broken with VS2015

Ported from CodePlex discussion: https://casablanca.codeplex.com/discussions/646435
As per bsergeev:

I am trying to use cpprest.natvis in VS2015 to look at the value in web::json::value variable, but I'm getting this error:
Natvis: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Packages\Debugger\Visualizers\cpprest.natvis(168,68): Error: a pointer to a bound function may only be used to call the function
Error while evaluating '(_((web::json::details::Number)((m_value).Myptr))).m_number' in the context of type 'XXX.dll!web::json::value'.
The error is about checking the m_kind:


{(
((web::json::details::Number)((m_value)._Myptr))).m_number}

It looks like web::json::value::Number is correct description of an element of web::json::value_type enum, so, what's the problem here?

Are all you guys in Casablanca team working in Linux and nobody is using VS2015? It's not that bad, check it out! :-)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.