From 71049094cbdd5c9dc13eb121f89a6f760d790de0 Mon Sep 17 00:00:00 2001 From: Mohammad Nejati Date: Sat, 5 Jul 2025 15:35:04 +0000 Subject: [PATCH] Update examples --- .drone.star | 7 +- .drone/drone.bat | 7 +- .drone/drone.sh | 20 +++- .github/workflows/ci.yml | 164 +++++++++++++++------------- cmake/config.cmake.in | 10 -- example/client/burl/CMakeLists.txt | 15 ++- example/client/burl/Jamfile | 6 +- example/client/burl/connect.cpp | 10 +- example/client/burl/connect.hpp | 6 +- example/client/burl/main.cpp | 83 ++++++++++---- example/client/visit/CMakeLists.txt | 16 +-- example/client/visit/Jamfile | 12 +- example/client/visit/main.cpp | 6 +- example/server/CMakeLists.txt | 3 +- example/server/Jamfile | 16 +-- example/server/acceptor.hpp | 8 +- example/server/main.cpp | 10 +- test/cmake_test/CMakeLists.txt | 21 ++-- test/unit/Jamfile | 1 - 19 files changed, 229 insertions(+), 192 deletions(-) delete mode 100644 cmake/config.cmake.in diff --git a/.drone.star b/.drone.star index 77e832a..cae42f5 100644 --- a/.drone.star +++ b/.drone.star @@ -15,7 +15,7 @@ def main(ctx): # Compilers [ 'gcc >=5.0', - 'clang >=3.8', + 'clang >=3.9', 'msvc >=14.1', 'arm64-gcc latest', 's390x-gcc latest', @@ -23,11 +23,12 @@ def main(ctx): 'apple-clang *', 'arm64-clang latest', 's390x-clang latest', - # 'x86-msvc latest' + 'freebsd-clang latest', + 'x86-msvc latest' ], # Standards '>=11', - packages=['zlib1g', 'zlib1g-dev']) + packages=['zlib1g', 'zlib1g-dev', 'libbrotli-dev']) # from https://github.com/cppalliance/ci-automation load("@ci_automation//ci/drone/:functions.star", "linux_cxx", "windows_cxx", "osx_cxx", "freebsd_cxx", "generate") diff --git a/.drone/drone.bat b/.drone/drone.bat index 8d59735..e1981da 100644 --- a/.drone/drone.bat +++ b/.drone/drone.bat @@ -41,10 +41,13 @@ set ZLIB_SOURCE=!BOOST_ROOT!\zlib-src REM Customizations cd pushd !BOOST_ROOT!\libs -git clone https://github.com/CPPAlliance/buffers -b !BOOST_BRANCH! --depth 1 +git clone https://github.com/cppalliance/buffers -b !BOOST_BRANCH! --depth 1 popd pushd !BOOST_ROOT!\libs -git clone https://github.com/CPPAlliance/http_proto -b !BOOST_BRANCH! --depth 1 +git clone https://github.com/cppalliance/rts -b !BOOST_BRANCH! --depth 1 +popd +pushd !BOOST_ROOT!\libs +git clone https://github.com/cppalliance/http_proto -b !BOOST_BRANCH! --depth 1 popd echo '==================================> COMPILE' diff --git a/.drone/drone.sh b/.drone/drone.sh index f1e01ad..2fa39da 100644 --- a/.drone/drone.sh +++ b/.drone/drone.sh @@ -37,13 +37,19 @@ common_install () { if [ ! -d "$BOOST_ROOT/libs/buffers" ]; then pushd $BOOST_ROOT/libs - git clone https://github.com/CPPAlliance/buffers -b $BOOST_BRANCH --depth 1 + git clone https://github.com/cppalliance/buffers -b $BOOST_BRANCH --depth 1 + popd + fi + + if [ ! -d "$BOOST_ROOT/libs/rts" ]; then + pushd $BOOST_ROOT/libs + git clone https://github.com/cppalliance/rts -b $BOOST_BRANCH --depth 1 popd fi if [ ! -d "$BOOST_ROOT/libs/http_proto" ]; then pushd $BOOST_ROOT/libs - git clone https://github.com/CPPAlliance/http_proto -b $BOOST_BRANCH --depth 1 + git clone https://github.com/cppalliance/http_proto -b $BOOST_BRANCH --depth 1 popd fi } @@ -123,13 +129,19 @@ git submodule update --init --recursive # Customizations if [ ! -d "$BOOST_ROOT/libs/buffers" ]; then pushd $BOOST_ROOT/libs - git clone https://github.com/CPPAlliance/buffers -b $BOOST_BRANCH --depth 1 + git clone https://github.com/cppalliance/buffers -b $BOOST_BRANCH --depth 1 + popd +fi + +if [ ! -d "$BOOST_ROOT/libs/rts" ]; then + pushd $BOOST_ROOT/libs + git clone https://github.com/cppalliance/rts -b $BOOST_BRANCH --depth 1 popd fi if [ ! -d "$BOOST_ROOT/libs/http_proto" ]; then pushd $BOOST_ROOT/libs - git clone https://github.com/CPPAlliance/http_proto -b $BOOST_BRANCH --depth 1 + git clone https://github.com/cppalliance/http_proto -b $BOOST_BRANCH --depth 1 popd fi diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 55b814e..c968bfd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,14 +61,14 @@ jobs: # - compiler: "msvc" - version: "14.34" + version: "14.42" cxxstd: "17,20" latest-cxxstd: "20" runs-on: "windows-2022" - b2-toolset: "msvc-14.3" + b2-toolset: "msvc-14.4" generator: "Visual Studio 17 2022" is-latest: true - name: "MSVC 14.34: C++17-20" + name: "MSVC 14.42: C++17-20" build-type: "Release" build-cmake: true @@ -80,10 +80,9 @@ jobs: b2-toolset: "msvc-14.3" generator: "Visual Studio 17 2022" is-latest: true - name: "MSVC 14.34: C++17-20 (no zlib)" + name: "MSVC 14.34: C++17-20" build-type: "Release" build-cmake: true - skip-zlib: true - compiler: "msvc" version: "14.34" @@ -110,17 +109,6 @@ jobs: build-type: "Release" build-cmake: true - - compiler: "msvc" - version: "14.29" - cxxstd: "14,17" - latest-cxxstd: "17" - runs-on: "windows-2019" - b2-toolset: "msvc-14.2" - generator: "Visual Studio 16 2019" - is-earliest: true - name: "MSVC 14.29: C++14-17" - build-type: "Release" - - compiler: "clang-cl" version: "*" cxx: "clang++-cl" @@ -232,7 +220,7 @@ jobs: is-latest: true name: "GCC 14: C++17-20" build-type: "Release" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" build-cmake: true - compiler: "gcc" @@ -262,7 +250,7 @@ jobs: name: "GCC 14: C++17-20 (x86)" x86: true build-type: "Release" - install: "gcc-14-multilib g++-14-multilib zlib1g-dev zlib1g-dev:i386" + install: "gcc-14-multilib g++-14-multilib zlib1g-dev libbrotli-dev zlib1g-dev:i386 libbrotli-dev:i386" - compiler: "gcc" version: "14" @@ -277,7 +265,7 @@ jobs: name: "GCC 14: C++17-20 (shared)" shared: true build-type: "Release" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" build-cmake: true - compiler: "gcc" @@ -294,7 +282,7 @@ jobs: shared: true x86: true build-type: "Release" - install: "gcc-14-multilib g++-14-multilib zlib1g-dev zlib1g-dev:i386" + install: "gcc-14-multilib g++-14-multilib zlib1g-dev libbrotli-dev zlib1g-dev:i386 libbrotli-dev:i386" build-cmake: true - compiler: "gcc" @@ -310,7 +298,7 @@ jobs: name: "GCC 14: C++17-20 (asan)" asan: true build-type: "RelWithDebInfo" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" - compiler: "gcc" version: "14" @@ -326,7 +314,7 @@ jobs: asan: true x86: true build-type: "RelWithDebInfo" - install: "gcc-14-multilib g++-14-multilib zlib1g-dev zlib1g-dev:i386" + install: "gcc-14-multilib g++-14-multilib zlib1g-dev libbrotli-dev zlib1g-dev:i386 libbrotli-dev:i386" - compiler: "gcc" version: "14" @@ -341,7 +329,7 @@ jobs: name: "GCC 14: C++17-20 (ubsan)" ubsan: true build-type: "RelWithDebInfo" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" - compiler: "gcc" version: "14" @@ -357,7 +345,7 @@ jobs: ubsan: true x86: true build-type: "RelWithDebInfo" - install: "gcc-14-multilib g++-14-multilib zlib1g-dev zlib1g-dev:i386" + install: "gcc-14-multilib g++-14-multilib zlib1g-dev libbrotli-dev zlib1g-dev:i386 libbrotli-dev:i386" - compiler: "gcc" version: "13" @@ -369,7 +357,7 @@ jobs: b2-toolset: "gcc" name: "GCC 13: C++17-20" build-type: "Release" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" - compiler: "gcc" version: "13" @@ -385,7 +373,7 @@ jobs: build-type: "Debug" cxxflags: "--coverage -fprofile-arcs -ftest-coverage" ccflags: "--coverage -fprofile-arcs -ftest-coverage" - install: "lcov zlib1g-dev wget unzip" + install: "lcov zlib1g-dev libbrotli-dev wget unzip" - compiler: "gcc" version: "12" @@ -398,7 +386,7 @@ jobs: b2-toolset: "gcc" name: "GCC 12: C++17-20" build-type: "Release" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" - compiler: "gcc" version: "11" @@ -411,7 +399,7 @@ jobs: b2-toolset: "gcc" name: "GCC 11: C++17-20" build-type: "Release" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" - compiler: "gcc" version: "10" @@ -424,7 +412,7 @@ jobs: b2-toolset: "gcc" name: "GCC 10: C++14-17" build-type: "Release" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" - compiler: "gcc" version: "9" @@ -437,7 +425,7 @@ jobs: b2-toolset: "gcc" name: "GCC 9: C++14-17" build-type: "Release" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" - compiler: "gcc" version: "8" @@ -450,7 +438,7 @@ jobs: b2-toolset: "gcc" name: "GCC 8: C++14-17" build-type: "Release" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" - compiler: "gcc" version: "7" @@ -463,7 +451,7 @@ jobs: b2-toolset: "gcc" name: "GCC 7: C++14-17" build-type: "Release" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" - compiler: "gcc" version: "6" @@ -476,7 +464,7 @@ jobs: b2-toolset: "gcc" name: "GCC 6: C++11-14" build-type: "Release" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" - compiler: "gcc" version: "5" @@ -490,7 +478,7 @@ jobs: is-earliest: true name: "GCC 5: C++11" build-type: "Release" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" - compiler: "clang" version: "18" @@ -504,7 +492,7 @@ jobs: is-latest: true name: "Clang 18: C++17-20" build-type: "Release" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" build-cmake: true - compiler: "clang" @@ -520,7 +508,7 @@ jobs: name: "Clang 18: C++17-20 (x86)" x86: true build-type: "Release" - install: "gcc-multilib g++-multilib zlib1g-dev zlib1g-dev:i386" + install: "gcc-multilib g++-multilib zlib1g-dev libbrotli-dev zlib1g-dev:i386 libbrotli-dev:i386" - compiler: "clang" version: "18" @@ -537,7 +525,7 @@ jobs: build-type: "Release" cxxflags: "-ftime-trace" ccflags: "-ftime-trace" - install: "zlib1g-dev wget unzip" + install: "zlib1g-dev libbrotli-dev wget unzip" - compiler: "clang" version: "18" @@ -552,7 +540,7 @@ jobs: name: "Clang 18: C++17-20 (asan)" asan: true build-type: "RelWithDebInfo" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" - compiler: "clang" version: "18" @@ -568,7 +556,7 @@ jobs: asan: true x86: true build-type: "RelWithDebInfo" - install: "gcc-multilib g++-multilib zlib1g-dev zlib1g-dev:i386" + install: "gcc-multilib g++-multilib zlib1g-dev libbrotli-dev zlib1g-dev:i386 libbrotli-dev:i386" - compiler: "clang" version: "18" @@ -583,7 +571,7 @@ jobs: name: "Clang 18: C++17-20 (ubsan)" ubsan: true build-type: "RelWithDebInfo" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" - compiler: "clang" version: "18" @@ -599,7 +587,7 @@ jobs: ubsan: true x86: true build-type: "RelWithDebInfo" - install: "gcc-multilib g++-multilib zlib1g-dev zlib1g-dev:i386" + install: "gcc-multilib g++-multilib zlib1g-dev libbrotli-dev zlib1g-dev:i386 libbrotli-dev:i386" - compiler: "clang" version: "17" @@ -611,7 +599,7 @@ jobs: b2-toolset: "clang" name: "Clang 17: C++17-20" build-type: "Release" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" - compiler: "clang" version: "16" @@ -623,7 +611,7 @@ jobs: b2-toolset: "clang" name: "Clang 16: C++17-20" build-type: "Release" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" - compiler: "clang" version: "15" @@ -636,7 +624,7 @@ jobs: b2-toolset: "clang" name: "Clang 15: C++17-20" build-type: "Release" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" - compiler: "clang" version: "14" @@ -649,7 +637,7 @@ jobs: b2-toolset: "clang" name: "Clang 14: C++17-20" build-type: "Release" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" - compiler: "clang" version: "13" @@ -662,7 +650,7 @@ jobs: b2-toolset: "clang" name: "Clang 13: C++17-20" build-type: "Release" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" - compiler: "clang" version: "12" @@ -675,7 +663,7 @@ jobs: b2-toolset: "clang" name: "Clang 12: C++17-20" build-type: "Release" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" - compiler: "clang" version: "11" @@ -688,7 +676,7 @@ jobs: b2-toolset: "clang" name: "Clang 11: C++14-17" build-type: "Release" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" - compiler: "clang" version: "10" @@ -701,7 +689,7 @@ jobs: b2-toolset: "clang" name: "Clang 10: C++14-17" build-type: "Release" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" - compiler: "clang" version: "9" @@ -714,7 +702,7 @@ jobs: b2-toolset: "clang" name: "Clang 9: C++14-17" build-type: "Release" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" - compiler: "clang" version: "8" @@ -727,7 +715,7 @@ jobs: b2-toolset: "clang" name: "Clang 8: C++14-17" build-type: "Release" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" - compiler: "clang" version: "7" @@ -740,7 +728,7 @@ jobs: b2-toolset: "clang" name: "Clang 7: C++14-17" build-type: "Release" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" - compiler: "clang" version: "6" @@ -753,7 +741,7 @@ jobs: b2-toolset: "clang" name: "Clang 6: C++14-17" build-type: "Release" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" - compiler: "clang" version: "5" @@ -766,7 +754,7 @@ jobs: b2-toolset: "clang" name: "Clang 5: C++11-14" build-type: "Release" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" - compiler: "clang" version: "4" @@ -779,7 +767,7 @@ jobs: b2-toolset: "clang" name: "Clang 4: C++11-14" build-type: "Release" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" - compiler: "clang" version: "3.9" @@ -793,7 +781,7 @@ jobs: is-earliest: true name: "Clang 3.9: C++11" build-type: "Release" - install: "zlib1g-dev" + install: "zlib1g-dev libbrotli-dev" name: ${{ matrix.name }} runs-on: ${{ fromJSON(needs.runner-selection.outputs.labelmatrix)[matrix.runs-on] }} @@ -834,8 +822,15 @@ jobs: repository: cppalliance/buffers ref: develop + - name: Clone Boost.RunTimeServices + uses: actions/checkout@v3 + with: + path: rts-root + repository: cppalliance/rts + ref: develop + - name: Setup C++ - uses: alandefreitas/cpp-actions/setup-cpp@v1.8.8 + uses: alandefreitas/cpp-actions/setup-cpp@v1.8.10 id: setup-cpp with: compiler: ${{ matrix.compiler }} @@ -844,7 +839,7 @@ jobs: trace-commands: true - name: Install packages - uses: alandefreitas/cpp-actions/package-install@v1.8.8 + uses: alandefreitas/cpp-actions/package-install@v1.8.10 id: package-install with: apt-get-add-architecture: 'i386' @@ -854,7 +849,7 @@ jobs: build-essential - name: Clone Boost - uses: alandefreitas/cpp-actions/boost-clone@v1.8.8 + uses: alandefreitas/cpp-actions/boost-clone@v1.8.10 id: boost-clone with: branch: ${{ (github.ref_name == 'master' && github.ref_name) || 'develop' }} @@ -865,19 +860,21 @@ jobs: http-io-root http-proto-root buffers-root + rts-root scan-modules-ignore: | http_io http_proto buffers + rts - - name: Install packages (Windows) - uses: alandefreitas/cpp-actions/package-install@v1.8.8 + - name: Install Packages (Windows) + uses: alandefreitas/cpp-actions/package-install@v1.8.10 if: ${{ startsWith(matrix.runs-on, 'windows') }} id: package-install-windows with: - vcpkg: "zlib,openssl" + vcpkg: zlib brotli openssl vcpkg-dir: vcpkg-root - vcpkg-triplet: ${{ matrix.x86 && 'x86-windows' || 'x64-windows' }} + vcpkg-triplet: ${{ matrix.x86 && 'x86-windows-static' || 'x64-windows' }} - name: Patch user-config.jam (Windows) id: patch-user-config @@ -887,15 +884,19 @@ jobs: set -xe home=$(pwd) - triplet=${{ matrix.x86 && 'x86-windows' || 'x64-windows' }} + triplet=${{ matrix.x86 && 'x86-windows-static' || 'x64-windows' }} addrmdl=${{ matrix.x86 && '32' || '64' }} - echo "using zlib : : \"${home}/vcpkg-root/installed/${triplet}/include\" \"${home}/vcpkg-root/installed/${triplet}/lib\" zlib : ${addrmdl} ;" | sed 's/\/d\//D:\//g' > user-config.jam - echo "using openssl : : \"${home}/vcpkg-root/installed/${triplet}/include\" \"${home}/vcpkg-root/installed/${triplet}/lib\" libssl libcrypto : ${addrmdl} ;" | sed 's/\/d\//D:\//g' >> user-config.jam + # This is temporary until we move rts/build/brotli.jam to boost/tools/build + echo "import-search ${home}/boost-root/libs/rts/build ;" | sed 's/\/d\//D:\//g' >> user-config.jam + + echo "using zlib : : \"${home}/vcpkg-root/installed/${triplet}/include\" \"${home}/vcpkg-root/installed/${triplet}/lib\" \"${home}/vcpkg-root/installed/${triplet}/bin\" zlib : ${addrmdl} ;" | sed 's/\/d\//D:\//g' >> user-config.jam + echo "using brotli : : \"${home}/vcpkg-root/installed/${triplet}/include\" \"${home}/vcpkg-root/installed/${triplet}/lib\" \"${home}/vcpkg-root/installed/${triplet}/bin\" : ${addrmdl} ;" | sed 's/\/d\//D:\//g' >> user-config.jam + echo "using openssl : : \"${home}/vcpkg-root/installed/${triplet}/include\" \"${home}/vcpkg-root/installed/${triplet}/lib\" \"${home}/vcpkg-root/installed/${triplet}/bin\" libssl libcrypto : ${addrmdl} ;" | sed 's/\/d\//D:\//g' >> user-config.jam + cat user-config.jam toolchain=$(echo "$GITHUB_WORKSPACE/vcpkg-root/scripts/buildsystems/vcpkg.cmake" | sed 's/\/d\//D:\//g' ) - cat ${toolchain} echo "toolchain=${toolchain}" >> $GITHUB_OUTPUT - name: ASLR Fix @@ -936,9 +937,10 @@ jobs: cp -r "$workspace_root"/http-io-root "libs/$module" cp -r "$workspace_root"/http-proto-root libs/http_proto cp -r "$workspace_root"/buffers-root libs/buffers + cp -r "$workspace_root"/rts-root libs/rts - name: Boost B2 Workflow - uses: alandefreitas/cpp-actions/b2-workflow@v1.8.8 + uses: alandefreitas/cpp-actions/b2-workflow@v1.8.10 if: ${{ !matrix.coverage && !matrix.time-trace }} env: ASAN_OPTIONS: ${{ (startsWith(matrix.compiler, 'apple-clang') && 'detect_invalid_pointer_pairs=0') || 'detect_invalid_pointer_pairs=2' }} @@ -959,7 +961,7 @@ jobs: stop-on-error: true - name: Boost CMake Workflow - uses: alandefreitas/cpp-actions/cmake-workflow@v1.8.8 + uses: alandefreitas/cpp-actions/cmake-workflow@v1.8.10 if: ${{ matrix.coverage || matrix.time-trace || matrix.build-cmake || matrix.is-earliest }} with: source-dir: boost-root @@ -996,7 +998,7 @@ jobs: echo "LD_LIBRARY_PATH=$GITHUB_WORKSPACE/.local/lib:$LD_LIBRARY_PATH" >> "$GITHUB_ENV" - name: Find Package Integration Workflow - uses: alandefreitas/cpp-actions/cmake-workflow@v1.8.8 + uses: alandefreitas/cpp-actions/cmake-workflow@v1.8.10 if: ${{ matrix.build-cmake || matrix.is-earliest }} with: source-dir: boost-root/libs/${{ steps.patch.outputs.module }}/test/cmake_test @@ -1020,7 +1022,7 @@ jobs: toolchain: ${{ (startsWith(matrix.runs-on, 'windows') && steps.patch-user-config.outputs.toolchain) || '' }} - name: Subdirectory Integration Workflow - uses: alandefreitas/cpp-actions/cmake-workflow@v1.8.8 + uses: alandefreitas/cpp-actions/cmake-workflow@v1.8.10 if: ${{ matrix.build-cmake || matrix.is-earliest }} with: source-dir: boost-root/libs/${{ steps.patch.outputs.module }}/test/cmake_test @@ -1041,7 +1043,7 @@ jobs: toolchain: ${{ (startsWith(matrix.runs-on, 'windows') && steps.patch-user-config.outputs.toolchain) || '' }} - name: Root Project CMake Workflow - uses: alandefreitas/cpp-actions/cmake-workflow@v1.8.8 + uses: alandefreitas/cpp-actions/cmake-workflow@v1.8.10 if: ${{ matrix.build-cmake || matrix.is-earliest }} with: source-dir: boost-root/libs/${{ steps.patch.outputs.module }} @@ -1064,7 +1066,7 @@ jobs: toolchain: ${{ (startsWith(matrix.runs-on, 'windows') && steps.patch-user-config.outputs.toolchain) || '' }} - name: FlameGraph - uses: alandefreitas/cpp-actions/flamegraph@v1.8.8 + uses: alandefreitas/cpp-actions/flamegraph@v1.8.10 if: matrix.time-trace with: source-dir: boost-root/libs/http_io @@ -1110,14 +1112,14 @@ jobs: timeout-minutes: 120 steps: - - name: Clone Boost.WS.Io + - name: Clone Boost.Http.Io uses: actions/checkout@v3 with: # Avoid the common API rate limit exceeded error in boostorg by including 100 latest commits in any case fetch-depth: 100 - name: Changelog - uses: alandefreitas/cpp-actions/create-changelog@v1.8.8 + uses: alandefreitas/cpp-actions/create-changelog@v1.8.10 with: thank-non-regular: ${{ startsWith(github.ref, 'refs/tags/') }} github-token: ${{ secrets.GITHUB_TOKEN }} @@ -1162,8 +1164,15 @@ jobs: repository: cppalliance/buffers ref: develop + - name: Clone Boost.RunTimeServices + uses: actions/checkout@v3 + with: + path: rts-root + repository: cppalliance/rts + ref: develop + - name: Clone Boost - uses: alandefreitas/cpp-actions/boost-clone@v1.8.8 + uses: alandefreitas/cpp-actions/boost-clone@v1.8.10 id: boost-clone with: branch: ${{ (github.ref_name == 'master' && github.ref_name) || 'develop' }} @@ -1174,10 +1183,12 @@ jobs: http-io-root http-proto-root buffers-root + rts-root scan-modules-ignore: | http_io http_proto buffers + rts - name: Patch Boost id: patch @@ -1212,6 +1223,7 @@ jobs: cp -r "$workspace_root"/http-io-root "libs/$module" cp -r "$workspace_root"/http-proto-root libs/http_proto cp -r "$workspace_root"/buffers-root libs/buffers + cp -r "$workspace_root"/rts-root libs/rts - uses: actions/setup-node@v4 with: diff --git a/cmake/config.cmake.in b/cmake/config.cmake.in deleted file mode 100644 index b3c743e..0000000 --- a/cmake/config.cmake.in +++ /dev/null @@ -1,10 +0,0 @@ -@PACKAGE_INIT@ - -set(BOOST_JSON_STANDALONE @BOOST_JSON_STANDALONE@) - -if(NOT BOOST_JSON_STANDALONE) - include(CMakeFindDependencyMacro) - find_dependency(Boost REQUIRED COMPONENTS container system) -endif() - -include("${CMAKE_CURRENT_LIST_DIR}/boost_json-targets.cmake") diff --git a/example/client/burl/CMakeLists.txt b/example/client/burl/CMakeLists.txt index 2782a43..3359086 100644 --- a/example/client/burl/CMakeLists.txt +++ b/example/client/burl/CMakeLists.txt @@ -23,22 +23,25 @@ if (CMAKE_CXX_STANDARD EQUAL 20) PROPERTY FOLDER "examples") find_package(OpenSSL REQUIRED) - find_package(ZLIB) target_link_libraries(http_io_example_client_burl boost_http_io + boost_url boost_program_options boost_scope OpenSSL::SSL OpenSSL::Crypto) if (WIN32) - target_link_libraries(http_io_example_client_burl - crypt32) + target_link_libraries(http_io_example_client_burl crypt32) endif() - if (ZLIB_FOUND) - target_link_libraries(http_io_example_client_burl - boost_http_proto_zlib) + if (TARGET boost_rts_zlib) + target_link_libraries(http_io_example_client_burl boost_rts_zlib) endif() + + if (TARGET boost_rts_brotli) + target_link_libraries(http_io_example_client_burl boost_rts_brotli) + endif() + endif() diff --git a/example/client/burl/Jamfile b/example/client/burl/Jamfile index 4cd61d3..842993e 100644 --- a/example/client/burl/Jamfile +++ b/example/client/burl/Jamfile @@ -14,13 +14,13 @@ import ac ; project : requirements - $(c11-requires) [ requires cxx20_hdr_concepts ] - /boost/http_proto//boost_http_proto - [ ac.check-library /boost/http_proto//boost_http_proto_zlib : /boost/http_proto//boost_http_proto_zlib : ] /boost/http_io//boost_http_io + [ ac.check-library /boost/rts//boost_rts_zlib : /boost/rts//boost_rts_zlib : ] + [ ac.check-library /boost/rts//boost_rts_brotli : /boost/rts//boost_rts_brotli : ] + /boost/url//boost_url /boost/program_options//boost_program_options /boost/scope//boost_scope /openssl//ssl/shared diff --git a/example/client/burl/connect.cpp b/example/client/burl/connect.cpp index f628486..e35e4df 100644 --- a/example/client/burl/connect.cpp +++ b/example/client/burl/connect.cpp @@ -152,7 +152,7 @@ connect_socks5_proxy( asio::awaitable connect_http_proxy( const operation_config& oc, - http_proto::context& proto_ctx, + rts::context& rts_ctx, asio::ip::tcp::socket& stream, const urls::url_view& url, const urls::url_view& proxy) @@ -189,8 +189,8 @@ connect_http_proxy( request.set(field::proxy_authorization, basic_auth); } - auto serializer = http_proto::serializer{ proto_ctx }; - auto parser = http_proto::response_parser{ proto_ctx }; + auto serializer = http_proto::serializer{ rts_ctx }; + auto parser = http_proto::response_parser{ rts_ctx }; serializer.start(request); co_await http_io::async_write(stream, serializer); @@ -222,7 +222,7 @@ asio::awaitable connect( const operation_config& oc, ssl::context& ssl_ctx, - http_proto::context& proto_ctx, + rts::context& rts_ctx, any_stream& stream, urls::url url) { @@ -258,7 +258,7 @@ connect( { if(oc.proxy.scheme() == "http") { - co_await connect_http_proxy(oc, proto_ctx, socket, url, oc.proxy); + co_await connect_http_proxy(oc, rts_ctx, socket, url, oc.proxy); } else if(oc.proxy.scheme() == "socks5") { diff --git a/example/client/burl/connect.hpp b/example/client/burl/connect.hpp index fb58ba5..0f1b235 100644 --- a/example/client/burl/connect.hpp +++ b/example/client/burl/connect.hpp @@ -15,11 +15,11 @@ #include #include -#include +#include #include namespace asio = boost::asio; -namespace http_proto = boost::http_proto; +namespace rts = boost::rts; namespace ssl = boost::asio::ssl; namespace urls = boost::urls; @@ -27,7 +27,7 @@ asio::awaitable connect( const operation_config& oc, ssl::context& ssl_ctx, - http_proto::context& proto_ctx, + rts::context& rts_ctx, any_stream& stream, urls::url url); diff --git a/example/client/burl/main.cpp b/example/client/burl/main.cpp index 28c2a9e..9cfcaa2 100644 --- a/example/client/burl/main.cpp +++ b/example/client/burl/main.cpp @@ -31,6 +31,8 @@ #include #include #include +#include +#include #include #include #include @@ -42,10 +44,16 @@ namespace http_io = boost::http_io; namespace scope = boost::scope; using system_error = boost::system::system_error; -#ifdef BOOST_HTTP_PROTO_HAS_ZLIB -inline const bool http_proto_has_zlib = true; +#ifdef BOOST_RTS_HAS_ZLIB +constexpr bool rts_has_zlib = true; #else -inline const bool http_proto_has_zlib = false; +constexpr bool rts_has_zlib = false; +#endif + +#ifdef BOOST_RTS_HAS_BROTLI +constexpr bool rts_has_brotli = true; +#else +constexpr bool rts_has_brotli = false; #endif void @@ -265,8 +273,29 @@ create_request( request.set(field::authorization, basic_auth); } - if(oc.encoding && http_proto_has_zlib) - request.set(field::accept_encoding, "gzip, deflate"); + if(oc.encoding) + { + std::string value; + + const auto append = [&](const char* encoding) + { + if(!value.empty()) + value.append(", "); + value.append(encoding); + }; + + if constexpr(rts_has_brotli) + append("br"); + + if constexpr(rts_has_zlib) + { + append("deflate"); + append("gzip"); + } + + if(!value.empty()) + request.set(field::accept_encoding, value); + } for(const auto& [_, name, value] : oc.headers) request.set(name, value); @@ -322,15 +351,15 @@ perform_request( boost::optional& cookie_jar, core::string_view exp_cookies, ssl::context& ssl_ctx, - http_proto::context& proto_ctx, + rts::context& rts_ctx, message msg, request_opt request_opt) { using field = http_proto::field; auto executor = co_await asio::this_coro::executor; auto stream = any_stream{ asio::ip::tcp::socket{ executor } }; - auto parser = http_proto::response_parser{ proto_ctx }; - auto serializer = http_proto::serializer{ proto_ctx }; + auto parser = http_proto::response_parser{ rts_ctx }; + auto serializer = http_proto::serializer{ rts_ctx }; urls::url url = [&]() { @@ -442,7 +471,7 @@ perform_request( co_await asio::co_spawn( executor, - connect(oc, ssl_ctx, proto_ctx, stream, url), + connect(oc, ssl_ctx, rts_ctx, stream, url), asio::cancel_after(oc.connect_timeout)); if(oc.recvpersecond) @@ -734,7 +763,7 @@ co_main(int argc, char* argv[]) auto executor = co_await asio::this_coro::executor; auto task_group = ::task_group{ executor, oc.parallel_max }; - auto proto_ctx = http_proto::context{}; + auto rts_ctx = rts::context{}; auto cookie_jar = boost::optional<::cookie_jar>{}; auto header_output = boost::optional{}; auto exp_cookies = std::string{}; @@ -746,16 +775,30 @@ co_main(int argc, char* argv[]) } // parser service - http_proto::response_parser::config parser_cfg; - parser_cfg.body_limit = oc.max_filesize; - parser_cfg.min_buffer = 1024 * 1024; - if(http_proto_has_zlib) - { - parser_cfg.apply_gzip_decoder = true; - parser_cfg.apply_deflate_decoder = true; - http_proto::zlib::install_inflate_service(proto_ctx); + { + http_proto::response_parser::config cfg; + cfg.body_limit = oc.max_filesize; + cfg.min_buffer = 1024 * 1024; + if constexpr(rts_has_brotli) + { + cfg.apply_brotli_decoder = true; + rts::brotli::install_decode_service(rts_ctx); + } + if constexpr(rts_has_zlib) + { + cfg.apply_deflate_decoder = true; + cfg.apply_gzip_decoder = true; + rts::zlib::install_inflate_service(rts_ctx); + } + http_proto::install_parser_service(rts_ctx, cfg); + } + + // serializer service + { + http_proto::serializer::config cfg; + cfg.payload_buffer = 1024 * 1024; + http_proto::install_serializer_service(rts_ctx, cfg); } - http_proto::install_parser_service(proto_ctx, parser_cfg); if(!oc.headerfile.empty()) header_output.emplace(oc.headerfile); @@ -792,7 +835,7 @@ co_main(int argc, char* argv[]) cookie_jar, exp_cookies, ssl_ctx, - proto_ctx, + rts_ctx, oc.msg, ropt.value()); }; diff --git a/example/client/visit/CMakeLists.txt b/example/client/visit/CMakeLists.txt index bcb79b7..d4fd4e2 100644 --- a/example/client/visit/CMakeLists.txt +++ b/example/client/visit/CMakeLists.txt @@ -21,20 +21,6 @@ target_compile_definitions(http_io_example_client_visit set_property(TARGET http_io_example_client_visit PROPERTY FOLDER "examples") -find_package(OpenSSL REQUIRED) -find_package(ZLIB) - target_link_libraries(http_io_example_client_visit boost_http_io - OpenSSL::SSL - OpenSSL::Crypto) - -if (WIN32) - target_link_libraries(http_io_example_client_visit - crypt32) -endif() - -if (ZLIB_FOUND) - target_link_libraries(http_io_example_client_visit - boost_http_proto_zlib) -endif() + boost_url) diff --git a/example/client/visit/Jamfile b/example/client/visit/Jamfile index 22bd4f8..63ddcf0 100644 --- a/example/client/visit/Jamfile +++ b/example/client/visit/Jamfile @@ -8,20 +8,10 @@ # Official repository: https://github.com/cppalliance/http_io # -import ../../../../config/checks/config : requires ; - -using openssl ; -import ac ; - project : requirements - $(c11-requires) - /boost/http_proto//boost_http_proto - [ ac.check-library /boost/http_proto//boost_http_proto_zlib : /boost/http_proto//boost_http_proto_zlib : ] /boost/http_io//boost_http_io - /openssl//ssl/shared - /openssl//crypto/shared - windows:crypt32 + /boost/url//boost_url . ; diff --git a/example/client/visit/main.cpp b/example/client/visit/main.cpp index 8268236..35ea9b9 100644 --- a/example/client/visit/main.cpp +++ b/example/client/visit/main.cpp @@ -13,9 +13,9 @@ #include #include #include -#include #include #include +#include #include struct worker @@ -36,7 +36,7 @@ struct worker explicit worker( executor_type ex, - boost::http_proto::context& ctx) + boost::rts::context& ctx) : sock(ex) , resolver(ex) , pr(ctx) @@ -128,7 +128,7 @@ struct worker int main(int argc, char* argv[]) { - boost::http_proto::context ctx; + boost::rts::context ctx; boost::http_proto::parser::config_base cfg; boost::http_proto::install_parser_service(ctx, cfg); diff --git a/example/server/CMakeLists.txt b/example/server/CMakeLists.txt index 05f3705..cb812e2 100644 --- a/example/server/CMakeLists.txt +++ b/example/server/CMakeLists.txt @@ -22,4 +22,5 @@ set_property(TARGET http_io_server_example PROPERTY FOLDER "examples") target_link_libraries(http_io_server_example - boost_http_io) + boost_http_io + boost_url) diff --git a/example/server/Jamfile b/example/server/Jamfile index ff45dac..ab06048 100644 --- a/example/server/Jamfile +++ b/example/server/Jamfile @@ -1,5 +1,6 @@ # # Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com) +# Copyright (c) 2025 Mohammad Nejati # # 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) @@ -7,24 +8,13 @@ # Official repository: https://github.com/CPPAlliance/http_proto # -import testing ; -import ac ; - -using zlib ; - project : requirements - $(c11-requires) - #/boost/filesystem//boost_filesystem/off - /boost/http_proto//boost_http_proto /boost/http_io//boost_http_io - [ ac.check-library /zlib//zlib : /zlib//zlib : ] - [ ac.check-library /boost/http_proto//boost_http_proto_zlib : /boost/http_proto//boost_http_proto_zlib : ] + /boost/url//boost_url . - windows:_WIN32_WINNT=0x0601 # VFALCO? ; exe server : - main.cpp - server.cpp + [ glob *.cpp ] ; diff --git a/example/server/acceptor.hpp b/example/server/acceptor.hpp index 9f602c0..058746e 100644 --- a/example/server/acceptor.hpp +++ b/example/server/acceptor.hpp @@ -13,7 +13,7 @@ #include "fixed_array.hpp" #include "server.hpp" #include -#include +#include #include template< class Executor > @@ -32,7 +32,7 @@ class acceptor : public server::service private: server& srv_; acceptor_type sock_; - boost::http_proto::context& ctx_; + boost::rts::context& ctx_; std::size_t id_ = 0; fixed_array< worker< executor_type > > wv_; @@ -40,7 +40,7 @@ class acceptor : public server::service acceptor( server& srv, boost::asio::ip::tcp::endpoint ep, - boost::http_proto::context& ctx, + boost::rts::context& ctx, std::size_t num_workers, std::string const& doc_root) : srv_(srv) @@ -68,7 +68,7 @@ class acceptor : public server::service return sock_; } - boost::http_proto::context& + boost::rts::context& context() const noexcept { return ctx_; diff --git a/example/server/main.cpp b/example/server/main.cpp index cadf680..417ce41 100644 --- a/example/server/main.cpp +++ b/example/server/main.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -29,6 +30,7 @@ namespace io = boost::http_io; namespace urls = boost::urls; namespace asio = boost::asio; namespace core = boost::core; +namespace rts = boost::rts; namespace http_proto = boost::http_proto; using namespace std::placeholders; using tcp = boost::asio::ip::tcp; @@ -362,7 +364,7 @@ class worker , sock_(srv.make_executor()) , doc_root_(doc_root) , pr_(ac_.context()) - , sr_(ac_.context(), 65536) + , sr_(ac_.context()) , id_(ac_.next_id()) { } @@ -550,11 +552,15 @@ int main(int argc, char* argv[]) file_handler fh(doc_root); - http_proto::context ctx; + rts::context ctx; { http_proto::request_parser::config cfg; http_proto::install_parser_service(ctx, cfg); } + { + http_proto::serializer::config cfg; + http_proto::install_serializer_service(ctx, cfg); + } server srv; srv.make_service>( diff --git a/test/cmake_test/CMakeLists.txt b/test/cmake_test/CMakeLists.txt index 59a0164..cac5363 100644 --- a/test/cmake_test/CMakeLists.txt +++ b/test/cmake_test/CMakeLists.txt @@ -29,7 +29,6 @@ else() http_proto system throw_exception - url # Secondary dependencies @@ -37,44 +36,46 @@ else() context date_time buffers - container_hash core - mp11 + rts static_assert type_traits + url winapi variant2 - optional - describe + mp11 pool predef smart_ptr - exception - move - utility algorithm io lexical_cast numeric/conversion range tokenizer + utility + container_hash + optional array bind concept_check + exception function iterator mpl regex tuple unordered + describe container - integer conversion preprocessor + integer detail intrusive - function_types + move fusion + function_types functional typeof ) diff --git a/test/unit/Jamfile b/test/unit/Jamfile index 2efe361..c9066dc 100644 --- a/test/unit/Jamfile +++ b/test/unit/Jamfile @@ -18,7 +18,6 @@ project /boost/http_io//boost_http_io /boost/beast//boost_beast/off [ ac.check-library /openssl//ssl/off : /openssl//ssl/off : ] - [ ac.check-library /boost/http_proto//boost_http_proto_zlib/off : /boost/http_proto//boost_http_proto_zlib/off : ] ../../../url/extra/test_suite/test_main.cpp ../../../url/extra/test_suite/test_suite.cpp .