Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 26 additions & 19 deletions .github/workflows/toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
/etc/apt/sources.list.d/google-chrome.sources
sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install --yes ninja-build libcrypt-dev libidn2-dev ${{ matrix.packages }}
sudo apt-get install --yes ninja-build libcrypt-dev libidn2-dev libnghttp2-dev ${{ matrix.packages }}
- name: Verify C++23 toolchain contract
env:
CXXFLAGS: ${{ matrix.cxxflags }}
Expand All @@ -45,22 +45,23 @@ jobs:
-DLAGHU_BUILD_PROFILE=FULL
cmake --build "$RUNNER_TEMP/laghu-full" --target \
laghu_crypto_provider_test laghu_idna_test laghu_password_auth_test \
laghu_password_auth_failure_token_test
laghu_password_auth_failure_token_test laghu_http2_test laghu_http2_contract_test
ctest --test-dir "$RUNNER_TEMP/laghu-full" --output-on-failure \
-R '^laghu\.(crypto\.provider|adapters\.(idna|password_auth|password_auth\.failure_token))$'
-R '^laghu\.(crypto\.provider|adapters\.(idna|password_auth|password_auth\.failure_token|http2|http2\.contract))$'
- name: Verify system dynamic IDNA and password adapters
if: matrix.name == 'gcc-14-libstdc++'
run: |
cmake -S . -B "$RUNNER_TEMP/laghu-system-adapters" -G Ninja \
-DCMAKE_CXX_COMPILER="${{ matrix.compiler }}" \
-DLAGHU_BUILD_PROFILE=CUSTOM \
'-DLAGHU_FEATURES=idna;password_auth' \
'-DLAGHU_FEATURES=idna;password_auth;http2' \
-DLAGHU_DEPENDENCY_SOURCE=SYSTEM \
-DLAGHU_DEPENDENCY_LINK_MODE=DYNAMIC
cmake --build "$RUNNER_TEMP/laghu-system-adapters" --target \
laghu_idna_test laghu_password_auth_test laghu_password_auth_failure_token_test
laghu_idna_test laghu_password_auth_test laghu_password_auth_failure_token_test \
laghu_http2_test laghu_http2_contract_test
ctest --test-dir "$RUNNER_TEMP/laghu-system-adapters" --output-on-failure \
-R '^laghu\.adapters\.(idna|password_auth|password_auth\.failure_token)$'
-R '^laghu\.adapters\.(idna|password_auth|password_auth\.failure_token|http2|http2\.contract)$'
- name: Verify Clang 19 crypto adapter
if: matrix.name == 'clang-19-libc++'
run: |
Expand All @@ -80,11 +81,12 @@ jobs:
-DCMAKE_CXX_COMPILER="${{ matrix.compiler }}" \
-DCMAKE_CXX_FLAGS="${{ matrix.cxxflags }}" \
-DLAGHU_BUILD_PROFILE=CUSTOM \
'-DLAGHU_FEATURES=idna;password_auth'
'-DLAGHU_FEATURES=idna;password_auth;http2'
cmake --build "$RUNNER_TEMP/laghu-clang-adapters" --target \
laghu_idna_test laghu_password_auth_test laghu_password_auth_failure_token_test
laghu_idna_test laghu_password_auth_test laghu_password_auth_failure_token_test \
laghu_http2_test laghu_http2_contract_test
ctest --test-dir "$RUNNER_TEMP/laghu-clang-adapters" --output-on-failure \
-R '^laghu\.adapters\.(idna|password_auth|password_auth\.failure_token)$'
-R '^laghu\.adapters\.(idna|password_auth|password_auth\.failure_token|http2|http2\.contract)$'
- name: Verify LibreSSL crypto adapter
if: matrix.name == 'gcc-14-libstdc++'
run: |
Expand Down Expand Up @@ -139,11 +141,12 @@ jobs:
cmake -S . -B "$RUNNER_TEMP/laghu-adapters" -G Ninja \
-DCMAKE_CXX_COMPILER=clang++ \
-DLAGHU_BUILD_PROFILE=CUSTOM \
'-DLAGHU_FEATURES=idna;password_auth'
'-DLAGHU_FEATURES=idna;password_auth;http2'
cmake --build "$RUNNER_TEMP/laghu-adapters" --target \
laghu_idna_test laghu_password_auth_test laghu_password_auth_failure_token_test
laghu_idna_test laghu_password_auth_test laghu_password_auth_failure_token_test \
laghu_http2_test laghu_http2_contract_test
ctest --test-dir "$RUNNER_TEMP/laghu-adapters" --output-on-failure \
-R '^laghu\.adapters\.(idna|password_auth|password_auth\.failure_token)$'
-R '^laghu\.adapters\.(idna|password_auth|password_auth\.failure_token|http2|http2\.contract)$'
- uses: actions/upload-artifact@v7
with:
name: toolchain-capabilities-macos-appleclang
Expand Down Expand Up @@ -173,11 +176,12 @@ jobs:
cmake -S . -B /tmp/laghu-adapters -G Ninja \
-DCMAKE_CXX_COMPILER=clang++ \
-DLAGHU_BUILD_PROFILE=CUSTOM \
'-DLAGHU_FEATURES=idna;password_auth'
'-DLAGHU_FEATURES=idna;password_auth;http2'
cmake --build /tmp/laghu-adapters --target \
laghu_idna_test laghu_password_auth_test laghu_password_auth_failure_token_test
laghu_idna_test laghu_password_auth_test laghu_password_auth_failure_token_test \
laghu_http2_test laghu_http2_contract_test
ctest --test-dir /tmp/laghu-adapters --output-on-failure \
-R '^laghu\.adapters\.(idna|password_auth|password_auth\.failure_token)$'
-R '^laghu\.adapters\.(idna|password_auth|password_auth\.failure_token|http2|http2\.contract)$'
linux-aarch64-cross:
runs-on: ubuntu-24.04
steps:
Expand All @@ -193,14 +197,16 @@ jobs:
run: |
cmake --preset linux-aarch64-gcc \
-DLAGHU_BUILD_PROFILE=CUSTOM \
-DLAGHU_FEATURES=tls
'-DLAGHU_FEATURES=tls;http2'
cmake --build build/linux-aarch64-gcc --target laghu_verify_toolchain
- name: Verify ARM64 archive
run: |
test -f build/linux-aarch64-gcc/liblaghu_core.a
aarch64-linux-gnu-ar t build/linux-aarch64-gcc/liblaghu_core.a
test -f build/linux-aarch64-gcc/liblaghu_crypto.a
aarch64-linux-gnu-ar t build/linux-aarch64-gcc/liblaghu_crypto.a
test -f build/linux-aarch64-gcc/liblaghu_http2.a
aarch64-linux-gnu-ar t build/linux-aarch64-gcc/liblaghu_http2.a
linux-clang-asan-ubsan:
runs-on: ubuntu-24.04
steps:
Expand Down Expand Up @@ -236,11 +242,12 @@ jobs:
-DCMAKE_CXX_FLAGS=-stdlib=libc++ \
-DLAGHU_SANITIZER_PROFILE=ASAN_UBSAN \
-DLAGHU_BUILD_PROFILE=CUSTOM \
'-DLAGHU_FEATURES=idna;password_auth'
'-DLAGHU_FEATURES=idna;password_auth;http2'
cmake --build "$RUNNER_TEMP/laghu-asan-adapters" --target \
laghu_idna_test laghu_password_auth_test laghu_password_auth_failure_token_test
laghu_idna_test laghu_password_auth_test laghu_password_auth_failure_token_test \
laghu_http2_test laghu_http2_contract_test
ctest --test-dir "$RUNNER_TEMP/laghu-asan-adapters" --output-on-failure \
-R '^laghu\.adapters\.(idna|password_auth|password_auth\.failure_token)$'
-R '^laghu\.adapters\.(idna|password_auth|password_auth\.failure_token|http2|http2\.contract)$'
- name: Replay binary-envelope fuzz corpus under ASan and UBSan
run: |
cmake -S . -B "$RUNNER_TEMP/laghu-fuzz" -G Ninja \
Expand Down
36 changes: 36 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,22 @@ if(NOT laghu_structured_data_feature_index EQUAL -1)
endif()
endif()

list(FIND LAGHU_EFFECTIVE_FEATURES http2 laghu_http2_feature_index)
if(NOT laghu_http2_feature_index EQUAL -1)
add_library(laghu_http2 STATIC
src/adapters/http2.cpp
$<TARGET_OBJECTS:laghu_dependency_logging_impl>)
laghu_apply_first_party_contract(laghu_http2)
laghu_configure_api_consumer(laghu_http2 adapters)
laghu_register_subsystem_target(laghu_http2 adapters)
laghu_link_subsystems(laghu_http2 laghu_core)
target_link_libraries(laghu_http2 PRIVATE laghu_feature_http2)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set_source_files_properties(src/adapters/http2.cpp PROPERTIES
COMPILE_OPTIONS "-Wno-old-style-cast;-Wno-unsafe-buffer-usage;-Wno-zero-as-null-pointer-constant")
endif()
endif()

add_executable(laghu_core_smoke src/core/smoke.cpp)
laghu_apply_first_party_contract(laghu_core_smoke)
laghu_configure_api_consumer(laghu_core_smoke core)
Expand Down Expand Up @@ -350,6 +366,23 @@ if(TARGET laghu_structured_data)
--runs 1)
endif()
endif()

if(TARGET laghu_http2)
add_executable(laghu_http2_test tests/adapters/http2.cpp)
laghu_apply_first_party_contract(laghu_http2_test)
laghu_configure_api_consumer(laghu_http2_test adapters)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set_source_files_properties(tests/adapters/http2.cpp PROPERTIES
COMPILE_OPTIONS -Wno-unsafe-buffer-usage)
endif()
target_link_libraries(laghu_http2_test PRIVATE laghu_http2 laghu_test_support)
laghu_add_native_test(laghu.adapters.http2 laghu_http2_test)

add_executable(laghu_http2_contract_test tests/adapters/http2_contract.cpp)
laghu_apply_first_party_contract(laghu_http2_contract_test)
laghu_configure_api_consumer(laghu_http2_contract_test adapters)
laghu_add_native_test(laghu.adapters.http2.contract laghu_http2_contract_test)
endif()
laghu_write_fuzz_target_registry()
laghu_add_fuzz_validation_tests()

Expand Down Expand Up @@ -532,6 +565,9 @@ if(TARGET laghu_structured_data_test)
list(APPEND laghu_verify_targets
laghu_structured_data laghu_structured_data_test laghu_structured_data_contract_test)
endif()
if(TARGET laghu_http2_test)
list(APPEND laghu_verify_targets laghu_http2 laghu_http2_test laghu_http2_contract_test)
endif()
laghu_collect_fuzz_targets(laghu_fuzz_verify_targets)
list(APPEND laghu_verify_targets ${laghu_fuzz_verify_targets})
foreach(target IN ITEMS laghu_sanitizer_heap_misuse_fixture
Expand Down
6 changes: 6 additions & 0 deletions cmake/LaghuBuildIdentity.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ function(laghu_build_identity_input_hashes output)
src/adapters/contract/laghu/adapters/structured_data.hpp
src/adapters/structured_data.cpp)
endif()
list(FIND LAGHU_EFFECTIVE_FEATURES http2 http2_feature_index)
if(NOT http2_feature_index EQUAL -1)
list(APPEND inputs
src/adapters/contract/laghu/adapters/http2.hpp
src/adapters/http2.cpp)
endif()
set(entries)
foreach(input IN LISTS inputs)
set(path "${CMAKE_SOURCE_DIR}/${input}")
Expand Down
6 changes: 6 additions & 0 deletions cmake/LaghuDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,13 @@ function(laghu_acquire_vendored_cmake_dependency id private_target)
set(CARES_SHARED ON CACHE BOOL "Build c-ares shared library" FORCE)
endif()
endif()
# Dependency projects must not select Laghu's build configuration through a
# shared cache entry. nghttp2 defaults an empty build type to RelWithDebInfo;
# restore the caller-owned value after its subdirectory is configured.
set(laghu_saved_build_type "${CMAKE_BUILD_TYPE}")
FetchContent_MakeAvailable("${content_name}")
set(CMAKE_BUILD_TYPE "${laghu_saved_build_type}" CACHE STRING
"Choose the type of build" FORCE)
laghu_dependency_property("${id}" VENDORED_VERSION vendored_version)
set_property(GLOBAL PROPERTY "LAGHU_DEPENDENCY_SELECTED_VERSION_${id}" "${vendored_version}")
laghu_find_vendored_cmake_target("${id}" vendored_target)
Expand Down
Loading
Loading