Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
349b580
Add C++20 Streaming API tests for StreamHandle struct
yhirose Nov 26, 2025
f58a626
Add Streaming API: Implement open_stream methods and corresponding tests
yhirose Nov 26, 2025
ec8b5d5
Add read method to StreamHandle and corresponding tests
yhirose Nov 26, 2025
ee4baec
Add C++20 coroutine support and streaming API tests in httplib20.h an…
yhirose Nov 26, 2025
61b5245
Add read_all method to StreamHandle and integration tests for chunked…
yhirose Nov 26, 2025
1950b6d
Add README for C++20 Streaming API with usage examples and API reference
yhirose Nov 26, 2025
01a82a6
Add ClientConnection class with move semantics and corresponding tests
yhirose Nov 26, 2025
6e7dfd3
Add BodyReader struct and corresponding tests for incremental HTTP re…
yhirose Nov 26, 2025
ae407bd
Implement BodyReader::read() method and add corresponding tests for c…
yhirose Nov 26, 2025
cee57e5
Add ClientConnection and BodyReader structs with tests for socket str…
yhirose Nov 26, 2025
5472e95
Add open_stream_direct() method and tests for true streaming function…
yhirose Nov 26, 2025
f07bffe
Add HTTP client implementation with logging for chat API
yhirose Nov 26, 2025
6137446
Add SSL support for open_stream_direct() and corresponding tests
yhirose Nov 26, 2025
4c27441
Enhance BodyReader error handling with last_error tracking and add co…
yhirose Nov 26, 2025
0406daf
Add support for decompression in StreamHandle with tests for gzip, Br…
yhirose Nov 26, 2025
ad61419
Refactor streaming API: Replace open_stream_direct() with open_stream…
yhirose Nov 26, 2025
5921d1f
Add comprehensive tests for C++20 Streaming API in httplib
yhirose Nov 26, 2025
5a8fba4
Update README and examples to reflect changes from GetStream() to str…
yhirose Nov 27, 2025
66ee4ee
Add overloaded Get() functions to support query parameters and headers
yhirose Nov 27, 2025
cfcbee9
Add close_socket function to encapsulate socket closure logic
yhirose Nov 27, 2025
4792ead
Add GitHub Actions workflow for C++20 streaming tests and update CMak…
yhirose Nov 27, 2025
1fa9d88
Update README and remove read_all() method for improved streaming API…
yhirose Nov 27, 2025
3a42e93
Add read_error() and has_read_error() methods to enhance error handli…
yhirose Nov 27, 2025
5efefa9
Refactor code structure for improved readability and maintainability
yhirose Nov 27, 2025
1582bb2
Add unit tests for open_stream() functionality and mock stream implem…
yhirose Nov 27, 2025
c496094
Refactor streaming API tests and update Makefile for new test execution
yhirose Nov 27, 2025
f04beb8
Fix build error
yhirose Nov 27, 2025
b11c93a
Fix SSL problem with test-stream
yhirose Nov 27, 2025
51aa9c8
Fix C++ version check for coroutine support in MSVC
yhirose Nov 28, 2025
d6da0de
Check C++20 support and update test-stream executable configuration
yhirose Nov 28, 2025
647b2df
Improve C++20 support check in CMake for MSVC and enhance messaging
yhirose Nov 28, 2025
50abee2
Increase discovery timeout for C++20 streaming tests in CMake
yhirose Nov 28, 2025
e3c2376
Add debug step to list test executable before running C++20 streaming…
yhirose Nov 28, 2025
0dc42ed
Remove debug step for listing test executable in C++20 streaming tests
yhirose Nov 28, 2025
c41cb14
Run C++20 streaming tests directly instead of using ctest
yhirose Nov 28, 2025
b13a14c
Update build command for C++20 streaming tests to target specific exe…
yhirose Nov 28, 2025
ff34f68
Fix working directory for running C++20 streaming tests in GitHub Act…
yhirose Nov 28, 2025
93d37ec
Refactor CMakeLists.txt to streamline C++20 support checks for MSVC a…
yhirose Nov 28, 2025
e973890
Enhance StreamHandle API by adding get_read_error() and has_read_erro…
yhirose Nov 28, 2025
cd65cb2
Remove MockStream tests for StreamHandle and update socket handling l…
yhirose Nov 28, 2025
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
115 changes: 115 additions & 0 deletions .github/workflows/test-stream.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: test-stream

on:
push:
pull_request:
workflow_dispatch:
inputs:
gtest_filter:
description: 'Google Test filter'
test_linux:
description: 'Test on Linux'
type: boolean
default: true
test_macos:
description: 'Test on MacOS'
type: boolean
default: true
test_windows:
description: 'Test on Windows'
type: boolean
default: true

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true

env:
GTEST_FILTER: ${{ github.event.inputs.gtest_filter || '*' }}

jobs:
ubuntu:
runs-on: ubuntu-24.04
if: >
(github.event_name == 'push') ||
(github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.test_linux == 'true')
steps:
- name: checkout
uses: actions/checkout@v4
- name: install libraries
run: |
sudo apt-get update
sudo apt-get install -y libssl-dev libcurl4-openssl-dev \
zlib1g-dev libbrotli-dev libzstd-dev
- name: build and run C++20 streaming tests
run: cd test && make test-stream && ./test-stream --gtest_filter="${GTEST_FILTER}"

macos:
runs-on: macos-latest
if: >
(github.event_name == 'push') ||
(github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.test_macos == 'true')
steps:
- name: checkout
uses: actions/checkout@v4
- name: build and run C++20 streaming tests
run: cd test && make test-stream && ./test-stream --gtest_filter="${GTEST_FILTER}"

windows:
runs-on: windows-latest
if: >
(github.event_name == 'push') ||
(github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.test_windows == 'true')
strategy:
matrix:
config:
- with_ssl: false
name: without SSL
- with_ssl: true
name: with SSL
name: windows ${{ matrix.config.name }}
steps:
- name: Prepare Git for Checkout on Windows
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout
uses: actions/checkout@v4
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Setup msbuild on windows
uses: microsoft/setup-msbuild@v2
- name: Install vcpkg dependencies
run: vcpkg install gtest curl zlib brotli zstd
- name: Install OpenSSL
if: ${{ matrix.config.with_ssl }}
run: choco install openssl
- name: Configure CMake ${{ matrix.config.name }}
run: >
cmake -B build -S .
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake
-DHTTPLIB_TEST=ON
-DHTTPLIB_REQUIRE_ZLIB=ON
-DHTTPLIB_REQUIRE_BROTLI=ON
-DHTTPLIB_REQUIRE_ZSTD=ON
-DHTTPLIB_REQUIRE_OPENSSL=${{ matrix.config.with_ssl && 'ON' || 'OFF' }}
- name: Build ${{ matrix.config.name }}
run: cmake --build build --config Release --target httplib-test-stream
- name: Run C++20 streaming tests ${{ matrix.config.name }}
working-directory: build/test
run: Release\httplib-test-stream.exe

env:
VCPKG_ROOT: "C:/vcpkg"
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ example/benchmark
example/redirect
!example/redirect.*
example/ssecli
!example/ssecli.*
example/ssecli-stream
!example/ssecli-stream.*
example/ssesvr
!example/ssesvr.*
example/upload
!example/upload.*
example/one_time_request
Expand All @@ -29,6 +33,7 @@ example/*.pem
test/httplib.cc
test/httplib.h
test/test
test/test-stream
test/server_fuzzer
test/test_proxy
test/test_split
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ target_link_libraries(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC}
$<$<PLATFORM_ID:Windows>:crypt32>
# Needed for API from MacOS Security framework
"$<$<AND:$<PLATFORM_ID:Darwin>,$<BOOL:${HTTPLIB_IS_USING_OPENSSL}>,$<BOOL:${HTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN}>>:-framework CoreFoundation -framework Security>"
# Needed for non-blocking getaddrinfo on macOS
"$<$<AND:$<PLATFORM_ID:Darwin>,$<BOOL:${HTTPLIB_USE_NON_BLOCKING_GETADDRINFO}>>:-framework CoreFoundation -framework CFNetwork>"
# Can't put multiple targets in a single generator expression or it bugs out.
$<$<BOOL:${HTTPLIB_IS_USING_BROTLI}>:Brotli::common>
$<$<BOOL:${HTTPLIB_IS_USING_BROTLI}>:Brotli::encoder>
Expand Down
Loading
Loading