diff --git a/.travis.yml b/.travis.yml index 2048428be..7e6154d4a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,72 +1,139 @@ -sudo: false +# cpp-netlib Project Travis CI configuration. + language: cpp -compiler: -- g++ -- clang -env: -- BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES -- BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES -- BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES -- BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES -- BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES -- BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES -- BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES -- BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES -# Support the sanitizers in clang only -- BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=thread" Uri_BUILD_TEST=OFF Uri_DISABLE_LIBCXX=YES -- BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=address" Uri_BUILD_TEST=OFF Uri_DISABLE_LIBCXX=YES -# TODO(deanberris): It seems Boost is not msan-clean yet; report bugs and maybe fix? -#- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2" +os: linux +dist: trusty +sudo: false + cache: - apt - ccache + +env: + global: + - CCACHE_CPP2=yes + matrix: - exclude: - - compiler: g++ - env: BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=thread" Uri_BUILD_TEST=OFF Uri_DISABLE_LIBCXX=YES - - compiler: g++ - env: BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=address" Uri_BUILD_TEST=OFF Uri_DISABLE_LIBCXX=YES -# TODO(deanberris): It seems Boost is not msan-clean yet; report bugs and maybe fix? -# - compiler: g++ -# env: BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2" + include: + # GCC 4.9 configurations + - env: BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=gcc-4.9 NEWCXX=g++-4.9 + addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["g++-4.9", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=gcc-4.9 NEWCXX=g++-4.9 + addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["g++-4.9", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=gcc-4.9 NEWCXX=g++-4.9 + addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["g++-4.9", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=gcc-4.9 NEWCXX=g++-4.9 + addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["g++-4.9", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=gcc-4.9 NEWCXX=g++-4.9 + addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["g++-4.9", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=gcc-4.9 NEWCXX=g++-4.9 + addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["g++-4.9", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=gcc-4.9 NEWCXX=g++-4.9 + addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["g++-4.9", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=gcc-4.9 NEWCXX=g++-4.9 + addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["g++-4.9", "libboost1.55-all-dev"] } } + # GCC 5.0 configurations + - env: BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=gcc-5 NEWCXX=g++-5 + addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["g++-5", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=gcc-5 NEWCXX=g++-5 + addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["g++-5", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=gcc-5 NEWCXX=g++-5 + addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["g++-5", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=gcc-5 NEWCXX=g++-5 + addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["g++-5", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=gcc-5 NEWCXX=g++-5 + addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["g++-5", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=gcc-5 NEWCXX=g++-5 + addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["g++-5", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=gcc-5 NEWCXX=g++-5 + addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["g++-5", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=gcc-5 NEWCXX=g++-5 + addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["g++-5", "libboost1.55-all-dev"] } } + # Clang 3.8 configurations + - env: BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-3.8 NEWCXX=clang++-3.8 + addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-precise-3.8"], packages: ["clang-3.8", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-3.8 NEWCXX=clang++-3.8 + addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-precise-3.8"], packages: ["clang-3.8", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-3.8 NEWCXX=clang++-3.8 + addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-precise-3.8"], packages: ["clang-3.8", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-3.8 NEWCXX=clang++-3.8 + addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-precise-3.8"], packages: ["clang-3.8", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-3.8 NEWCXX=clang++-3.8 + addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-precise-3.8"], packages: ["clang-3.8", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-3.8 NEWCXX=clang++-3.8 + addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-precise-3.8"], packages: ["clang-3.8", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-3.8 NEWCXX=clang++-3.8 + addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-precise-3.8"], packages: ["clang-3.8", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-3.8 NEWCXX=clang++-3.8 + addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-precise-3.8"], packages: ["clang-3.8", "libboost1.55-all-dev"] } } + # Clang 3.9 configurations + - env: BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-3.9 NEWCXX=clang++-3.9 + addons: { apt: { sources: ["llvm-toolchain-trusty-3.9"], packages: ["clang-3.9", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-3.9 NEWCXX=clang++-3.9 + addons: { apt: { sources: ["llvm-toolchain-trusty-3.9"], packages: ["clang-3.9", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-3.9 NEWCXX=clang++-3.9 + addons: { apt: { sources: ["llvm-toolchain-trusty-3.9"], packages: ["clang-3.9", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-3.9 NEWCXX=clang++-3.9 + addons: { apt: { sources: ["llvm-toolchain-trusty-3.9"], packages: ["clang-3.9", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-3.9 NEWCXX=clang++-3.9 + addons: { apt: { sources: ["llvm-toolchain-trusty-3.9"], packages: ["clang-3.9", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-3.9 NEWCXX=clang++-3.9 + addons: { apt: { sources: ["llvm-toolchain-trusty-3.9"], packages: ["clang-3.9", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-3.9 NEWCXX=clang++-3.9 + addons: { apt: { sources: ["llvm-toolchain-trusty-3.9"], packages: ["clang-3.9", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-3.9 NEWCXX=clang++-3.9 + addons: { apt: { sources: ["llvm-toolchain-trusty-3.9"], packages: ["clang-3.9", "libboost1.55-all-dev"] } } + # Clang 4.0 configurations + - env: BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-4.0 NEWCXX=clang++-4.0 + addons: { apt: { sources: ["llvm-toolchain-trusty-4.0"], packages: ["clang-4.0", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-4.0 NEWCXX=clang++-4.0 + addons: { apt: { sources: ["llvm-toolchain-trusty-4.0"], packages: ["clang-4.0", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-4.0 NEWCXX=clang++-4.0 + addons: { apt: { sources: ["llvm-toolchain-trusty-4.0"], packages: ["clang-4.0", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-4.0 NEWCXX=clang++-4.0 + addons: { apt: { sources: ["llvm-toolchain-trusty-4.0"], packages: ["clang-4.0", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-4.0 NEWCXX=clang++-4.0 + addons: { apt: { sources: ["llvm-toolchain-trusty-4.0"], packages: ["clang-4.0", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-4.0 NEWCXX=clang++-4.0 + addons: { apt: { sources: ["llvm-toolchain-trusty-4.0"], packages: ["clang-4.0", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-4.0 NEWCXX=clang++-4.0 + addons: { apt: { sources: ["llvm-toolchain-trusty-4.0"], packages: ["clang-4.0", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-4.0 NEWCXX=clang++-4.0 + addons: { apt: { sources: ["llvm-toolchain-trusty-4.0"], packages: ["clang-4.0", "libboost1.55-all-dev"] } } + # Clang 5.0 configurations + - env: BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-5.0 NEWCXX=clang++-5.0 + addons: { apt: { sources: ["llvm-toolchain-trusty-5.0"], packages: ["clang-5.0", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-5.0 NEWCXX=clang++-5.0 + addons: { apt: { sources: ["llvm-toolchain-trusty-5.0"], packages: ["clang-5.0", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-5.0 NEWCXX=clang++-5.0 + addons: { apt: { sources: ["llvm-toolchain-trusty-5.0"], packages: ["clang-5.0", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-5.0 NEWCXX=clang++-5.0 + addons: { apt: { sources: ["llvm-toolchain-trusty-5.0"], packages: ["clang-5.0", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-5.0 NEWCXX=clang++-5.0 + addons: { apt: { sources: ["llvm-toolchain-trusty-5.0"], packages: ["clang-5.0", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-5.0 NEWCXX=clang++-5.0 + addons: { apt: { sources: ["llvm-toolchain-trusty-5.0"], packages: ["clang-5.0", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-5.0 NEWCXX=clang++-5.0 + addons: { apt: { sources: ["llvm-toolchain-trusty-5.0"], packages: ["clang-5.0", "libboost1.55-all-dev"] } } + - env: BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" Uri_BUILD_TESTS=OFF Uri_DISABLE_LIBCXX=YES NEWCC=clang-5.0 NEWCXX=clang++-5.0 + addons: { apt: { sources: ["llvm-toolchain-trusty-5.0"], packages: ["clang-5.0", "libboost1.55-all-dev"] } } + install: -- pwd -- export CUR_DIR=`pwd` -- mkdir -p ${CUR_DIR}/bin -- if [ "${CC}" = "gcc" ]; then - export CXX=g++-4.9; - export CC=gcc-4.9; - fi -- if [ "${CC}" = "clang" ]; then - export CXX=clang++-3.8; - export CC=clang-3.8; - export CCACHE_CPP2=yes; - fi -before_script: -- echo ${CXX} -- "${CXX} --version" -- echo ${CC} -- "${CC} --version" + - if [[ "${CXX}" != "" ]]; then export CXX=${NEWCXX}; fi + - if [[ "${CC}" != "" ]]; then export CC=${NEWCC}; fi + - "${CXX} --version" + - "${CC} --version" + - pwd + - export CUR_DIR=`pwd` + - mkdir -p ${CUR_DIR}/bin + script: -- pwd -- sh -x build.sh + - pwd + - sh -x build.sh + after_failure: -- cat build/Testing/Temporary/LastTest.log -addons: - apt: - sources: - - ubuntu-toolchain-r-test - - llvm-toolchain-precise-3.8 - - kalakris-cmake - - boost-latest - - george-edison55-precise-backports - packages: - - libboost1.55-all-dev - - gcc-4.9 - - g++-4.9 - - clang-3.8 - - cmake - - cmake-data + - cat build/Testing/Temporary/LastTest.log + notifications: slack: secure: Y7lLjqZ83+b/jaJ5+EKwvgCDeERi4bVbDn9tLp8sieTdu+ENsPI+JmLYSXZXPpe7JrItrXW6uJJXN2wG1h7au4mpVVTghd31HBzuzrqVxDphWPhp16NYzvbAgQQRBXvFVvfSdW/Kb/n2fX6xDApY0t6vNREb/GKg0GyzESb4ZjU= diff --git a/CMakeLists.txt b/CMakeLists.txt index 56534f32f..5946295ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,7 +69,11 @@ if (CPP-NETLIB_ENABLE_HTTPS) endif() endif() if (CPP-NETLIB_STATIC_OPENSSL) - set(CMAKE_FIND_LIBRARY_SUFFIXES .a) + if (WIN32) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib) + else() + set(CMAKE_FIND_LIBRARY_SUFFIXES .a) + endif() endif() find_package(OpenSSL) endif() diff --git a/code_of_conduct.md b/CODE_OF_CONDUCT.md similarity index 100% rename from code_of_conduct.md rename to CODE_OF_CONDUCT.md diff --git a/README.rst b/README.rst index 5d351980b..4a19a91d5 100644 --- a/README.rst +++ b/README.rst @@ -81,6 +81,19 @@ you can now build the tests and run them:: $ make $ make test +You can also download and install cpp-netlib using the ` vcpkg`_ dependency manager: + + $ git clone https://github.com/Microsoft/vcpkg.git + $ cd vcpkg + $ ./bootstrap-vcpkg.sh + $ ./vcpkg integrate install + $ vcpkg install cpp-netlib + +The cpp-netlib port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the ` vcpkg`_ repository. + +.. _`vcpkg`: https://github.com/Microsoft/vcpkg + + If for some reason some of the tests fail, you can send the files in ``Testing/Temporary/`` as attachments to the cpp-netlib `developers mailing list`_. diff --git a/boost/network/message/directives/detail/string_directive.hpp b/boost/network/message/directives/detail/string_directive.hpp index db07eceb4..3c1e652db 100644 --- a/boost/network/message/directives/detail/string_directive.hpp +++ b/boost/network/message/directives/detail/string_directive.hpp @@ -34,8 +34,8 @@ #define BOOST_NETWORK_STRING_DIRECTIVE(name, value, body, pod_body) \ template \ struct name##_directive { \ - ValueType const&((value)); \ - explicit name##_directive(ValueType const& value_) : value(value_) {} \ + ValueType const& value; \ + explicit name##_directive(ValueType const& v) : value(v) {} \ name##_directive(name##_directive const& other) : value(other.value) {} \ template class Message> \ typename enable_if, void>::type operator()( \ diff --git a/boost/network/protocol/http/client/options.hpp b/boost/network/protocol/http/client/options.hpp index e73567099..bcc266789 100644 --- a/boost/network/protocol/http/client/options.hpp +++ b/boost/network/protocol/http/client/options.hpp @@ -35,7 +35,7 @@ class client_options { io_service_(), always_verify_peer_(true), timeout_(0), - remove_chunk_markers_(false) {} + remove_chunk_markers_(true) {} client_options(client_options const& other) : cache_resolved_(other.cache_resolved_), @@ -50,7 +50,7 @@ class client_options { io_service_(other.io_service_), always_verify_peer_(other.always_verify_peer_), timeout_(other.timeout_), - remove_chunk_markers_(other.remove_chunk_markers) {} + remove_chunk_markers_(other.remove_chunk_markers_) {} client_options& operator=(client_options other) { other.swap(*this); @@ -157,7 +157,7 @@ class client_options { return *this; } - /// Set an overall timeout for HTTP requests. + /// Set whether we process chunked-encoded streams. client_options& remove_chunk_markers(bool v) { remove_chunk_markers_ = v; return *this; diff --git a/boost/network/protocol/http/policies/async_resolver.hpp b/boost/network/protocol/http/policies/async_resolver.hpp index c03cd5a36..4e508364a 100644 --- a/boost/network/protocol/http/policies/async_resolver.hpp +++ b/boost/network/protocol/http/policies/async_resolver.hpp @@ -36,18 +36,21 @@ struct async_resolver : std::enable_shared_from_this > { typedef std::function resolve_function; + void clear_resolved_cache() { clear_cache_.store(true); } + protected: bool cache_resolved_; + std::atomic clear_cache_; endpoint_cache endpoint_cache_; std::shared_ptr service_; std::shared_ptr resolver_strand_; explicit async_resolver(bool cache_resolved) - : cache_resolved_(cache_resolved), endpoint_cache_() {} + : cache_resolved_(cache_resolved), clear_cache_(false), endpoint_cache_() {} void resolve(resolver_type &resolver_, string_type const &host, std::uint16_t port, resolve_completion_function once_resolved) { - if (cache_resolved_) { + if (cache_resolved_ && !clear_cache_.load()) { typename endpoint_cache::iterator iter = endpoint_cache_.find(boost::to_lower_copy(host)); if (iter != endpoint_cache_.end()) { @@ -74,6 +77,9 @@ struct async_resolver : std::enable_shared_from_this > { typename endpoint_cache::iterator iter; bool inserted = false; if (!ec && cache_resolved_) { + if (clear_cache_.exchange(false)) { + endpoint_cache_.clear(); + } std::tie(iter, inserted) = endpoint_cache_.insert(std::make_pair( host, std::make_pair(endpoint_iterator, resolver_iterator()))); once_resolved(ec, iter->second); diff --git a/boost/network/protocol/http/policies/sync_resolver.hpp b/boost/network/protocol/http/policies/sync_resolver.hpp index 7c9c2c7f4..09d373b87 100644 --- a/boost/network/protocol/http/policies/sync_resolver.hpp +++ b/boost/network/protocol/http/policies/sync_resolver.hpp @@ -27,19 +27,26 @@ struct sync_resolver { typedef std::pair resolver_iterator_pair; + void clear_resolved_cache() { clear_cache_.store(true); } + protected: typedef typename string::type string_type; typedef std::unordered_map resolved_cache; resolved_cache endpoint_cache_; bool cache_resolved_; + std::atomic clear_cache_; - explicit sync_resolver(bool cache_resolved) : cache_resolved_(cache_resolved) {} + explicit sync_resolver(bool cache_resolved) + : cache_resolved_(cache_resolved), clear_cache_(false) {} resolver_iterator_pair resolve(resolver_type& resolver_, string_type /*unused*/const& hostname, string_type const& port) { if (cache_resolved_) { + if (clear_cache_.exchange(false)) { + endpoint_cache_.clear(); + } typename resolved_cache::iterator cached_iterator = endpoint_cache_.find(hostname); if (cached_iterator == endpoint_cache_.end()) { diff --git a/boost/network/protocol/stream_handler.hpp b/boost/network/protocol/stream_handler.hpp index 62c97ec4a..cd98b6875 100644 --- a/boost/network/protocol/stream_handler.hpp +++ b/boost/network/protocol/stream_handler.hpp @@ -13,12 +13,12 @@ #include #include #include +#include #include #include #include #include #include -#include #include #ifdef BOOST_NETWORK_ENABLE_HTTPS diff --git a/deps/asio b/deps/asio index 66e76b9e4..22afb8608 160000 --- a/deps/asio +++ b/deps/asio @@ -1 +1 @@ -Subproject commit 66e76b9e4252ff4681227d0d8e34374ec1fa20e5 +Subproject commit 22afb86087a77037cd296d27134756c9b0d2cb75 diff --git a/deps/cxxopts b/deps/cxxopts index aec97a6f5..3d405ef16 160000 --- a/deps/cxxopts +++ b/deps/cxxopts @@ -1 +1 @@ -Subproject commit aec97a6f53c3486fc51e0d9857f10b683180d668 +Subproject commit 3d405ef1639a918ea8798666e2b02eb9cef889c0 diff --git a/deps/googletest b/deps/googletest index d225acc90..3880b13e4 160000 --- a/deps/googletest +++ b/deps/googletest @@ -1 +1 @@ -Subproject commit d225acc90bc3a8c420a9bcd1f033033c1ccd7fe0 +Subproject commit 3880b13e4c0b04ca88f69b9c93da6058bd836c34 diff --git a/deps/uri b/deps/uri index c16a46ecb..76f0781f4 160000 --- a/deps/uri +++ b/deps/uri @@ -1 +1 @@ -Subproject commit c16a46ecb6bf0c936179e324891a74b5e6d8f4d3 +Subproject commit 76f0781f45d9a79c2a2bde9cabe76368cc6892c1 diff --git a/libs/network/doc/_ext/breathe b/libs/network/doc/_ext/breathe index 853385ef4..1767274e0 160000 --- a/libs/network/doc/_ext/breathe +++ b/libs/network/doc/_ext/breathe @@ -1 +1 @@ -Subproject commit 853385ef4f0c3dd126887750e20d5f7456065998 +Subproject commit 1767274e0f59eb707f2b6256d51b12a3a4341da8 diff --git a/libs/network/example/CMakeLists.txt b/libs/network/example/CMakeLists.txt index 0031f3a53..e647a8e69 100644 --- a/libs/network/example/CMakeLists.txt +++ b/libs/network/example/CMakeLists.txt @@ -5,6 +5,7 @@ include_directories(${CPP-NETLIB_SOURCE_DIR}) include_directories(${CPP-NETLIB_SOURCE_DIR}/deps/cxxopts/src) +include_directories(${CPP-NETLIB_SOURCE_DIR}/deps/cxxopts/include) if (OPENSSL_FOUND) include_directories(${OPENSSL_INCLUDE_DIR}) endif (OPENSSL_FOUND) diff --git a/libs/network/example/http/echo_async_server.cpp b/libs/network/example/http/echo_async_server.cpp new file mode 100644 index 000000000..c017a32b6 --- /dev/null +++ b/libs/network/example/http/echo_async_server.cpp @@ -0,0 +1,247 @@ +// Copyright 2018 Martin Trenkmann +// Based on cpp-netlib/libs/network/example/http/fileserver.cpp +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// This example implements a minimal echo server that receives plain text via +// POST requests and sends the same text back to the client (with an additional +// newline appended for nicer output). Since the server uses asynchronous I/O, +// the body data is not available through request.body, but must be read using +// connection->read(callback). +// +// This code is minimal, it does not... +// - handle any kinds of errors, +// - look at the URI path (request.destination), +// - handle request methods other than POST (request.method), +// - check for too large bodies (which make the server vulnerable to attacks), +// - model state, e.g. database connections (this type of context should be +// injected into the post_request_handler constructor). +// +// About handling large body data: +// According to https://tools.ietf.org/html/rfc2616#section-8.2.3, HTTP clients +// may send a "Expect: 100-continue" header before sending large body data in +// order to negotiate whether the server is willing to accept the data. If the +// server agrees, it should send an interim response with a "100 Continue" +// status code. The client then should start sending the data and upon +// completion, the server should send a final response including a status code +// and possibly headers and body data. +// +// About cpp-netlib 0.13 and the "Expect: 100-continue" header: +// When a client sends a POST request with a "Expect: 100-continue" header, the +// callback passed into connection->read() gets triggered with an empty chunk of +// data. As described before, the server should then send an "100 Continue" +// interim response, but this seems to be not supported by the library at the +// moment, because trying to set and send a status code on the connection object +// more than once throws an exception. However, since clients are allowed to +// send data even though they never received a "100 Continue", the server should +// continue reading data from the connection, by calling connection->read() +// again, until the expected number of bytes, based on the "Content-Length" +// header, has been received. +// +// About curl and the "Expect: 100-continue" header: +// According to https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expect +// no common browsers make use of the "Expect" header, but some other clients +// such as curl do so by default. In fact, curl sends a "Expect: 100-continue" +// header with POST requests that contain at least 1KiB of data (see example +// session below). Fortunately, curl also starts sending the data if it does +// not receive a "100 Continue" status code after a timeout of 1 second, which +// makes it "compatible" with servers that cannot send interim responses such as +// cpp-netlib 0.13. +// +// The timeout in curl is configurable via "--expect100-timeout " +// command line argument. The minimum value seems to be 1 second. +// +// Example session: +// Two POST requests are sent to the echo server using curl. The first one with +// data less than 1KiB, the second one with data more than 1KiB which shows the +// use of the "Expect: 100-continue" header. +// +// The "lorem" command generates lorem ipsum text. It can be installed via +// "sudo apt-get install libtext-lorem-perl" on Debian-based systems. +// +// 1. Sending less than 1KiB +// ------------------------- +// +// $ curl -v -H 'Content-Type: text/plain' -d "$(lorem -s 3 | fold)" http://localhost:8000 +// * Rebuilt URL to: http://localhost:8000/ +// * Trying 127.0.0.1... +// * Connected to localhost (127.0.0.1) port 8000 (#0) +// > POST / HTTP/1.1 +// > Host: localhost:8000 +// > User-Agent: curl/7.47.0 +// > Accept: */* +// > Content-Type: text/plain +// > Content-Length: 155 +// > +// * upload completely sent off: 155 out of 155 bytes +// < HTTP/1.1 200 OK +// < Content-Type: text/plain +// < Content-Length: 156 +// < +// Iusto autem omnis necessitatibus quia omnis nemo sequi. Occaecati est explicabo +// qui placeat ipsa debitis fugit sit. Quasi sequi in est eius qui molestiae. +// * Connection #0 to host localhost left intact +// +// SERVER OUTPUT +// +// Host: localhost:8000 +// User-Agent: curl/7.47.0 +// Accept: */* +// Content-Type: text/plain +// Content-Length: 155 +// Chunk size: 155 +// +// 2. Sending more than 1KiB +// ------------------------- +// +// $ curl -v -H 'Content-Type: text/plain' -d "$(lorem -s 30 | fold)" http://localhost:8000 +// * Rebuilt URL to: http://localhost:8000/ +// * Trying 127.0.0.1... +// * Connected to localhost (127.0.0.1) port 8000 (#0) +// > POST / HTTP/1.1 +// > Host: localhost:8000 +// > User-Agent: curl/7.47.0 +// > Accept: */* +// > Content-Type: text/plain +// > Content-Length: 1324 +// > Expect: 100-continue +// > +// * Done waiting for 100-continue +// * We are completely uploaded and fine +// < HTTP/1.1 200 OK +// < Content-Type: text/plain +// < Content-Length: 1325 +// < +// Fugit quo aliquid in et consectetur sed id. Aliquam dolor optio labore sit autem +// . Culpa at omnis et consectetur minima nostrum sed. Veniam similique dolorum des +// erunt aut et et aut quo. Laudantium nesciunt est repellat. Dolores adipisci alia +// s dicta dicta. Impedit porro pariatur quisquam sit ex ducimus a. Consequatur ius +// to possimus in sint nesciunt molestiae fugiat et. Est praesentium quos quam libe +// ro vel nostrum placeat consequuntur. Tempora nihil aut aliquam. Atque ab sunt ut +// sed quo ut. Quia qui omnis non. In laboriosam possimus laboriosam consequatur v +// el dolores. Reprehenderit totam quis dolore debitis ullam. Aut iure omnis invent +// ore quaerat aut veniam vel magni. Temporibus voluptatibus accusamus qui facilis +// at aut. Voluptatem provident incidunt officia. Quos quo autem quae illo. Modi am +// et quis eveniet. Nemo tenetur quia unde. Velit molestiae laborum eum. Repellat m +// olestias eos eos accusantium dolorem molestias pariatur ex. Nihil dolorum possim +// us ut ut beatae. Quia nam sit aut voluptatum maiores quibusdam id aliquid. Nulla +// numquam rem quo doloremque ut ut. Aspernatur accusamus illo illo dolores repudi +// andae dicta reiciendis. Quis laborum magni et incidunt nihil. Ea quia consequunt +// ur quos minima aut veniam ratione sed. Ea deleniti accusamus est quo nisi. Quia +// quibusdam et aut reiciendis. +// * Connection #0 to host localhost left intact +// +// SERVER OUTPUT +// +// Host: localhost:8000 +// User-Agent: curl/7.47.0 +// Accept: */* +// Content-Type: text/plain +// Content-Length: 1324 +// Expect: 100-continue +// Chunk size: 0 +// Chunk size: 1024 +// Chunk size: 300 + +#include +#include +#include +#include +#include +#include + +namespace http = boost::network::http; + +struct request_handler; +using echo_server = http::server; + +struct post_request_handler + : public std::enable_shared_from_this { + explicit post_request_handler(const echo_server::request& request) + : content_length_(0) { + for (const auto& header : request.headers) { + std::cout << header.name << ": " << header.value << '\n'; + if (boost::iequals(header.name, "content-length")) { + content_length_ = std::stoul(header.value); + } + } + } + + void operator()(echo_server::connection::input_range chunk, + boost::system::error_code ec, size_t chunk_size, + echo_server::connection_ptr connection) { + assert(chunk.size() == chunk_size); + std::cout << "Chunk size: " << chunk_size << '\n'; + + if (ec) { + std::cerr << "Error code: " << ec << '\n'; + return; + } + + body_.append(chunk.begin(), chunk.end()); + if (body_.size() < content_length_) { + auto self = this->shared_from_this(); + connection->read([self](echo_server::connection::input_range chunk, + boost::system::error_code ec, size_t chunk_size, + echo_server::connection_ptr connection) { + (*self)(chunk, ec, chunk_size, connection); + }); + return; + } + + body_.push_back('\n'); + std::vector headers; + headers.push_back({"Content-Type", "text/plain"}); + headers.push_back({"Content-Length", std::to_string(body_.size())}); + connection->set_status(echo_server::connection::ok); + connection->set_headers(headers); + connection->write(body_); + } + + private: + size_t content_length_; + std::string body_; +}; + +struct request_handler { + void operator()(const echo_server::request& request, + echo_server::connection_ptr connection) { + if (request.method == "POST") { + auto h = std::make_shared(request); + connection->read([h](echo_server::connection::input_range chunk, + boost::system::error_code ec, size_t chunk_size, + echo_server::connection_ptr connection) { + (*h)(chunk, ec, chunk_size, connection); + }); + } + } +}; + +int main() { + try { + request_handler handler; + auto io_service = std::make_shared(); + echo_server server( + echo_server::options(handler).io_service(io_service).port("8000")); + + // Clean shutdown when pressing Ctrl+C. + boost::asio::signal_set signals(*io_service, SIGINT, SIGTERM); + signals.async_wait([&server](const boost::system::error_code& ec, + int /* signal_number */) { + if (!ec) { + std::cout << "Stopping server... "; + server.stop(); + std::cout << "done.\n"; + } + }); + + std::cout << "Press Ctrl+C to stop the server.\n"; + server.run(); + + return EXIT_SUCCESS; + } catch (const std::exception& error) { + std::cerr << error.what() << std::endl; + return EXIT_FAILURE; + } +} diff --git a/libs/network/example/http_client.cpp b/libs/network/example/http_client.cpp index 439176192..1a717805c 100644 --- a/libs/network/example/http_client.cpp +++ b/libs/network/example/http_client.cpp @@ -29,22 +29,22 @@ int main(int argc, char* argv[]) { ; options.parse_positional(std::vector{"source"}); - options.parse(argc, argv); + auto optionsResults = options.parse(argc, argv); - if (options.count("help")) { + if (optionsResults.count("help")) { std::cout << options.help({"", "Group"}) << std::endl; return EXIT_SUCCESS; } - if (options.count("source") < 1) { + if (optionsResults.count("source") < 1) { std::cout << "Error: Source URL required." << std::endl; std::cout << options.help({"", "Group"}) << std::endl; return EXIT_FAILURE; } - std::string source = options["source"].as(); - bool show_headers = options.count("headers") ? true : false; - bool show_status = options.count("status") ? true : false; + std::string source = optionsResults["source"].as(); + bool show_headers = optionsResults.count("headers") ? true : false; + bool show_status = optionsResults.count("status") ? true : false; http::client::request request(source); http::client::string_type destination_ = host(request); diff --git a/libs/network/src/server_request_parsers_impl.cpp b/libs/network/src/server_request_parsers_impl.cpp index 9a539b1ae..d3670e924 100644 --- a/libs/network/src/server_request_parsers_impl.cpp +++ b/libs/network/src/server_request_parsers_impl.cpp @@ -12,6 +12,7 @@ #include #include #include +#include namespace boost { namespace spirit { @@ -22,7 +23,7 @@ typedef std::basic_string u32_string; template <> // struct assign_to_container_from_value { static void call(u32_string const& val, std::string& attr) { - u32_to_u8_iterator begin = val.begin(), + boost::u32_to_u8_iterator begin = val.begin(), end = val.end(); for (; begin != end; ++begin) attr += *begin; } diff --git a/libs/network/test/http/client_get_streaming_test.cpp b/libs/network/test/http/client_get_streaming_test.cpp index ae08f26e0..f08d24a6a 100644 --- a/libs/network/test/http/client_get_streaming_test.cpp +++ b/libs/network/test/http/client_get_streaming_test.cpp @@ -25,8 +25,9 @@ struct body_handler { TYPED_TEST_CASE(HTTPClientTest, ClientTypes); +#ifdef BOOST_NETWORK_ENABLE_HTTPS TYPED_TEST(HTTPClientTest, GetStreamingTest) { - typename TypeParam::request request("http://www.boost.org/"); + typename TypeParam::request request("https://www.boost.org/"); typename TypeParam::response response; typename TypeParam::string_type body_string; typename TypeParam::string_type dummy_body; @@ -47,3 +48,4 @@ TYPED_TEST(HTTPClientTest, GetStreamingTest) { } EXPECT_EQ(dummy_body, typename TypeParam::string_type()); } +#endif