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.

Overview

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. If interested contact us askcasablanca at Microsoft dot com.

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.

Issues
  • CMake fixes + CMake search for OpenSSL (macOS)

    CMake fixes + CMake search for OpenSSL (macOS)

    • Homebrew sometimes appends the version of a package to it' directory name. Thus, one could have /usr/local/Cellar/[email protected]/ instead of /usr/local/Cellar/openssl/, or even both. I fixed the search for OPENSSL_ROOT_DIR and limited it's contents to one path only.
    • Added the <package>-config-version.in.cmake file configuration for CMake find_package usage.
    • Corrected condition in <package>-config.in.cmake for Boost usage. There was a @[email protected] AND OFF condition, which is always false. The result was that the Boost libraries and includes were not included in the users CMake project.
    • Use CMAKE_INSTALL_INCLUDEDIR to install headers. cpprestsdk already uses CMAKE_INSTALL_LIBDIR & CMAKE_INSTALL_BINDIR
    opened by Clovel 27
  • Doesn't build with  c++17  (VS 2017 15.5)

    Doesn't build with c++17 (VS 2017 15.5)

    Update 3 is causing compiler errors in CppRestSdk v 2.8

    2>C:\Dev\Couloir\3pLibs\cpprestsdk-master\Release\include\cpprest/streams.h(900): error C2187: syntax error: 'identifier' was unexpected here 2>C:\Dev\Couloir\3pLibs\cpprestsdk-master\Release\include\cpprest/streams.h(1133): note: see reference to class template instantiation 'Concurrency::streams::basic_istream<_CharType>' being compiled 2>C:\Dev\Couloir\3pLibs\cpprestsdk-master\Release\include\cpprest/http_msg.h(553): error C2039: 'to_utf16string': is not a member of '`global namespace'' 2>C:\Dev\Couloir\3pLibs\cpprestsdk-master\Release\include\cpprest/http_msg.h(553): error C3861: 'to_utf16string': identifier not found

    					return buffer.bumpc().then([](
    

    #ifndef _WIN32 // Required by GCC typename #endif 900 --.> concurrency::streams::char_traits::int_type) { return false; });

    Compilation: c++14 /permissive- /Zc:throwingNew /Zc:inline /bigobj

    Is there a simple code change I can make?

    opened by VikingExplorer 26
  • http_listener default thread count - 40 threads

    http_listener default thread count - 40 threads

    After trying the cpprest library out (on Linux), specifically the http_listener, I have quickly discovered that the default number of threads that are created is 40 threads. Nonetheless, I've examined the code, and I have been unable to ascertain why a value of 40 has been chosen.

    A hard-coded thread count is likely to go against a popular school of thought that the number of threads should match the number of CPU cores (or at the most: thread_count <= (2 x cpu cores)). For example, my development system contains 4 cores.

    Having thought about this further, there should be two (2) potential changes - the first one is easier than the second:

    1. The thread count should be configurable via a parameter during intialisation of the http_listener.
    2. Applicable classes should enable developers to instantiate instances of an object specifying a custom thread pool.

    Environment: Ubuntu Zesty 17.04 Boost 1.62 GCC 6.3 cpprest 2.9

    opened by zerodefect 24
  • Data race on _pplx_g_sched_t::get_scheduler()

    Data race on _pplx_g_sched_t::get_scheduler()

    Google's thread sanitizer is reporting a data race on _pplx_g_sched_t::get_scheduler() function which I discovered creating multiple websocket instances at the same time on Linux.

    You can run this simpler snippet to reproduce:

    #include <thread>
    #include <cpprest/ws_client.h>
    
    int main() {
      //pplx::get_ambient_scheduler();  // uncomment this line to fix the data race
      std::thread a([] () { pplx::get_ambient_scheduler(); });
      std::thread b([] () { pplx::get_ambient_scheduler(); });
      a.join();
      b.join();
      return 0;
    }
    

    This is sanitizer's output:

    ==================
    WARNING: ThreadSanitizer: data race (pid=4653)
      Read of size 8 at 0x7f96cf428c50 by thread T2:
        #0 std::__shared_ptr<pplx::scheduler_interface, (__gnu_cxx::_Lock_policy)2>::operator bool() const /usr/include/c++/8.2.1/bits/shared_ptr_base.h:1291 (libcpprest.so.2.10+0xa787a2)
        #1 pplx::_pplx_g_sched_t::get_scheduler() /home/bambino/projects/tradehelm/libfix-adapter/vendor/cpprest/Release/src/pplx/pplx.cpp:77 (libcpprest.so.2.10+0xa784e4)
        #2 pplx::get_ambient_scheduler() /home/bambino/projects/tradehelm/libfix-adapter/vendor/cpprest/Release/src/pplx/pplx.cpp:125 (libcpprest.so.2.10+0xa77e36)
        #3 operator() /data/projects/pruebas/c++/pplx-ambient-scheduler.cpp:7 (a.out+0x33a9)
        #4 __invoke_impl<void, main()::<lambda()> > /usr/include/c++/8.2.1/bits/invoke.h:60 (a.out+0x3b4e)
        #5 __invoke<main()::<lambda()> > /usr/include/c++/8.2.1/bits/invoke.h:95 (a.out+0x366b)
        #6 _M_invoke<0> /usr/include/c++/8.2.1/thread:244 (a.out+0x4198)
        #7 operator() /usr/include/c++/8.2.1/thread:253 (a.out+0x40c3)
        #8 _M_run /usr/include/c++/8.2.1/thread:196 (a.out+0x4024)
        #9 execute_native_thread_routine /build/gcc/src/gcc/libstdc++-v3/src/c++11/thread.cc:80 (libstdc++.so.6+0xbc062)
    
      Previous write of size 8 at 0x7f96cf428c50 by thread T1:
        #0 std::enable_if<std::__and_<std::__not_<std::__is_tuple_like<pplx::scheduler_interface*> >, std::is_move_constructible<pplx::scheduler_interface*>, std::is_move_assignable<pplx::scheduler_interface*> >::value, void>::type std::swap<pplx::scheduler_interface*>(pplx::scheduler_interface*&, pplx::scheduler_interface*&) /usr/include/c++/8.2.1/bits/move.h:195 (libcpprest.so.2.10+0xa78f48)
        #1 std::__shared_ptr<pplx::scheduler_interface, (__gnu_cxx::_Lock_policy)2>::swap(std::__shared_ptr<pplx::scheduler_interface, (__gnu_cxx::_Lock_policy)2>&) /usr/include/c++/8.2.1/bits/shared_ptr_base.h:1304 (libcpprest.so.2.10+0xa78da8)
        #2 std::enable_if<std::__sp_compatible_with<pplx::details::linux_scheduler*, pplx::scheduler_interface*>::value, std::__shared_ptr<pplx::scheduler_interface, (__gnu_cxx::_Lock_policy)2>&>::type std::__shared_ptr<pplx::scheduler_interface, (__gnu_cxx::_Lock_policy)2>::operator=<pplx::details::linux_scheduler>(std::__shared_ptr<pplx::details::linux_scheduler, (__gnu_cxx::_Lock_policy)2>&&) /usr/include/c++/8.2.1/bits/shared_ptr_base.h:1251 (libcpprest.so.2.10+0xa78bac)
        #3 std::enable_if<std::is_assignable<std::__shared_ptr<pplx::scheduler_interface, (__gnu_cxx::_Lock_policy)2>&, std::shared_ptr<pplx::details::linux_scheduler> >::value, std::shared_ptr<pplx::scheduler_interface>&>::type std::shared_ptr<pplx::scheduler_interface>::operator=<pplx::details::linux_scheduler>(std::shared_ptr<pplx::details::linux_scheduler>&&) /usr/include/c++/8.2.1/bits/shared_ptr.h:343 (libcpprest.so.2.10+0xa78947)
        #4 pplx::_pplx_g_sched_t::get_scheduler() /home/bambino/projects/tradehelm/libfix-adapter/vendor/cpprest/Release/src/pplx/pplx.cpp:82 (libcpprest.so.2.10+0xa7853c)
        #5 pplx::get_ambient_scheduler() /home/bambino/projects/tradehelm/libfix-adapter/vendor/cpprest/Release/src/pplx/pplx.cpp:125 (libcpprest.so.2.10+0xa77e36)
        #6 operator() /data/projects/pruebas/c++/pplx-ambient-scheduler.cpp:6 (a.out+0x3333)
        #7 __invoke_impl<void, main()::<lambda()> > /usr/include/c++/8.2.1/bits/invoke.h:60 (a.out+0x3910)
        #8 __invoke<main()::<lambda()> > /usr/include/c++/8.2.1/bits/invoke.h:95 (a.out+0x350d)
        #9 _M_invoke<0> /usr/include/c++/8.2.1/thread:244 (a.out+0x41f0)
        #10 operator() /usr/include/c++/8.2.1/thread:253 (a.out+0x412d)
        #11 _M_run /usr/include/c++/8.2.1/thread:196 (a.out+0x406e)
        #12 execute_native_thread_routine /build/gcc/src/gcc/libstdc++-v3/src/c++11/thread.cc:80 (libstdc++.so.6+0xbc062)
    
      Location is global 'pplx::_pplx_g_sched' of size 32 at 0x7f96cf428c40 (libcpprest.so.2.10+0x000000d58c50)
    
      Thread T2 (tid=4656, running) created by main thread at:
        #0 pthread_create /build/gcc/src/gcc/libsanitizer/tsan/tsan_interceptors.cc:915 (libtsan.so.0+0x2bf03)
        #1 __gthread_create /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:662 (libstdc++.so.6+0xbc359)
        #2 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) /build/gcc/src/gcc/libstdc++-v3/src/c++11/thread.cc:135 (libstdc++.so.6+0xbc359)
        #3 main /data/projects/pruebas/c++/pplx-ambient-scheduler.cpp:7 (a.out+0x3435)
    
      Thread T1 (tid=4655, finished) created by main thread at:
        #0 pthread_create /build/gcc/src/gcc/libsanitizer/tsan/tsan_interceptors.cc:915 (libtsan.so.0+0x2bf03)
        #1 __gthread_create /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:662 (libstdc++.so.6+0xbc359)
        #2 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) /build/gcc/src/gcc/libstdc++-v3/src/c++11/thread.cc:135 (libstdc++.so.6+0xbc359)
        #3 main /data/projects/pruebas/c++/pplx-ambient-scheduler.cpp:6 (a.out+0x3422)
    
    SUMMARY: ThreadSanitizer: data race /usr/include/c++/8.2.1/bits/shared_ptr_base.h:1291 in std::__shared_ptr<pplx::scheduler_interface, (__gnu_cxx::_Lock_policy)2>::operator bool() const
    ==================
    

    However, I don't see the actual data race on said function:

        sched_ptr get_scheduler()
        {
            switch (m_state)
            {
                case post_ctor:
                    // This is the 99.9% case.
    
                    if (!m_scheduler)
                    {
                        ::pplx::details::_Scoped_spin_lock lock(m_spinlock);
                        if (!m_scheduler)
                        {
                            m_scheduler = std::make_shared<::pplx::default_scheduler_t>();
                        }
                    }
    
                    return m_scheduler;
                default:
                    // This case means the global m_scheduler is not available.
                    // We spin off an individual scheduler instead.
                    return std::make_shared<::pplx::default_scheduler_t>();
            }
        }
    

    It's easy to avoid the WARNING reported by the sanitizer, making a call to pplx::get_ambient_scheduler() beforehand. In my application, I use a global variable which makes a call to the function and I wonder if something similar should be applied to cpprestsdk to ease the task to other developers seeing the same data-race.

    An alternative might be to call get_scheduler in _pplx_g_sched_t's constructor. Something like this:

    _pplx_g_sched_t() { m_state = post_ctor; get_scheduler(); }
    

    Thoughts? Ping @BillyONeal

    opened by whoan 21
  • Add support for HTTP redirecti in ASIO-based http_client

    Add support for HTTP redirecti in ASIO-based http_client

    HTTP redirect is currently supported by the WinHttp back-end, but has to be handled manually in user code when C++ REST SDK is built with the ASIO-based back-end. This kind of platform difference is frustrating for users.

    Solving this issue has been requested several times, e.g. #222. A previous PR #373 was abandoned.

    This PR enables us to pass the 'outside tests' that were identified as failing in #27, even after reverting both PR #499 (which worked around the problem by permitting MovedPermanent in the test) and another similar case from commit 4e19c0cfb439febf6b3ee20efc857313ca2ba7f7.

    If this PR seems acceptable, it should be straightforward to use the new http_client_config options in the http_client_winhttp implementation also, which would solve #171 more elegantly.

    Thoughts on how the headers sent with the redirect request are decided would be welcome!

    opened by garethsb 19
  • Latest master does not build for ubuntu

    Latest master does not build for ubuntu

    [email protected]:~/repos/casablanca/Release/build.debug$ make Scanning dependencies of target cpprest [ 1%] Building CXX object src/CMakeFiles/cpprest.dir/http/client/http_client.cpp.o In file included from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/eventfd_select_interrupter.hpp:80:0, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/select_interrupter.hpp:25, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/epoll_reactor.hpp:29, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/reactor.hpp:21, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/impl/task_io_service.ipp:24, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/task_io_service.hpp:198, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/impl/io_service.hpp:71, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/io_service.hpp:767, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/ssl/context.hpp:26, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/ssl.hpp:19, from /home/alon/repos/casablanca/Release/include/cpprest/http_client.h:53, from /home/alon/repos/casablanca/Release/src/pch/stdafx.h:104, from /home/alon/repos/casablanca/Release/src/http/client/http_client.cpp:16: /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/impl/eventfd_select_interrupter.ipp: In member function ‘void boost::asio::detail::eventfd_select_interrupter::interrupt()’: /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/impl/eventfd_select_interrupter.ipp:122:23: error: conversion to ‘int’ from ‘ssize_t {aka long int}’ may alter its value [-Werror=conversion] int result = ::write(write_descriptor_, &counter, sizeof(uint64_t)); ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/impl/eventfd_select_interrupter.ipp: In member function ‘bool boost::asio::detail::eventfd_select_interrupter::reset()’: /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/impl/eventfd_select_interrupter.ipp:135:30: error: conversion to ‘int’ from ‘ssize_t {aka long int}’ may alter its value [-Werror=conversion] int bytes_read = ::read(read_descriptor_, &counter, sizeof(uint64_t)); ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/impl/eventfd_select_interrupter.ipp:148:30: error: conversion to ‘int’ from ‘ssize_t {aka long int}’ may alter its value [-Werror=conversion] int bytes_read = ::read(read_descriptor_, data, sizeof(data)); ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/impl/eventfd_select_interrupter.ipp:153:28: error: conversion to ‘int’ from ‘ssize_t {aka long int}’ may alter its value [-Werror=conversion] bytes_read = ::read(read_descriptor_, data, sizeof(data)); ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/epoll_reactor.hpp:248:0, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/reactor.hpp:21, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/impl/task_io_service.ipp:24, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/task_io_service.hpp:198, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/impl/io_service.hpp:71, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/io_service.hpp:767, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/ssl/context.hpp:26, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/ssl.hpp:19, from /home/alon/repos/casablanca/Release/include/cpprest/http_client.h:53, from /home/alon/repos/casablanca/Release/src/pch/stdafx.h:104, from /home/alon/repos/casablanca/Release/src/http/client/http_client.cpp:16: /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/impl/epoll_reactor.ipp: In member function ‘int boost::asio::detail::epoll_reactor::get_timeout()’: /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/impl/epoll_reactor.ipp:605:42: error: conversion to ‘int’ from ‘long int’ may alter its value [-Werror=conversion] return timer_queues_.wait_duration_msec(5 * 60 * 1000); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~ In file included from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/ssl/context.hpp:786:0, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/ssl.hpp:19, from /home/alon/repos/casablanca/Release/include/cpprest/http_client.h:53, from /home/alon/repos/casablanca/Release/src/pch/stdafx.h:104, from /home/alon/repos/casablanca/Release/src/http/client/http_client.cpp:16: /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/ssl/impl/context.ipp: In member function ‘boost::system::error_code boost::asio::ssl::context::use_certificate_chain(const boost::asio::const_buffer&, boost::system::error_code&)’: /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/ssl/impl/context.ipp:757:35: error: conversion to ‘int’ from ‘long unsigned int’ may alter its value [-Werror=conversion] result = ::ERR_peek_last_error(); ~~~~~~~~~~~~~~~~~~~~~^~ In file included from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/socket_ops.hpp:333:0, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/ip/impl/address_v4.ipp:22, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/ip/address_v4.hpp:240, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/ip/address.hpp:21, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/ssl/impl/rfc2818_verification.ipp:23, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/ssl/rfc2818_verification.hpp:99, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/ssl.hpp:23, from /home/alon/repos/casablanca/Release/include/cpprest/http_client.h:53, from /home/alon/repos/casablanca/Release/src/pch/stdafx.h:104, from /home/alon/repos/casablanca/Release/src/http/client/http_client.cpp:16: /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/impl/socket_ops.ipp: In function ‘int boost::asio::detail::socket_ops::close(boost::asio::detail::socket_type, boost::asio::detail::socket_ops::state_type&, bool, boost::system::error_code&)’: /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/impl/socket_ops.ipp:345:17: error: conversion to ‘boost::asio::detail::socket_ops::state_type {aka unsigned char}’ from ‘int’ may alter its value [-Werror=conversion] state &= ~non_blocking; ^~~~~~~~~~~~ /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/impl/socket_ops.ipp: In function ‘bool boost::asio::detail::socket_ops::set_user_non_blocking(boost::asio::detail::socket_type, boost::asio::detail::socket_ops::state_type&, bool, boost::system::error_code&)’: /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/impl/socket_ops.ipp:397:63: error: conversion to ‘boost::asio::detail::socket_ops::state_type {aka unsigned char}’ from ‘int’ may alter its value [-Werror=conversion] state &= ~(user_set_non_blocking | internal_non_blocking); ^ /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/impl/socket_ops.ipp: In function ‘bool boost::asio::detail::socket_ops::set_internal_non_blocking(boost::asio::detail::socket_type, boost::asio::detail::socket_ops::state_type&, bool, boost::system::error_code&)’: /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/impl/socket_ops.ipp:446:17: error: conversion to ‘boost::asio::detail::socket_ops::state_type {aka unsigned char}’ from ‘int’ may alter its value [-Werror=conversion] state &= ~internal_non_blocking; ^~~~~~~~~~~~~~~~~~~~~ /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/impl/socket_ops.ipp: In function ‘int boost::asio::detail::socket_ops::setsockopt(boost::asio::detail::socket_type, boost::asio::detail::socket_ops::state_type&, int, int, const void*, std::size_t, boost::system::error_code&)’: /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/impl/socket_ops.ipp:1458:17: error: conversion to ‘boost::asio::detail::socket_ops::state_type {aka unsigned char}’ from ‘int’ may alter its value [-Werror=conversion] state &= ~enable_connection_aborted; ^~~~~~~~~~~~~~~~~~~~~~~~~ /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/impl/socket_ops.ipp: In function ‘int boost::asio::detail::socket_ops::ioctl(boost::asio::detail::socket_type, boost::asio::detail::socket_ops::state_type&, int, boost::asio::detail::ioctl_arg_type*, boost::system::error_code&)’: /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/impl/socket_ops.ipp:1739:65: error: conversion to ‘boost::asio::detail::socket_ops::state_type {aka unsigned char}’ from ‘int’ may alter its value [-Werror=conversion] state &= ~(user_set_non_blocking | internal_non_blocking); ^ /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/impl/socket_ops.ipp: In function ‘boost::system::error_code boost::asio::detail::socket_ops::getnameinfo(const socket_addr_type*, std::size_t, char*, std::size_t, char*, std::size_t, int, boost::system::error_code&)’: /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/impl/socket_ops.ipp:3356:79: error: conversion to ‘socklen_t {aka unsigned int}’ from ‘std::size_t {aka long unsigned int}’ may alter its value [-Werror=conversion] int error = ::getnameinfo(addr, addrlen, host, hostlen, serv, servlen, flags); ^ /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/impl/socket_ops.ipp:3356:79: error: conversion to ‘socklen_t {aka unsigned int}’ from ‘std::size_t {aka long unsigned int}’ may alter its value [-Werror=conversion] /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/asio/detail/impl/socket_ops.ipp:3356:79: error: conversion to ‘socklen_t {aka unsigned int}’ from ‘std::size_t {aka long unsigned int}’ may alter its value [-Werror=conversion] In file included from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/thread/thread_time.hpp:10:0, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/thread/lock_types.hpp:18, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/thread/pthread/mutex.hpp:16, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/thread/mutex.hpp:16, from /home/alon/repos/casablanca/Release/src/pch/stdafx.h:62, from /home/alon/repos/casablanca/Release/src/http/client/http_client.cpp:16: /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/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/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/date_time/microsec_time_clock.hpp:76:25: required from ‘static time_type boost::date_time::microsec_clock<time_type>::universal_time() [with time_type = boost::posix_time::ptime]’ /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/thread/thread_time.hpp:22:63: required from here /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/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/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/date_time/adjust_functors.hpp:13:0, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/date_time/gregorian/greg_duration_types.hpp:15, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/date_time/gregorian/gregorian_types.hpp:22, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/date_time/posix_time/posix_time_config.hpp:18, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/date_time/posix_time/posix_time_system.hpp:13, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/date_time/posix_time/ptime.hpp:12, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/date_time/posix_time/posix_time_types.hpp:12, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/thread/thread_time.hpp:11, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/thread/lock_types.hpp:18, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/thread/pthread/mutex.hpp:16, from /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/thread/mutex.hpp:16, from /home/alon/repos/casablanca/Release/src/pch/stdafx.h:62, from /home/alon/repos/casablanca/Release/src/http/client/http_client.cpp:16: /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/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/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/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/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/date_time/adjust_functors.hpp:77:29: 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/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/date_time/date_duration_types.hpp:67:16: 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/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/boost/date_time/posix_time/date_duration_operators.hpp:33:37: required from here /home/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/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/alon/repos/voiceengine/voiceengine/voiceengine/boost_1_65_1/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); ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ At global scope: cc1plus: error: unrecognized command line option ‘-Wno-format-truncation’ [-Werror] cc1plus: all warnings being treated as errors src/CMakeFiles/cpprest.dir/build.make:62: recipe for target 'src/CMakeFiles/cpprest.dir/http/client/http_client.cpp.o' failed make[2]: *** [src/CMakeFiles/cpprest.dir/http/client/http_client.cpp.o] Error 1 CMakeFiles/Makefile2:85: recipe for target 'src/CMakeFiles/cpprest.dir/all' failed make[1]: *** [src/CMakeFiles/cpprest.dir/all] Error 2 Makefile:140: recipe for target 'all' failed make: *** [all] Error 2

    opened by yaira24 19
  • WebSocket server implementation?

    WebSocket server implementation?

    I had been hoping to find a websocket server implementation to use alongside http_listener. Have I missed it, is it in the roadmap, or do you have any pointers on doing it myself (I'm currently looking at mashing something up wrapping websocketpp::server)?

    Thanks!

    opened by garethsb-ghost 18
  • Add in support for enabling tcp::no_delay and QUICKACK on both client and listener sockets

    Add in support for enabling tcp::no_delay and QUICKACK on both client and listener sockets

    Some applications will benefit from being able to enable tcp::no_delay as well as QUICKACK within both the client (http_client_asio.cpp) and listener (http_server_asio.cpp).

    I have previously opened #1189. And I think this should potentially address #468 (This actually does mention enabling tcp::no_delay by someone recently.

    I was previously experiencing horrendous RTT (roughly 100ms - 400ms+). Applying this on the client (both client and server use cpprestsdk) saw an improvement where now the average is 70ms RTT. I am still doing some experiments to see why this isn't lower, but this is a marked improvement because server profiling showed I was being blocked and hence "server CPU time" was more or less the RTT. Now, the "server CPU time" is roughly 4ms. So that in itself is dramatic.

    Note that from my initial testing, the client side seems more important. Yet I'm still also indicating we allow this enabled on the listeners as well. I am by no means claiming to be an expert on this. I am only suggesting the ability to enable on the listener for parity and to allow for easier experimentation.

    Ideally I wanted to create a wrapper handler in asio_connection's async_connect. This way anyone calling async_connect would have this automatically applied. However I could not get the syntax correct, so I ended up putting the code directly in the calling functions' handlers. Does anyone know how to properly create an "intermediary" handler so this could be more cleanly done?

    I have a branch with my changes. Note this forces it into this mode. The clean solution is to make this optional. But if anyone wants to test for timings to help see if this reduces some performance issues, that would be awesome.

    https://github.com/mobileben/cpprestsdk/tree/nagle-quickack

    Note the "nagle" in the branch name is a little misleading. This ends up disabling Nagle by enabling tcp::no_delay.

    opened by mobileben 13
  • Clang address sanitizer detects container-overflow on simple web::json::value::parse

    Clang address sanitizer detects container-overflow on simple web::json::value::parse

    Running a test that just contains this line:

    ::web::json::value::parse( R"([ { "k1" : "v" }, { "k2" : "v" }, { "k3" : "v" }, { "k4" : "v" } ])" );
    

    ...through Clang's address sanitizer, I get:

    ==9344==ERROR: AddressSanitizer: container-overflow on address 0x6030000029f8 at pc 0x00000059e020 bp 0x7fffeea53300 sp 0x7fffeea532f8
    READ of size 8 at 0x6030000029f8 thread T0
        #0 0x59e01f in std::__1::unique_ptr<web::json::details::_Value, std::__1::default_delete<web::json::details::_Value> >::reset(web::json::details::_Value*) /opt/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/../include/c++/v1/memory:2631:28
        #1 0x59e01f in std::__1::unique_ptr<web::json::details::_Value, std::__1::default_delete<web::json::details::_Value> >::~unique_ptr() /opt/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/../include/c++/v1/memory:2588
        #2 0x59e01f in web::json::value::~value() ~/source/cpprestsdk-clang/include/cpprest/json.h:71
        #3 0xdd7d00 in std::__1::allocator<web::json::value>::destroy(web::json::value*) /opt/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/../include/c++/v1/memory:1866:64
        #4 0xdd7d00 in void std::__1::allocator_traits<std::__1::allocator<web::json::value> >::__destroy<web::json::value>(std::__1::integral_constant<bool, true>, std::__1::allocator<web::json::value>&, web::json::value*) /opt/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/../include/c++/v1/memory:1728
        #5 0xdd7d00 in void std::__1::allocator_traits<std::__1::allocator<web::json::value> >::destroy<web::json::value>(std::__1::allocator<web::json::value>&, web::json::value*) /opt/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/../include/c++/v1/memory:1596
        #6 0xdd7d00 in std::__1::__vector_base<web::json::value, std::__1::allocator<web::json::value> >::__destruct_at_end(web::json::value*) /opt/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/../include/c++/v1/vector:421
        #7 0xdd7d00 in std::__1::__vector_base<web::json::value, std::__1::allocator<web::json::value> >::clear() /opt/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/../include/c++/v1/vector:364
        #8 0xdd7d00 in std::__1::__vector_base<web::json::value, std::__1::allocator<web::json::value> >::~__vector_base() /opt/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/../include/c++/v1/vector:458
        #9 0xdd7a84 in std::__1::vector<web::json::value, std::__1::allocator<web::json::value> >::~vector() /opt/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/../include/c++/v1/iterator:1427:74
        #10 0x7efd1d648a24 in web::json::array::~array() (~/source/cpprestsdk-clang/lib/libcpprest.so.2.10+0x57ea24)
        #11 0x7efd1d646780 in web::json::details::_Array::~_Array() (~/source/cpprestsdk-clang/lib/libcpprest.so.2.10+0x57c780)
        #12 0x7efd1d6467b8 in web::json::details::_Array::~_Array() (~/source/cpprestsdk-clang/lib/libcpprest.so.2.10+0x57c7b8)
        #13 0x59e131 in std::__1::default_delete<web::json::details::_Value>::operator()(web::json::details::_Value*) const /opt/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/../include/c++/v1/memory:2321:5
        #14 0x59e131 in std::__1::unique_ptr<web::json::details::_Value, std::__1::default_delete<web::json::details::_Value> >::reset(web::json::details::_Value*) /opt/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/../include/c++/v1/memory:2634
        #15 0x59e131 in std::__1::unique_ptr<web::json::details::_Value, std::__1::default_delete<web::json::details::_Value> >::~unique_ptr() /opt/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/../include/c++/v1/memory:2588
        #16 0x59e131 in web::json::value::~value() ~/source/cpprestsdk-clang/include/cpprest/json.h:71
        #17 0x58ae2a in _DOCTEST_ANON_FUNC_4() my-working-directory/clang-address-sanitizer/../desktop/test_desktop/desktop_test.cpp:19:5
        #18 0xaa9e09 in doctest::Context::run() my-working-directory/clang-address-sanitizer/../3rdparty/doctest.h:5367:21
        #19 0xab0b88 in main my-working-directory/clang-address-sanitizer/../utility/test_main/test_main.cpp:30:29
        #20 0x7efd14eccb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
        #21 0x4a50a9 in _start (my-working-directory/clang-address-sanitizer/desktop/test-desktop+0x4a50a9)
    
    0x6030000029f8 is located 24 bytes inside of 32-byte region [0x6030000029e0,0x603000002a00)
    allocated by thread T0 here:
        #0 0x57c152 in operator new(unsigned long) /tmp/final/llvm.src/projects/compiler-rt/lib/asan/asan_new_delete.cc:106:3
        #1 0xdd9857 in std::__1::__libcpp_allocate(unsigned long, unsigned long) /opt/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/../include/c++/v1/new:252:10
        #2 0xdd9857 in std::__1::allocator<web::json::value>::allocate(unsigned long, void const*) /opt/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/../include/c++/v1/memory:1799
        #3 0xdd9857 in std::__1::allocator_traits<std::__1::allocator<web::json::value> >::allocate(std::__1::allocator<web::json::value>&, unsigned long) /opt/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/../include/c++/v1/memory:1548
        #4 0xdd9857 in std::__1::__split_buffer<web::json::value, std::__1::allocator<web::json::value>&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<web::json::value>&) /opt/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/../include/c++/v1/__split_buffer:311
        #5 0x7efd1d65d48c in void std::__1::vector<web::json::value, std::__1::allocator<web::json::value> >::__emplace_back_slow_path<web::json::value>(web::json::value&&) (~/source/cpprestsdk-clang/lib/libcpprest.so.2.10+0x59348c)
        #6 0x7efd1d65b326 in web::json::details::JSON_Parser<char>::_ParseArray(web::json::details::JSON_Parser<char>::Token&) (~/source/cpprestsdk-clang/lib/libcpprest.so.2.10+0x591326)
        #7 0x7efd1d656f4b in web::json::details::JSON_Parser<char>::_ParseValue(web::json::details::JSON_Parser<char>::Token&) (~/source/cpprestsdk-clang/lib/libcpprest.so.2.10+0x58cf4b)
        #8 0x7efd1d652670 in web::json::details::JSON_Parser<char>::ParseValue(web::json::details::JSON_Parser<char>::Token&) (~/source/cpprestsdk-clang/lib/libcpprest.so.2.10+0x588670)
        #9 0x7efd1d65113a in web::json::value::parse(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) (~/source/cpprestsdk-clang/lib/libcpprest.so.2.10+0x58713a)
        #10 0x58ae1c in _DOCTEST_ANON_FUNC_4() my-working-directory/clang-address-sanitizer/../desktop/test_desktop/desktop_test.cpp:19:5
        #11 0xaa9e09 in doctest::Context::run() my-working-directory/clang-address-sanitizer/../3rdparty/doctest.h:5367:21
        #12 0xab0b88 in main my-working-directory/clang-address-sanitizer/../utility/test_main/test_main.cpp:30:29
        #13 0x7efd14eccb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
    
    HINT: if you don't care about these errors you may set ASAN_OPTIONS=detect_container_overflow=0.
    If you suspect a false positive see also: https://github.com/google/sanitizers/wiki/AddressSanitizerContainerOverflow.
    SUMMARY: AddressSanitizer: container-overflow /opt/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/../include/c++/v1/memory:2631:28 in std::__1::unique_ptr<web::json::details::_Value, std::__1::default_delete<web::json::details::_Value> >::reset(web::json::details::_Value*)
    Shadow bytes around the buggy address:
      0x0c067fff84e0: fa fa 00 00 00 00 fa fa 00 00 00 00 fa fa 00 00
      0x0c067fff84f0: 00 00 fa fa fd fd fd fd fa fa fd fd fd fd fa fa
      0x0c067fff8500: fd fd fd fd fa fa fd fd fd fd fa fa fd fd fd fd
      0x0c067fff8510: fa fa fd fd fd fd fa fa 00 00 00 fa fa fa 00 00
      0x0c067fff8520: 00 fc fa fa 00 00 00 00 fa fa 00 00 00 00 fa fa
    =>0x0c067fff8530: 00 00 00 00 fa fa 00 00 00 00 fa fa 00 00 00[fc]
      0x0c067fff8540: fa fa 00 00 00 00 fa fa fa fa fa fa fa fa fa fa
      0x0c067fff8550: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      0x0c067fff8560: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      0x0c067fff8570: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      0x0c067fff8580: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
    Shadow byte legend (one shadow byte represents 8 application bytes):
      Addressable:           00
      Partially addressable: 01 02 03 04 05 06 07 
      Heap left redzone:       fa
      Freed heap region:       fd
      Stack left redzone:      f1
      Stack mid redzone:       f2
      Stack right redzone:     f3
      Stack after return:      f5
      Stack use after scope:   f8
      Global redzone:          f9
      Global init order:       f6
      Poisoned by user:        f7
      Container overflow:      fc
      Array cookie:            ac
      Intra object redzone:    bb
      ASan internal:           fe
      Left alloca redzone:     ca
      Right alloca redzone:    cb
      Shadow gap:              cc
    

    I've confirmed that this problem still occurs with a recent commit (7368961107986d1aa801dbc65cb8b22c1090b1f3).

    I'm using:

    clang version 7.0.0 (tags/RELEASE_700/final)
    Target: x86_64-unknown-linux-gnu
    Thread model: posix
    InstalledDir: /usr/bin
    
    Ubuntu 18.04.1 LTS
    Linux 4.15.0-39-generic #42-Ubuntu SMP Tue Oct 23 15:48:01 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
    
    opened by tonyelewis 13
  • Memory leak?

    Memory leak?

    Why does code exhibit an apparent memory leak?

                TEST_F( WebServiceTests, client_request )
                {
                   // Setup
                   const String URL( L"https://url.net/Log/Messages/2.8" );
    
                   // Software Unit Under Test
                   web::http::uri TheURI( URL );
                   web::http::client::http_client client( TheURI );
    
                   client.request( web::http::methods::GET ).then( [&]( web::http::http_response response )
                   {
                      if( response.status_code() == web::http::status_codes::OK )
                      {
                         auto result = response.extract_json().get();
                      }
                      if( response.status_code() == web::http::status_codes::NotFound )
                      {
                         Log::msg( MALFUNCTION, "http_response 404" );
                      }
                   } ).get();
    
                   // Analysis
    
                   // Evaluate
    
                   // Cleanup
                }
    

    0 bytes in 0 Free Blocks. 416 bytes in 16 Normal Blocks. 12944 bytes in 14 CRT Blocks. 0 bytes in 0 Ignore Blocks. 0 bytes in 0 Client Blocks. Largest number used: 24252 bytes. Total allocations: 44796 bytes. C:\Dev\Couloir\3pLibs\Include\MemLeakListener.h(56): error: Failed Memory leak in WebServiceTests.client_request

    opened by VikingExplorer 13
  • Deadlock when closing the http_listener

    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);
        }
    
    bug 
    opened by gigaplex 13
  • cpprest gets hung after 4 or 5 consecutive requests

    cpprest gets hung after 4 or 5 consecutive requests

    pplx::taskweb::http::http_response request_task = client.request(request); try {
    web_response = request_task.get(); result = true;

        }
        catch (const std::exception& ex)
        {
            string_t errorMessage;
            ErrorMsg = L"Can't reach the confighub agent. " + utility::conversions::to_string_t(ex.what());
        }
        catch (...)
        {
            return result;
        }
        
        
        Tried debugging and could see  **web_response = request_task.get();** gets hung  . There is no server side issue.
    
      I have tried using wait/get on the task and it was not recommended as per below link so have removed it.
     [   https://github.com/microsoft/cpprestsdk/issues/1170]
    
    opened by sahnnu 1
  • Impact of “CVE-2022-2068” on cpprest sdk

    Impact of “CVE-2022-2068” on cpprest sdk

    Hi,

    OpenSSL has reported c_rehash scripts related vulnerability in "CVE-2022-2068" Reference: https://www.openssl.org/news/secadv/20220621.txt

    May I request to please let us know if there is any impact of "CVE-2022-2068" on cpprest functionality?

    Thank you and best regards, Mohit.

    opened by MohitRajShakya 3
  • http_request returns empty string for JSON data

    http_request returns empty string for JSON data

    I call the following function with a string (input webCall) that requests earnings data for a particular stock. I can send a request that asks for the 4 prior reports and that works correctly. When I increase the request to want 5 or more prior reports the data that is returned in an empty string and the status code is ok (200). I have done the same request using a command line CURL command and it works so I know that the server I am requesting the data from is capable of returning whatever length of data I am requesting. Therefore, I am assuming I have not configured something correctly and the return value is getting rejected for some type of size limitation issue. I am very to new to using the the cpprestsdk so I am thinking my lack of knowledge on how to configure things is the issue, but I don't know what to do! FYI, I have not included the exact https request since it has an api_key code that I had to pay for. The code is as follows:

    // Creates an HTTP request and prints the length of the response stream. pplx::task HTTPStreamingAsync(std::string& returnString, int& returnCode, std::string webCall) { returnString = "";

    const size_t newSize = 1000;
    wchar_t wcstring[newSize];
    size_t convertedChars = 0;
    mbstowcs_s(&convertedChars, wcstring, newSize, webCall.c_str(), _TRUNCATE);
    // Declare webservice to consume json data from it
    http_client client(wcstring);
    
    //Set parameters for request
    http_request req(methods::GET);
    req.headers().set_content_type(L"application/json");
    //req.headers().set_content_type(L"application/json; charset=UTF-8");
    
    // Make the request and asynchronously process the response. 
    return client.request(req).then([&returnString, &returnCode](http_response response)
    	{
    		// Print the status code.
    		returnCode = response.status_code();
    		if (response.status_code() != status_codes::OK)
    		{
    			returnString = "";
    			return pplx::task_from_result();
    		}
    
    		// process the response.
    		istream bodyStream = response.body();
    		unsigned int responseLength = (unsigned int)response.headers().content_length();
    
    		std::cout << "response.status_code()=" << response.status_code() << "\n";
    		std::cout << "responseLength=" << responseLength << "\n";
    
    		container_buffer<std::string> inStringBuffer;
    		return bodyStream.read(inStringBuffer, responseLength).then([inStringBuffer, &returnString](size_t bytesRead)
    			{
    				const std::string& text = inStringBuffer.collection();
    				//std::cout << text + "\n";
    				returnString = text;
    			});
    	});
    

    }

    Also, just to know, the request is for JSON data and I just want to get the raw string and I will parse it using a JSON parser that I have already built.

    Any help or suggestions would be greatly appreciated!

    opened by JustGuessing123 0
  • Unable to build with clang-cl

    Unable to build with clang-cl

    /// <returns>0 if the read request is still outstanding, -1 if the request failed, otherwise the size of the data read
    /// into the buffer</returns>
    size_t _read_file_async(.....
    
    auto res =_read_file_async();
    switch(res) {
    case(-1): <- clang-cl will rightfully reject this since -1 is never returned 
    }
    
    opened by Neumann-A 0
  • Fix likely typo in SafeInt3.hpp, that results in error with clang 15

    Fix likely typo in SafeInt3.hpp, that results in error with clang 15

    Please double check before merge. Prior to this, it resulted in following error while trying to build with the Emscripten toolchain.

    [  1%] Building CXX object Release/src/CMakeFiles/cpprest.dir/http/client/http_client.cpp.o
    In file included from /cpprestsdk/Release/src/http/client/http_client.cpp:16:
    In file included from /cpprestsdk/Release/src/pch/stdafx.h:73:
    In file included from /cpprestsdk/Release/include/cpprest/details/basic_types.h:31:
    /cpprestsdk/Release/include/cpprest/details/SafeInt3.hpp:1577:32: error: parameter 'b' set but not used [-Werror,-Wunused-but-set-parameter]
        static void CastThrow(bool b, T& t) SAFEINT_CPP_THROW
    
    opened by Fighter19 0
  • cpprest_compat breaks cURL header when building with Clang 14

    cpprest_compat breaks cURL header when building with Clang 14

    opened by lilianmoraru 1
Releases(2.10.18)
  • 2.10.18(Feb 2, 2021)

    cpprestsdk (2.10.18)

    • PR#1571 Add ability to parse and emit the NT Epoch 1601-01-01T00:00:00Z
    • PR#1571 Update vcpkg submodule
    • Update CI configuration -- cpprestsdk team MON, 1 Feb 2021 20:02:00 -0700
    Source code(tar.gz)
    Source code(zip)
  • 2.10.17(Dec 31, 2020)

    • PR#1550 Fix year calculation for the last day of a leap year
    • PR#1523 Fix wrong linking of Apple Frameworks on MacOS
    • PR#1520 Define __STDC_FORMAT_MACROS when it hasn't been defined to avoid duplicate define error.
    • PR#1415 Delete apparently broken .vcxprojs and .pfxes.
    • Removed defunct email contact information from the readme -- cpprestsdk team WED, 30 Dec 2020 20:08:00 -0700
    Source code(tar.gz)
    Source code(zip)
  • v2.10.16(Apr 25, 2020)

    • PR#1383 CMake fixes + CMake search for OpenSSL (macOS)
    • PR#1392 Update submodule websocketpp to 0.8.2
    • PR#1393 Do not report errors (such as EBADF and EINVAL) from setsockopt here, since this is a performance optimization only, and hard errors will be picked up by the following operation
    • PR#1379 Fix compilation with GCC 4.8/4.9, which was broken by commit 53fab3a.
    • PR#1328 Add support for HTTP redirection in ASIO and WinHTTP-based http_clients
    • PR#1332 Fix more http test build fails in certain configurations
    • PR#1370 Remove redundant std::move noted by gcc 9.2 (-Wredundant-move)
    • PR#1372 Static analyzer (PVS Studio) fixes
    • PR#1350 Expose json::value::parse for UTF8 string on Windows
    • PR#1344 libcpprestsdk: fix building as a static library -- cpprestsdk team [email protected] FRI, 24 Apr 2020 16:56:00 -0700
    Source code(tar.gz)
    Source code(zip)
  • v2.10.15(Feb 24, 2020)

    • Extremely special thanks to @garethsb-sony for a large number of contributions in this release
    • PR#1209 Workarounds for two GCC 4.7.2 bugs with lambda functions
    • PR#1220 Fix SxS debug-release builds with Visual Studio
    • PR#1219 Fix "Data" to "Date" in the HTTP Server API mapping, and clarify that the indices of these values match the HTTP_HEADER_ID values for HTTP_REQUEST_HEADERS but not HTTP_RESPONSE_HEADERS
    • PR#1196 Fixing of connections_and_errors::cancel_with_error test which sometimes fires false positive error "There are no pending calls to next_request."
    • PR#1233 Trim whitespace and nulls the same way.
    • PR#1248 Avoid using permissive- with ZW which breaks VS2019
    • PR#1182 Support for WinHTTPAL curl-to-WinHTTP adapter
    • PR#1253 http_server_httpsys.cpp requires linking against httpapi.lib, http_client_winhttp.cpp does not.
    • PR#1263 Remove trailing slash on websocketpp submodule url, which causes checkout failure on CircleCI with git 2.22.0
    • PR#1293 Update vcpkg and remove tests that look for web servers that no longer exist
    • PR#1288 Fix test case broken by commit f4c863b
    • PR#1276 Added comparison overrides to utility::datetime
    • PR#1289 Fix various warnings reported by gcc 9.3, and possibly earlier versions
    • PR#1334 Update vcpkg and boost on Android
    • PR#1306 Change default installation directory for cmake files to cmake/cpprestsdk
    • PR#1330 Use LC_ALL_MASK rather than LC_ALL when calling newlocale
    • PR#1310 Add TCP_NODELAY to disable Nagle's algorithm in Boost.ASIO-based http_client
    • PR#1335 Turn VS2015 back on now that vcpkg is fixed.
    • PR#1322 Enable HTTP compression support on all platforms
    • PR#1340 Add Ubuntu 18.04 testing.
    • PR#1342 Use C++11 synchronization classes under macOS too
    • PR#1339 Fix tcp::resolver data race in the asio backend and be defensive against empty results -- cpprestsdk team [email protected] THR, 22 Feb 2020 08:31:00 -0800
    Source code(tar.gz)
    Source code(zip)
  • v2.10.14(Jul 16, 2019)

    • Potential breaking change warning: This release changes the "default" proxy for the WinHTTP backend to go back to WINHTTP_ACCESS_TYPE_DEFAULT_PROXY. See https://github.com/microsoft/cpprestsdk/commit/60e067e71aebebdda5d82955060f5f0821c9df1d for more details. To get automatic WPAD behavior, set the proxy to auto detect.
    • macOS with Brew and iOS builds have been disabled and are no longer being tested because our dependency boost for ios project appears to be broken with current releases of XCode as on the Azure Pipelines machines. We are interested in macOS / iOS folks who know what's going on here in contributing a repair to turn this back on.
    • PR##1133 Add switches to make apiscan happy.
    • PR##1130 json: {"meow"} is not a valid object
    • PR##1150 Undefine compress if it is defined by zconf.h
    • PR##1156 Fix broken CI Builds
    • PR##1155 Use EVP_MAX_MD_SIZE instead of HMAC_MAX_MD_CBLOCK
    • PR##1145 Remove the address_configured flag on tcp::resolver::query
    • PR##1143 add ping and pong to message handler
    • PR##539 Fix reusing ASIO http_client connecting to HTTPS server via proxy
    • PR##1175 Fix issue #1171: Order of object destruction
    • PR##1183 FIX: SSL proxy tunnel support with basic auth
    • PR##1184 Fix profile being set on the compiler instead of the linker.
    • PR##1185 Update boost-for-android for Android NDK r20 and disable macOS Homebrew.
    • PR##1187 Replace CPPREST_TARGET_XP with version checks, remove ""s, and other cleanup
    • PR##1188 Remove proxy settings detection behavior in "default proxy mode." -- cpprestsdk team [email protected] TUE, 16 Jul 2019 09:06:00 +0200
    Source code(tar.gz)
    Source code(zip)
  • v2.10.13(Apr 25, 2019)

    • PR#1120 Fix off by one error in leap years before year 2000, and bad day names
    • PR#1117 Parse and emit years from 1900 to 9999, and remove environment variable dependence on Android
    • PR#1106 Paranoia for overflow of sprintf buffer in the year 10000
    • PR#1101 Update request_timeout_microsecond timeout
    • PR#1097 Allow error handling for time out in http_client_asio handle_connect
    • PR#1094 Avoid tripping over 32 bit time_t mistakes.
    • PR#1093 Don't initialize atomic_flag with 0. -- cpprestsdk team [email protected] WED, 24 Apr 2019 10:57:00 -0800
    Source code(tar.gz)
    Source code(zip)
  • v2.10.12(Mar 27, 2019)

    • PR#1088 Fix data race, GitHub #1085
    • PR#1084 Fix oauth nonces containing nulls.
    • PR#1082 Workaround data-race on websocketpp's _htonll function
    • PR#1080 Fix thread not joined
    • PR#1076 Rewrite date formatting and parsing -- cpprestsdk team [email protected] TUE, 26 Mar 2019 11:57:00 -0800
    Source code(tar.gz)
    Source code(zip)
  • v2.10.11(Mar 20, 2019)

    • PR##1073 Move get_jvm_env back into the crossplat namespace
    • PR##1049 Add the missing ssl::context callback in websocket_client_config
    • PR##1072 Gate stdext::checked_array_iterator usage on _ITERATOR_DEBUG_LEVEL
    • PR##1051 Fix http_client_asio "https" with a proxy
    • PR##1071 Add --vcpkg-root to repair UWP.
    • PR##1041 Update Boost_for_android for Android R19
    • PR##1064 Enable testing from root directory
    • PR##1057 Returns int64 value in function of seeking to file end on x64 Windows.
    • PR##1068 Don't close the output stream when reporting errors reading the body.
    • PR##1053 Update vcpkg.
    • PR##1032 Fix HTTP/1.0 'Keep-Alive' handling in http_client
    • PR##1040 Disable WINHTTP_AUTOPROXY_OPTIONS machinery when using WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY.
    Source code(tar.gz)
    Source code(zip)
  • v2.10.10(Jan 30, 2019)

  • v2.10.9(Jan 19, 2019)

    • PR#973 Address gcc warnings-as-errors in compression code, test improvements
    • PR#986 Prevent infinite loop during proxy authentication
    • PR#987 Remove use of aligned_union that broke CentOS 7.
    • PR#1004 #993, #1002: Add flexibility for iOS building. Adds command line args…
    • PR#1009 gcc: Fix compilation with -fno-operator-names
    • PR#1019 FIX: crash with std::logic_error when reusing a connection that timed out on the server
    • PR#1021 handle null bytes when parsing utf8
    • PR#1017 Add in support for adding i386 slice when building for 32-bit targets. Also improve messaging and add means to clean
    • PR#1024 http_compression.cpp: fix build with gcc 4.7
    • PR#1022 Resolve double free when WinHttpSendRequest fails
    Source code(tar.gz)
    Source code(zip)
  • v2.10.8(Nov 14, 2018)

    • PR#938 Allow ppltasks.h and pplxtasks.h to co-exist
    • PR#951 Fix incorrect const in reinterpret_cast
    • PR#955 Fix UWP missing header
    • PR#956 Adds support for OpenSSL 1.1.1
    • PR#959 Fix Android build issue by remove the crossplat name space before android parameters
    • PR#960 Update vcpkg to latest master to fix VS2015 build.
    • PR#966 Fix string size for error message generated by windows_category
    • PR#958 Add uri_builder::append_path_raw(...) to allow adding elements to path intentionally beginning with '/' ("//" will result in the final path value)
    • PR#952 cmake: add code to detect system brotli library
    • PR#963 Fix Brotli compress_helper early termination issue
    • PR#961 Fixes iOS builds and makes it more future proof
    Source code(tar.gz)
    Source code(zip)
  • v2.10.7(Oct 31, 2018)

    cpprestsdk (2.10.7)

    • cpprestsdk now has Azure Pipelines continuous integration.
    • Builds for Android and iOS were repaired, now checked in Azure Pipelines to make sure that doesn't bit-rot in the future.
    • Several race conditions in the listener were worked around; the listeners remain experimental and are unlikely to productized in their current form; the race conditions are structural, but at least the client tests pass most of the time.
    • Incorrect handling of connection pooling bug that caused segfaults on Ubuntu introduced in 2.10.4 has been repaired.
    • websocketpp checked in 0.5.1 version has been changed to a submodule and updated to 0.8.1.
    • Added an API to set the number of threads in the asio thread pool, see PR#883
    • Legacy unmaintained Visual Studio project files have been deleted, please use CMake instead.
    • PR#670 Export methods to set/get the ambient scheduler in cpprest dll
    • PR#866 Add Transfer-Encoding compression support and extensible compression API
    • PR#892 Improve utf8_to_utf16 speed for common path
    • PR#897 added URI resolution according to RFC3986
    • PR#935 Fix spelling mistakes across the library
    • PR#936 Use pplx namespace consistently
    • PR#937 Remove _ASYNCRTIMP from ~http_listener() and implement inline
    • PR#940 Avoid using identifiers reserved by C++ in header guards
    • PR#943 blackjack sample: use vector instead of shared pointer for array -- cpprestsdk team [email protected] MON, 30 Oct 2018 20:32:00 -0800

    cpprestsdk (2.10.6)

    • PR#844 Fix clang build error -- cpprestsdk team [email protected] MON, 30 Aug 2018 16:51:00 -0800

    cpprestsdk (2.10.5)

    • Issue#842 Fix incorrect cpprest/version.h -- cpprestsdk team [email protected] FRI, 17 Aug 2018 09:47:00 -0800

    cpprestsdk (2.10.4)

    • Added a .clang-format to enable consistent formatting.
    • Added support for Host: headers changing the checked CNAME field for SSL certificates in WinHTTP and Asio.
    • PR#736 passes 0666 to open() for creating files to better match the default behavior for other http clients (wget, etc).
    • PR#732 fixes a build issue with clang
    • PR#737 taught our cmake to respect the GNUInstallDirs variables
    • PR#762 improved handling of dead connections in the connection pool on Asio.
    • PR#750 improved error handling in the accept() call in http_listener
    • PR#776 improved the iOS buildsystem -- cpprestsdk team [email protected] WED, 15 Aug 2018 12:35:00 -0800

    cpprestsdk (2.10.3)

    • Added a root CMakeLists.txt to improve support for VS2017 Open Folder.
    • PR#809 improves support for /permissive- in MSVC
    • Issue#804 fixed a regression due to compression support; we no longer fail on unknown Content-Encoding headers if we did not set Accepts-Encoding
    • PR#813 fixes build failure with boost 1.63
    • PR#779 PR#787 suppress and fix some warnings with new versions of gcc and clang -- cpprestsdk team [email protected] THU, 2 Aug 2018 15:52:00 -0800
    Source code(tar.gz)
    Source code(zip)
  • v2.10.1(Dec 15, 2017)

    This is a minor, source only release. Please contact your distribution maintainers for updates to precompiled binaries.

    • Improved CMake generation of UWP binaries.
    • Fixed regression in CMake versions supported. As listed in the main CMakeLists.txt, we intend to only require 3.0.
    • Mirrored changes in the main PPL sources to Concurrency::details::do_while(), which yield a significant compiler throughput improvement on MSVC
    • Fix issues under /permissive-, an on-by-default flag for new projects in VS2017 15.5
    Source code(tar.gz)
    Source code(zip)
  • v2.10.0(Oct 21, 2017)

    Release Notes

    This is a source only release. Please contact your distribution maintainers for updates to precompiled binaries.

    • Removed VS2013 MSBuild files. Use CMake with the "Visual Studio 12 2013" generator.
    • Added VS2017 MSBuild files for convenience. It is highly recommended to use vcpkg or CMake instead to build the product library.
    • Added UWP versions of the Windows Store samples for VS2017.
    • Updated minimum required cmake version to 3.0.
    • Added CMake config-file support to installation. This should be consumed by doing:
    find_package(cpprestsdk REQUIRED)
    target_link_libraries(my_executable PRIVATE cpprestsdk::cpprest)
    
    • Fixed several race conditions and memory leaks in the ASIO http_client.
    • Fixed process termination bug around certain exceptional cases in all http_clients.
    • Improved handling of /Zcwchar_t- on MSVC. That doesn't make it a good idea.
    • Fixed use-after-free in the Windows Desktop http_client exposed by VS2017.
    • Totally overhaul the CMake buildsystem for much better support of Windows and more shared code between platforms.
    • PR#550 adds all remaining official HTTP status codes to http::status_codes.
    • PR#563 wraps SSL errors on Windows Desktop in http_exceptions, with more readable descriptions.
    • PR#562 and PR#307 fixes building with LibreSSL.
    • PR#551 adds convenience wrappers json::value::has_T_field(T) for inspecting object values.
    • PR#549 fixes a race condition in the ASIO client during header parsing.
    • PR#495 fixes a memory leak during proxy autodetection on Windows Desktop.
    • PR#496 and PR#500 expand proxy autodetection to also consider Internet Explorer settings on Windows Desktop.
    • PR#498 fixes error when handling responses of type NoContent, NotModified, or from 100 to 199.
    • PR#398 enables specifying the User Agent used in OAuth2 requests.
    • PR#494 improves the BingRequest sample's handling of proxies.
    • PR#516 enables certificate revocation checks on Windows Desktop.
    • PR#502 improves compatibility with glibc 2.26.
    • PR#507 adds http_request::get_remote_address() to expose the client's IP address for http_listener.
    • PR#521 enables use of empty passwords on Windows in web::credentials.
    • PR#526 and PR#285 improve compatibility with openssl 1.1.0.
    • PR#527 fixes a bug in the ASIO http_client where the proxy is passed the same credentials as the target host.
    • PR#504 makes uri_builder::to_string() and uri_builder::to_uri() const.
    • PR#446 adds handling for the host wildchar + to the ASIO http_listener.
    • PR#465 improves compatibility with clang on Linux.
    • PR#454 improves compatibility with icc 17.0.
    • PR#487 fixes static library builds of test_runner on non-Windows platforms.
    • PR#415 handles malformed URL requests to the ASIO http_listener instead of crashing.
    • PR#393 fixes a race condition in the websocketpp websocket_client.
    • PR#259 fixes several races in the ASIO http_listener which result in memory leaks or use after free of the connection objects.
    • PR#376 adds http_client_config::set_nativesessionhandle_options() which enables customization of the session handle on Windows Desktop.
    • PR#365 updates our convenience OpenSSL build scripts for Android to use openssl 1.0.2k.
    • PR#336 makes the ASIO http_client more consistent with the Windows clients by not appending the port when it is default. This improves compatibility with AWS S3.
    • PR#251 dramatically improves UTF8/16 conversions from 6s per 1MB to 3s per 1GB (2000x improvement).
    • PR#246 enables TLS 1.1 and 1.2 on Windows 7 and Windows 8.
    • PR#308 enables limited IPv6 support to http_client and http_server, depending on the underlying platform.
    • PR#309 fixes a bug in base64 encoding that previously read beyond the input array, causing segfaults/AVs.
    • PR#233 adds compression support (deflate and gzip) for Windows Desktop and ASIO http_clients based on Zlib.
    • PR#218 fixes a memory leak in the UWP http_client when processing headers.
    • PR#260 fixes inappropriate handling of certain connections errors in the ASIO http_listener.
    Source code(tar.gz)
    Source code(zip)
  • v2.9.0(Oct 20, 2016)

    Release Notes

    Linux

    • Merged #70 & #65 which should fix building on CentOS/RedHat.
    • #143 Work around SSL compression methods memory leak in ASIO.
    • #82 Fixed ambiguous call to begin when using with boost library.
    • #117 Fix header reading on linux listener using HTTPS.
    • #97 Add support for basic authentication.
    • #206 remove warnings-errors for system-headers under linux; honour http_proxy env-variable.

    OSX

    • #114 Removed redundant std::move() that was causing errors on Xcode 7.3 gcc.
    • #140 Fix returning std::move causing build failure on osx.

    Android

    • #137 Fix android build script for linux, remove libiconv dependency.

    Windows

    • #150 Add static library for windows xp.
    • #115 Added projects which target v140_xp to resolve Issue#113.
    • #71 Add a project for compiling as a static lib.

    WebSockets

    • #102 Added websocket_client_config option for ssl verify mode.
    • #217 Fixed race condition in Casablanca WinRT Websocket client.

    http_client

    • #131 Update to include access control allow origin.
    • #156 add host based connection pool map on non windows http_clients.
    • #161 Header parsing assumes whitespace after colon.
    • #146 Fix ambiguous reference to ‘credentials’

    Uri

    • #149 Some perf improvements for uri related code.

    Json

    • #86 Fix obtaining raw string_t pointer from temporary.
    • #96 Fix typo hexidecimal/hexadecimal.
    • #116 Fixing latin1 to UTF-16 convertion.

    pplx

    • #47 Fixing .then to work with movable-only types.

    Misc

    • Switched license from Apache 2.0 to MIT
    • Streamlined development model by removing the "development" branch. Please make PRs against master form this point forward and use tags to retrieve a specific stable version.
    Source code(tar.gz)
    Source code(zip)
  • v2.8.0(Feb 26, 2016)

    Release Notes

    oauth 1.0

    • Merged #66 which adds proxy support for oauth1_config class.

    oauth 2.0

    • Merged #1 which adds proxy support for token_from_code and token_from_refresh methods.
    • Merged #38: Include cpprest/details/web_utilities.h to bring in the definition for web_proxy.

    http_client

    • Merged #39: Add TLS extension SNI for boost asio based http_client. Resolves #35.
    • Merged #40 which allows specifying a host header in http requests.
    • Merged #41 which adds HTTP and HTTPS client proxy support for non-Windows platforms.
    • Merged #55 which fixes a bug where http_client_asio took forever to cancel.

    http_listener

    • Merged #16: win32 http_listener response refactor.

    iOS

    • Merged #23 which fixes build errors on iOS. Resolves #12.

    Windows

    • Merged #26: Static lib compilation for UWP.

    Websockets

    • Merged #30 which adds a CPPREST_EXCLUDE_WEBSOCKETS option to CMake to allow removing all OpenSSL and Boost dependencies.
    • Merged #37 which fixes C4592 warning under Visual Studio 2015 Update 1 in websockets++. Resolves #34.

    Buildsystem

    • a075fb2b fixes issues with MSBuild's multicore switch (/m).
    • Merged #30 which adds PCH support for the Visual Studio generator via CMake.

    Miscellaneous

    • Merged #17 which removes an unused variable in streams.h .
    • Merged #20 which adds unsolicited pong support with integration tests.
    • Merged #43 which fixes compilation on FreeBSD.
    Source code(tar.gz)
    Source code(zip)
  • v2.7.0(Nov 23, 2015)

    Release Notes

    websockets

    • Merged pull request allowing through CMake to use an external version of Websocket++. #294
    • Fixed potential AV with the Windows Runtime websocket client, if the task returned from the close function wasn't waited to complete before running the destructor.
    • Merged pull request fixing potential AV with the Windows Runtime websocket_client, if the destructor was run without the user waiting on the task returned from connect to complete. Technically users should always make sure to wait for the connection to succeed or fail, this just helps incase that wasn't done.
    • Merged pull request for Adding proxy support for token_from_code and token_from_refresh methods.

    http_client

    • Merged pull request adding support for timeouts down to the microsecond level. Please note not all platforms support this fine granularity, some only down to milliseconds.
    • Fixed issue where Boost.Asio based http_client incorrectly used the http_client_config timeout setting for determining how long to keep around connections in the pool before closing.

    http_listener

    • Fixed bug with Boost.Asio based http_listener where the incoming request body stream write head wasn't closed. #325
    • Merged pull request to enable https listener and client ca

    uri_builder

    • Updated uri_builder::append_query API that operators on a provided key and value to percent encode the '&', ';', '=' characters to avoid any confusion. #396

    miscellaneous

    • Fixed issue with utf16_to_utf8 utility function when encoding certain surrogate pairs. #392
    • Merged a couple of pull requests (here, here, and here) fixing several issues with arm64. #312, #291
    • Merged pull request fixing double include issues when building with CMake.
    • Merged pull request fixing cast issue on FreeBSD.
    • Removed unnecessary heap allocation and cleaned up a bit the scoped_c_thread_locale::c_locale() implementation.

    Windows

    • Removed some unnecessary _MSC_VER macro checks as Visual Studio 2012 is no longer supported.
    • Fixed several incorrect assumptions of thread safe function local static initialization with Visual Studio 2013. #391
    • Updated OpenSSL dependency to version 1.0.2d. #398

    Android

    • Removed unused files for building libiconv from Build_android folder.
    • Fixed the NuGet Package issue for Android on VS2015, #400

    iOS

    • Added .gitignore to the Build_iOS folder to ignore the downloaded build dependencies. #373
    Source code(tar.gz)
    Source code(zip)
  • v2.6.0(Nov 20, 2015)

    Release Notes

    streams

    • Deprecated the streambuf::putn API. In some cases with file streams this API makes a copy. To be more efficient and not break existing code a new function putn_nocopy has been created. This makes it clear to users they need to ensure the pointer data provided is valid until the returned task is completed.
    • File streams cleanup improvements: replacing C style casts, updating some shared_ptr parameters to const reference, and removed unnecessary data structures saving heap allocations and space. Fixes #353, #126

    json

    • Added ability to erase elements from a json array or object. #147
    • Added missing static factories for working with 64bit integers to the json::value class. #351
    • Fixed improper serialization of control characters that should always be Unicode escaped.
    • Fixed issue with parsing and then serializing not properly escaping necessary characters if parsed originally from a stream. #259
    • Updated json::value::as_number() and json::value::as_string() to return by const reference.
    • Made json::object copy constructor not private. Also removed a few unnecessary copy constructors and stick with compiler generated.

    http_listener

    • Fixed potential crash on Windows that could occur in some cases if the client sent and invalid URI. #267
    • Fixed potential hang on Windows if running on a single core machine. #106
    • Merged pull request fixing issue with listeners not being properly remove if port is in use on non-Windows. #375

    websocket_client

    • Updated Websocket++ version to 0.5.1.
    • Added tests for Windows Runtime websockets client. #223
    • Removed unnecessary extra event in Windows Runtime implementation from websocket client.

    oauth 2.0

    • Allow conversions for the OAuth 'expires_in' field from a JSON string value to a numeric value. #381

    pplx

    • Merged pull request fixing deadlock if an exception occurs while trying to schedule a task. #379

    miscellaneous

    • Updated some code documentation comments to improve reference documentation.
    • Merged pull request qualifying web::credentials namespace in http_client authentication_tests.cpp to avoid collisions with OpenSSL.
    • Fixed locale based test cases to silently pass if the necessary locale isn't installed on the machine. #354
    • Removed a bunch of unnecessary MSBuild properties from test vcxproj files. #264
    • Changed safeint.hpp to use pragma once instead of ifdef guard.

    Windows

    • Removed DllMain and global process exiting flag as no longer needed.
    • Removed Visual Studio 2012 project files. VS2012 is no longer supported.
    • Added support for Visual Studio 2015 RC, preview is no longer supported.
    • Fixed problem with CasaLens sample not compiling due to std::bind with some versions of Visual Studio 2015.
    • Removed a bunch of Windows specific string conversion code, replaced with C++ standard equivalent.
    • Fixed a potential deadlock on Windows XP when using CPPREST_FORCE_PPLX. #374
    • Updated to Boost version 1.58.
    • Updated to OpenSSL version 1.0.2a.
    • Added support for Universal Windows Platform (UWP).
    • Added support for websockets with Windows Desktop with Visual Studio 2015. #277
    • Merged pull request adding version information to the dlls. #318

    iOS

    • Updated Boost dependency to version 1.57.
    • Improvements to script for building Boost, including no longer building for OS X, adding x86_64 simulator, and always using latest iOS SDK available on the machine. #196
    • Removed dependency on Boost.Locale and libiconv, replaced with C++ standard equivalent.
    • Fixed issue including CMakeLists.txt from another CMake project. #372

    Ubuntu

    • Fixed remaining warnings with GCC and removed warning suppression in CMakeLists.txt. #253
    • Removed dependency on Boost.Locale and libiconv.

    Android

    • Removed dependency on Boost.Locale and libiconv.
    • Added a workaround using -funwind-tables compilation option since not included by default with Visual Studio Android support. #388
    Source code(tar.gz)
    Source code(zip)
  • v2.5.0(Nov 20, 2015)

    Release Notes

    NuGet Packages
    The NuGet packages have been significantly restructured. Instead of having one massive package containing binaries for all the different platforms we support, each individual Visual Studio project file now produces its own package. For example for Windows desktop using the v120 toolset the following package contains everything you need:

    cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn

    Another example, for Windows store applications with the v120 toolset the following package contains everything you need:

    cpprestsdk.v120.winapp.msvcstl.dyn.rt-dyn

    Splitting into smaller package allows users to pick only the binaries that are actually needed saving download time and storage space. As part of this we've stopped stripping symbols so our packages contain full pdbs. If you download the source code from CodePlex you have full source code debugging.

    For backwards compatibility, and ease of use for people who want everything in one download, each individual package is pulled together into an aggregate package containing all the packages as dependencies.

    cpprestsdk

    Please note binaries for Visual Studio 2012 have been removed from the Nuget package. The project files still are in the repository and remaining building. At a future release we will remove the project files as well.

    Android

    • Fixed issue in CMakeLists.txt where parenthesis were incorrectly used instead of brackets.
    • Fixed issue in CMakeLists.txt where pplxlinux.cpp source file was missing.
    • Added Android TestRunner packing androidproj to build.

    Windows

    • Fixed several code analysis warnings.
    • Updating NuGet package for missing OpenSSL license, also patched 2.4.0's NuGet package.
    • Fixed not working on XP issue because of crypto API. #331, #334
    • Fixed several functions missing an explicit calling convention. This caused problems if you changed the calling convention from the cdecl.
    • Added support for Windows on Devices/Galileo. #217
    • Added option to force using PPLX on Windows threadpool instead of PPL on the Concurrency Runtime. Library can be rebuilt using CPPREST_FORCE_PPLX macro. For some scenarios with lots of tasks this can lead to performance improvements and better CPU utilization. With VS2015 PPL tasks run on the Windows threadpool by default. #341
    • Updated all binaries to use whole program optimizations, slightly decreasing binary size and small potential performance improvements.
    • Merged pull request adding support for CMake for Windows desktop.

    OSX

    • Merged a pull request to work around a FindOpenSSL.cmake issue, enabling it to find Homebrew's copy.
    • Added support for iOS 64bit simulator. #196

    websocket_client

    • Fixed a race condition in Websocket++ based implementation during websocket client destructor which would sometimes result in an AV/Segfault.
    • Added proxy support for Websocket++ based implementation.
    • Added support for Server Name Indication (SNI) to Websocket++ based implementation.
    • Updated server certificate verification to accept SERVER_GATED_CRYPTO and SGC_NETSCAPE usage for Websocket++ based implementation on Windows.

    pplx

    • Merged a pull request lazy instantiating the underlying threadpool used. Allows for forking processes in certain circumstances. #68

    http_client

    • Made std::function parameter to http_client::add_handler passed by const reference.
    • Fixed invalid check in WinHTTP based implementation causing autologon security level to be high if credentials are not provided.
    • Added extract_utf8string and extract_utf16string to http_request and http_response classes. This allows uses either UTF-8 or UTF-16, instead of utility::string_t, more efficiently regardless of the platform.
    • Implemented native handle API for non-Windows platforms exposing Boost.Asio structures. This allows for configuring additional options like client certificates for example. #168
    • Fixed bug in Boost.Asio based implementation that incorrectly caused multiple handshakes to occur when reusing connections with HTTPS.
    • Fixed bug incorrectly setting the Content-Length header when not using the "C" locale.

    json

    • Fixed issue where the JSON library assumes char is a signed type, however C++ doesn't guarantee this. On ARM with Clang for example char is an unsigned type. This lead to incorrect parsing.

    miscellaneous

    • Merged pull request adding http_constants.dat to be installed with 'make install'.
    • Deprecated utility function web::http::bind, this was an implementation detail and really never should have been part of the API.
    • Added overloads that accept a std::locale for utility::conversions::print_string and utility::conversions::scan_string.
    • Fixed several locations where a stringstream was being used and assumed the "C" locale was set.
    • Merged pull request fixing bug with nullptr from SafeInt3.hpp with GCC. #340
    • Moved internal safeint types to msl::safeint3 namespace to avoid conflicting with Visual Studio versions. #216

    tests

    • Fixed race conditions in close_callback_client_from_server
    • Added proper synchronization to test_websocket_server (preventing some race conditions). #305
    Source code(tar.gz)
    Source code(zip)
  • v2.4.0(Nov 20, 2015)

    Release Notes

    oauth

    • Fixed memory leak with OAuth 1 in the success case. #321
    • OAuth1 added support for parameters in POST request body if Content-Type is application/x-www-form-urlencoded.
    • OAuth1 fixed some parameters which were incorrectly encoded twice.
    • OAuth1 added support for additional provider parameters on the token.

    websocket_client

    • Added a new websocket_client class, websocket_client_class, that supports using callbacks instead for receiving messages and when the connection is closed. #15
    • Fixed issues around the websocket_client destructor taking the loader lock causing hangs/crashes if dynamically loading/unloading in a dll at runtime on Windows. #309, #233
    • Fixed memory leaks coming from OpenSSL when using secure websocket client.

    http_client

    • Fixed http_client constructor taking parameters by value and performing a lot of moves and sometimes copying again. Now everything cleaner is passed by const reference. In the future if performance critical another overload can be added.
    • Removed unnecessary exception_ptr stored per request on all but WinRT platforms, saving space.
    • Misc cleanup in asio based http_client, renaming classes to not contain 'linux', making more data/methods private, removing some unnecessary usage of shared_ptr parameters and unnecessary indirection.
    • Fixed memory leak in asio based http_client with 'https' requests. #326
    • Fixed race condition in asio based http_client when obtaining a connection from the connection pool. #320
    • Deprecated http_client_config::set_guarantee_order(...) option. It is confusing and simplifies the implementation if removed. If request ordering is a requirement it can always be done manually with task continuations. In the future a better option to expose would be to configure the max number of allowed concurrent connections.
    • Fixed an issue in Boost based http_client where connections that encounter an error were being pooled for reuse. Now all connections that hit any errors are properly shutdown and closed.

    http_listener

    • Updated to Boost based implementation to include underlying Boost error code in exceptions. #224
    • Updated a bunch of parameters in Boost based implementation to pass by const reference instead of by value.
    • Fixed problem in Boost based implementation where if an error occurred while processing the request body then the event from http_request::content_ready() won't be signaled. #220

    uri

    • Fixed issue with uri_builder not including user information when calling to_string() and to_uri(). #329

    json

    • Fixed a small memory leak in locale support for json library.

    miscellaneous

    • Moved all the non public headers under the cpprest include folder into a details subfolder.
    • Removed a bunch of unnecessary pragma warning suppressions. This removes a ton of warnings when using Clang.
    • Renamed a bunch of source files to better reflect their contents. For example http_linux.cpp is now http_client_asio.cpp.
    • Cleaned up and combined the *_compat.h header files into one more manageable file making it easier to share settings.
    • Removed a bunch of unnecessary macros/defines.
    • Public API code documentation improvements for reference docs.
    • Fixed a conversion bug in datetime::utc_now() causing the seconds to be off potentially by 100 nanoseconds.
    • Added /detectleaks option for TestRunner when running on Windows.

    Windows

    • Updated all the solution files to use the VS2013 shared projects feature. With this change all the source code is present in the IDE regardless of the platform. Now it is easier to develop in VS for other platforms as well.
    • Removed the _MS_WINDOWS macro, _WIN32 should be used instead.
    • Updated NuGet package to include CPPREST_TARGET_XP define if targeting XP, otherwise http_client_config size mismatches can occur leading to crashes.
    • Fixed an issue with PHONE8 define causing problems if not defined when targeting Windows Phone 8. The macro has now been removed.
    • We now statically link with OpenSSL on Windows and so our NuGet package no longer has the OpenSSL dependency. This makes deployment easier for customers. #308
    • Worked around a VS2015 compiler devirtualization bug causing AVs, using /d2notypeopt. #314, #315
    • Changed name of powershell VS setup script for VS2015.

    Android

    • Added Android vcxproj files for Visual Studio and included them in the solution files.
    • Fixed incorrect _M_ARM macro check that lead to websockets being excluded on Android.
    • Added support for the Windows x86 emulator. Android NuGet package now contains binaries for it as well.
    • Fixed lots of warning with Clang, turned on treating warnings as errors when building on Windows. #323
    • Added vxproj files for tests and an Android test runner.

    iOS

    • Added a XCode unit test bridge to enable easily running tests for iOS. Can be used from command line with xcodebuild. #105
    Source code(tar.gz)
    Source code(zip)
  • v2.3.0(Nov 20, 2015)

    Release Notes

    Please note this will be the last release that we include binaries for Visual Studio 2012 in our NuGet package.

    http_client

    • Implemented server certificate verification on Android. #242
    • Added usage of Boost ssl::context::default_workarounds for compatibility with somewhat broken servers.
    • Fixed issue with server certification verification if multiple requests are made on iOS, OS X, and Android.
    • Remove unnecessary setting of Content-Length header in HTTP requests to zero.
    • Updated documentation for http_request default constructor and made default to the HTTP GET method to avoid ambiguity. #273
    • For sending request bodies added overloads on Windows for directly working with UTF-8 strings. This saves copies and extra moves on many platforms.
    • Fixed several issues around timeouts and cancellation with the Boost based implementation. Also addressed several places timeouts weren't being handle properly. #280
    • Improved error messages with WinHttp based implementation to include error code and message in the exception what() string.
    • Fixed an issue where a blocking wait was being used to close the response stream and any exceptions coming out of the returned task were not handled.

    websocket_client

    • All of the websocket features have been moved out of the experimental namespace.
    • Implemented 'wss' support for Android/iOS/OSX/Linux/Windows desktop. #255
    • HTTP headers for initial HTTP request can be specified now on the non-winrt implementation as well. #251
    • Added subprotocol API support. New APIs exist on websocket_client_config class. 206
    • Added overloads for websocket_outgoing_msg::set_utf8_message() and websocket_outgoing_msg::set_binary_message() which allows the user to not specify stream length. #152
    • Poco is no longer used as test server for WinRT tests, Websocketpp is used in all cases. #221
    • Improved parameter passing in many locations, adding r-value references for string message data.
    • Improved error messages with both the websocketpp and winrt implementations.
    • Updated websocketpp library to 0.3.0 version.
    • Added a Visual Studio visualizer for websockets. #120
    • Fixed spelling mistake on an API. Renamed websocket_incoming_message::messge_type() to websocket_incoming_message::message_type().
    • Storage improvements on websocket message classes. Saving a heap allocation, a pointer, and a size_t.
    • Fixed connection abort\disconnect issue in winrt implementation. #181

    http_listener

    • Initiating multiple close() calls on an http_listener no longer results in a race condition. Note: ~http_listener does invoke close(), even though the user should close it before destruction. #192

    streams

    • Writing to standard C++ I/O streams with read_to_end() will now throw an exception if it fails. #244
    • Fixed reading files larger than 4GB on Windows, if on 64bit. #161
    • Including the streams.h header file no longer injects a specialization into std::. #125
    • Fixed several places that could cause blocking waits. #135
    • Removed an unnecessary size_t from container buffer, saving space.

    json

    • Adding the ability to perform exception free parsing. All the parsing APIs now take a std::error_code as a second parameter by reference.
    • Fixed issues around JSON library assuming the current local is "C". #118
    • Added overload when constructing json string values to indicate whether or not the string contains any characters that need to be escaped. If the string is known to not contain any characters that need escaping, then the performance is better.
    • Fixed issue with Unicode escaping for code points over 127. #252

    misc

    • The run_tests.sh script has been removed. The tests can be run by invoking the testrunner directly. #182
    • Various reference documentation improvements.
    • Updated .gitignore to account for NuGet packages directory. #282
    • Passwords are now stored in memory encrypted. The API web::credentials::password() has been deprecated.
    • Renamed some folders to use lower case names.

    Windows

    • Added support for Visual Studio 2015 for desktop applications. #278. Please note websockets are not included with Visual Studio 2015 yet.
    • Added support for Windows Phone 8.1 Silverlight. #227
    • Fixed issue with the XP project file not loading correctly in the solution. #262
    • Visual Studio project files have there packages.config separated out, only pulling in the exact NuGet packages necessary for that project now. #285
    • Added OpenSSL as a new dependency on Windows desktop, for secure websockets. Due to the unconditional dependency this causes the OpenSSL dlls by default to be included in the Windows Store app package. There are a variety of ways to temporarily to work around this issue. The vcxproj file can be directly edited to remove importing the OpenSSL targets file. Or the NuGet package can be installed from the using the NuGet package manager console to avoid the dependencies:
    • Install-Package -Id cpprestsdk -IgnoreDependencies

    Android

    • Updated to Android NDK r10.
    • Moved from using gcc to clang.
    • Moved to produce a static library as the default instead of a shared library.
    • Added a NuGet package for cross platform development with Visual Studio 2015, currently only supporting the ARM architecture.

    iOS

    • Updated iOS 8 SDK.
    • Updated iOS build script to use a patch to fix the Boost version used to be 1.56.
    Source code(tar.gz)
    Source code(zip)
  • v2.2.0(Nov 20, 2015)

    Release Notes

    Features

    oAuth (experimental)

    • Added library support for oAuth 2.0 and 1.0 in an experimental namespace while we fine tune the API.

    Android

    • Added support for the Android platform. Please note SSL certification validation for the http_client isn't implemented yet, so using https with the http_client will fail during handshake unless certification validation is disabled. Will be fixed in next release, bug 242. UPDATE: Please note this has been fixed in the development branch now.

    Bug Fixes & Improvements

    Linux

    • Updated to requirements for Boost to version 1.54 and Ubuntu 14.04.

    OS X, iOS

    • Replace internally to use boost locks instead of from standard library due to bug.

    http_client

    • Improve timeouts to be reset and work properly when data is still being written.
    • Added configuration option to buffer request body data on Windows Desktop. This can be helpful for situations where authentication challenges might occur.
    • Improved performance of Windows Desktop client significantly when dealing with HTTP responses if setting the chunksize appropriately.
    • Removed http_response::error_code() API. This was bad API that shouldn't have existed. Error codes are reported through http_exception with a std::error_code.
    • Added option to extract_string and extract_json to force regardless of Content-Type header and treat as UTF-8.
    • Added tcp socket connection pooling on our non-Windows http_client implementation.
    • Implemented http_client cancellation on Linux/iOS/OS X.
    • Implemented SSL server certificate checking for iOS/OS X.

    http_listener

    • Fix a merge error that accidentally removed https support on Windows.
    • Improve close semantics so you no longer have to make sure to respond to all requests and destroy all http_request/http_response instances, bug 205.
    • Fix an issue where an error during processing could cause a hang on iOS/OS X/Linux.

    websocket client

    • Adding support for Windows Phone 8.1.
    • BREAKING API CHANGE - Removed the APIs for sending message fragments, we only support sending full messages.
    • BREAKING API CHANGE - moved specifying the host URI from the constructor to the connect API.

    json

    • Added application/x-json to known MIME types. Bug 197.

    miscellaneous

    • Changes to make work for FreeBSD 10+
    • Added options to cmake for building samples, tests, separately
    • Removed a bunch of unnecessary defines from the Linux/apple/windows compat header files.
    Source code(tar.gz)
    Source code(zip)
  • v2.1.0(Nov 20, 2015)

    Release Notes

    Here is a summary of the changes included in this release:

    Websockets Beta on non-Windows store platforms:
    We now have initial beta implementation of websockets on all platforms: Linux, OS X, iOS, Windows Desktop.
    This library is written on top of Websocketpp, which uses boost. Hence you will need the Boost packages to build the C++ REST SDK on Windows. The "How to setup, build, and run tests on Windows" page describes how to fetch the Boost dependencies.

    Windows Phone 8.1 support:
    Windows Phone 8.1 binaries will be shipped with our NuGet Package.

    Additional features:

    • HTTPS support for http_listener on Windows.
    • Updated the Linux/OS X/iOS binary name to include the versioning.
    • Added XP support for 2013.
    • Additional Websockets features on Windows store: Added support for sending HTTP headers, authentication, proxies.
    • Miscellaneous bug fixes in streams, http_listener and other code cleanup.

    A highlight of this release is it includes community contributions for some Casablanca features. A special thanks to the contributors for helping improve Casablanca for everyone. If you are interested in making contributions, contact us at askcasablanca at Microsoft dot com.

    Going forward, we will be doing all development publicly on CodePlex. This implies:

    • The “development” branch will always be up-to-date with our latest changes.
    • We will actively track the features and bug fixes that we are working on under the CodePlex:Issues section.
    Source code(tar.gz)
    Source code(zip)
  • v2.0.1(Nov 20, 2015)

    Release Notes

    This is a point release that fixes the following customer reported issues:

    • Precision issue with parsing doubles in the JSON library.
    • http_client was not properly detecting the message body length when indicated by closing connection.
    • Query strings were encoded twice at the listener side.
    • Large file size of the CppRest Nuget package.

    Also, please note that we are only distributing Windows binaries through our NuGet package.

    Source code(tar.gz)
    Source code(zip)
  • v2.0.0(Nov 20, 2015)

    Release Notes

    Starting with 2.0.0 we are only distributing Windows binaries through our NuGet package. This allows us to be more efficient and not maintain an MSI. We also feel it gives users a better experience not having to mess with include paths, libs, and dlls.

    Here is a summary of the changes for this release, please note for the first time we made a couple of breaking API changes in our JSON library. We take breaking changes very seriously and believe these are valuable improvements that allow us to continue to expand and improve the API moving forward.

    Misc

    • General bug fixes – including many reported on CodePlex
    • Removed MSIs – now only distributing Windows binaries through NuGet
    • Added Visual Studio debugger natvis file to NuGet package
    • Added support for cmake for non-Windows platforms

    WebSockets

    • Added initial Beta implementation for WebSockets on Windows store, other platforms will come in future releases

    Platform Support

    • Added support for OS X
    • Added support for iOS

    Http Client

    • Added support for request cancellation through cancellation_tokens for Windows platforms, others will be added in the future

    Json

    • Added 64 bit integer support. There is a new class json::number that can be retrieved with the json::value::as_number() API. It contains methods for testing and getting a number as int32, uint32, int64, and uint64.
    • Changed the underlying storage for arrays and added a new class json::array for operations specific to arrays. Can be obtained from the json::value::as_array() API.
    • Changed the underlying storage for objects and added a new class json::object for operations specific to objects. Can be obtained from the json::value::as_object() API.
    • Breaking Change - Changed how iteration over json arrays and objects is performed. No longer is an iterator of std::pair<json::value, json::value> returned. Instead there is a separate iterator for arrays and objects on the json::array and json::object class respectively. This allows us to make performance improvements and continue to adjust accordingly. The array iterator returns json::values, and the object iterator now returns std::pair<string_t, json::value>.
    • 25% to 30% improvement for parsing and traversing the object model
    • Breaking Change - Const overload of index operator[] on json::value – in prior releases the behavior of the const/non-const overloads where different. This is inconsistent and confusing. The operator[] now can always end up modifying the underlying internal storage so is never const. If you want true const semantics, the json::value::at(…) API can be used.
    • Deprecated a couple of inconsistent/confusing or bad performance APIs, all have functional replacements
    • json::value::to_string() – this API really performance serialization and is easy to confuse with json::value::as_string(). The replacement is json::value::serialize().
    • json::value::get(…) – this API had bad performance since it returned a json::value with value semantics. It also can be confusing to use if you think you are modifying the underlying internal data. Instead use operator[] or json::value::at(…).

    Uris

    • Performance improvement avoiding std::isalnum’s global lock
    • Moved URI functionality from web::http namespace to just under web. For backwards compatibility using statements have been inserted for customers directly using from http_client.h.

    Http Listener

    • Breaking Change - Removed pipeline staging feature. It was fundamentally broken and didn’t work at all for processing responses.
    • Fixed issues with the close semantics of shutting down a listener.

    Streams

    • Deprecated ‘blittable’ versions of stream read/write. This API is dangerous and only works for trivial types on single byte character streams. It also has bad performance. The functionality can easily be accomplished with the other read/write overloads or getn/putn directly on the stream buffer.

    VS solution files and samples

    • Cleaned up our solution files and build instructions for all the platforms a bit
    • Made sure project files exist for both Visual Studio 2012 and 2013, when appropriate
    Source code(tar.gz)
    Source code(zip)
  • v1.4.0(Nov 20, 2015)

    Release Notes

    Do you like having to mess with setting up header file includes, library, and dll paths? Consider trying out using our Nuget package instead of our MSI. Whether you target desktop, XP, Windows store, Windows Phone all you have to do is just reference the package and you are ready to go.

    Please note XP and Windows Phone 8 development are only supported with Visual Studio 2012.

    In addition to the regular bug fixing this release includes the following:

    • Json performance improvements, 3x to 4x improvements for parsing, 2x to 3x for serialization. With more improvements coming in future releases.
    • Added line/column information for Json parsing.
    • Added timeout options to http_listener - only implemented on Windows so far.
    • Added XP and Windows Phone 8 support to our Nuget package for VS 2012.
    • Added a new http_listener sample CasaLens.
    • Added project files for samples for VS 2013.
    Source code(tar.gz)
    Source code(zip)
  • v1.3.1(Nov 20, 2015)

    Release Notes

    This is a point release that fixes the following issues with 1.3:

    • Two additional APIs to determine whether a json::value is a integer number or a double number (this fix was requested by a partner team at Microsoft)
    • Fix an issue with Casablanca WinRT binaries that caused them to be rejected by the App Store.
    Source code(tar.gz)
    Source code(zip)
  • v1.3.0(Nov 20, 2015)

    Release Notes

    This release fixes multiple customer reported issues as well as the following:

    • Full support for Dev12 binaries and project files
    • Full support for Windows XP
    • New sample highlighting the Client and Server APIs : BlackJack
    • Expose underlying native handle to set custom options on http_client
    • Improvements to Listener Library

    Note: Dev10 binaries have been dropped as of this release, however the Dev10 project files are still available in the Source Code

    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Nov 20, 2015)

    Release Notes

    The following is a list of the major aspects of this release:

    • Adding support for HTTPS for the Linux version of the library
    • Adding experimental support for Windows XP (client features only)
    • Some performance improvements, especially JSON parsing
    • Added size() and has_size() to stream buffers
    • Side-by-side installation with v1.1
    • As always, bug fixes

    We are labeling this release 'Beta' since there are features that are still experimental, i.e. haven't been tested in depth:

    • Windows Phone 8
    • Windows XP client features
    • http_listener

    Note on Visual Studio 2010 support

    Our plan is to make this the last release that supports Visual Studio 2010. We're planning to add support for Visual Studio 2013 in the next release. However, if VS 2010 is still important to you, let us know: https://casablanca.codeplex.com/discussions

    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(Nov 20, 2015)

Owner
Microsoft
Open source projects and samples from Microsoft
Microsoft
bittyhttp - A threaded HTTP library for building REST services in C.

bittyhttp - A threaded HTTP library for building REST services in C.

Colin Luoma 12 Nov 29, 2021
C++ application development framework, to help developers create and deploy applications quickly and simply

ULib - C++ library Travis CI: Coverity Scan: ULib is a highly optimized class framework for writing C++ applications. I wrote this framework as my too

stefano casazza 950 Jul 27, 2022
Pistache is a modern and elegant HTTP and REST framework for C++

Pistache is a modern and elegant HTTP and REST framework for C++. It is entirely written in pure-C++17* and provides a clear and pleasant API.

null 2.7k Aug 7, 2022
Embeddable Event-based Asynchronous Message/HTTP Server library for C/C++

libasyncd Embeddable Event-based Asynchronous Message/HTTP Server library for C/C++. What is libasyncd? Libasyncd is an embeddable event-driven asynch

Seungyoung 165 May 25, 2022
A high-performance REST Toolkit written in C++

Pistache Pistache is a modern and elegant HTTP and REST framework for C++. It is entirely written in pure-C++14 and provides a clear and pleasant API.

null 2.7k Aug 3, 2022
C++ Parallel Computing and Asynchronous Networking Engine

中文版入口 Sogou C++ Workflow As Sogou`s C++ server engine, Sogou C++ Workflow supports almost all back-end C++ online services of Sogou, including all sea

Sogou-inc 8.9k Aug 8, 2022
Corvusoft's Restbed framework brings asynchronous RESTful functionality to C++14 applications.

Restbed Restbed is a comprehensive and consistent programming model for building applications that require seamless and secure communication over HTTP

Corvusoft 1.7k Aug 6, 2022
This is a proof-of-concept of a modern C web-framework that compiles to WASM and is used for building user interfaces.

DanCing Web ?? ?? (DCW) Getting Started Dancing Web is now distributed with the Tarantella Package Manager — a tool I've made to simplify setup of pro

Danilo Chiarlone 3 Sep 11, 2021
cserv is an event-driven and non-blocking web server

cserv is an event-driven and non-blocking web server. It ideally has one worker process per cpu or processor core, and each one is capable of handling thousands of incoming network connections per worker. There is no need to create new threads or processes for each connection.

null 41 Jul 2, 2022
Embedded C/C++ web server

CivetWeb The official home of CivetWeb is https://github.com/civetweb/civetweb Continuous integration for Linux and macOS (Travis CI): Continuous inte

null 2.1k Jul 30, 2022
Experimental, scalable, high performance HTTP server

Lwan Web Server Lwan is a high-performance & scalable web server. The project web site contains more details. Build status OS Arch Release Debug Stati

Leandro A. F. Pereira 5.6k Aug 3, 2022
A C++11 RESTful web server library

Served Overview Served is a C++ library for building high performance RESTful web servers. Served builds upon Boost.ASIO to provide a simple API for d

Meltwater 692 Jul 24, 2022
A lightweight Bedorck Dedicated Server Plugin Loader

LiteLoader 简体中文 A lightweight Bedorck Dedicated Server Plugin Loader Based on BedrockX Install Download LiteLoader from Releases or Actions, unzip it

null 420 Aug 6, 2022
A http/websocket server framework on linux.

The framework is a Web-Server on unix based system. Without using any third-party libraries, the framework writes from unix system calls and standard C library functions.

xingyuuchen 16 Jun 11, 2022
Tntnet is a web application server for web applications written in C++.

Tntnet is a web application server for web applications written in C++.

Tommi Mäkitalo 71 Jul 28, 2022
a very based, minimal, and flexible static site generator written in pure C89 with no external deps.

based-ssg is a very based, minimal, and flexible static site generator written in pure C89 with no external deps.

null 13 Apr 23, 2022
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.

Cutelyst - The Qt Web Framework A Web Framework built on top of Qt, using the simple and elegant approach of Catalyst (Perl) framework. Qt's meta obje

Cutelyst 779 Jul 30, 2022
Query C++ codebases using SQLite

ClangQL: query C++ codebases using SQLite and clangd What is it? ClangQL is a proof-of-concept SQLite extension for querying C++ codebases that have b

Francesco Bertolaccini 148 Jul 10, 2022