Skip to content
Merged
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
49 changes: 44 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ name: CI

on:
pull_request:
branches: [ master, develop, develop-2 ]
branches: [ master, develop* ]
workflow_dispatch:
push:
branches:
- master
- develop
- develop-2
- develop*
- bugfix/**
- feature/**
- fix/**
Expand Down Expand Up @@ -96,11 +95,31 @@ jobs:
liburing-dev
curl zip unzip tar pkg-config

# Use the capy branch with the same name as this build's branch
# (for pull requests: the source branch, then the target branch);
# fall back to capy's default branch.
- name: Resolve Capy branch
id: capy-ref
shell: bash
run: |
url=https://github.com/cppalliance/capy.git
ref=
for candidate in "${{ github.head_ref }}" "${{ github.base_ref }}" "${{ github.ref_name }}"; do
if [ -n "$candidate" ] && git ls-remote --exit-code --heads "$url" "$candidate" > /dev/null; then
ref="$candidate"
break
fi
done
if [ -z "$ref" ]; then
ref=$(git ls-remote --symref "$url" HEAD | awk '/^ref:/ { sub("refs/heads/", "", $2); print $2 }')
fi
echo "ref=$ref" >> "$GITHUB_OUTPUT"

- name: Clone Capy
uses: actions/checkout@v4
with:
repository: cppalliance/capy
ref: ${{ (github.ref_name == 'master' && github.ref_name) || 'develop' }}
ref: ${{ steps.capy-ref.outputs.ref }}
path: capy-root

# Test dependency of corosio
Expand Down Expand Up @@ -768,11 +787,31 @@ jobs:
with:
path: corosio-root

# Use the capy branch with the same name as this build's branch
# (for pull requests: the source branch, then the target branch);
# fall back to capy's default branch.
- name: Resolve Capy branch
id: capy-ref
shell: bash
run: |
url=https://github.com/cppalliance/capy.git
ref=
for candidate in "${{ github.head_ref }}" "${{ github.base_ref }}" "${{ github.ref_name }}"; do
if [ -n "$candidate" ] && git ls-remote --exit-code --heads "$url" "$candidate" > /dev/null; then
ref="$candidate"
break
fi
done
if [ -z "$ref" ]; then
ref=$(git ls-remote --symref "$url" HEAD | awk '/^ref:/ { sub("refs/heads/", "", $2); print $2 }')
fi
echo "ref=$ref" >> "$GITHUB_OUTPUT"

- name: Clone Capy
uses: actions/checkout@v4
with:
repository: cppalliance/capy
ref: ${{ (github.ref_name == 'master' && github.ref_name) || 'develop' }}
ref: ${{ steps.capy-ref.outputs.ref }}
path: capy-root

- name: Clone Boost
Expand Down
46 changes: 43 additions & 3 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on:
push:
branches:
- master
- develop
- develop*
paths:
- 'src/**'
- 'include/**'
Expand Down Expand Up @@ -150,11 +150,31 @@ jobs:
echo "CMAKE_WOLFSSL_INCLUDE=${vcpkg_installed}/include" >> $GITHUB_ENV
echo "CMAKE_WOLFSSL_LIBRARY=${vcpkg_installed}/lib/libwolfssl.a" >> $GITHUB_ENV

# Use the capy branch with the same name as this build's branch
# (for pull requests: the source branch, then the target branch);
# fall back to capy's default branch.
- name: Resolve Capy branch
id: capy-ref
shell: bash
run: |
url=https://github.com/cppalliance/capy.git
ref=
for candidate in "${{ github.head_ref }}" "${{ github.base_ref }}" "${{ github.ref_name }}"; do
if [ -n "$candidate" ] && git ls-remote --exit-code --heads "$url" "$candidate" > /dev/null; then
ref="$candidate"
break
fi
done
if [ -z "$ref" ]; then
ref=$(git ls-remote --symref "$url" HEAD | awk '/^ref:/ { sub("refs/heads/", "", $2); print $2 }')
fi
echo "ref=$ref" >> "$GITHUB_OUTPUT"

- name: Clone Capy
uses: actions/checkout@v6
with:
repository: cppalliance/capy
ref: ${{ (github.ref_name == 'master' && github.ref_name) || 'develop' }}
ref: ${{ steps.capy-ref.outputs.ref }}
path: capy-root

- name: Clone Boost
Expand Down Expand Up @@ -371,11 +391,31 @@ jobs:
echo "CMAKE_WOLFSSL_LIBRARY=${vcpkg_installed}/lib/libwolfssl.a" >> $GITHUB_ENV
echo "CMAKE_OPENSSL_ROOT=C:/msys64/mingw64" >> $GITHUB_ENV

# Use the capy branch with the same name as this build's branch
# (for pull requests: the source branch, then the target branch);
# fall back to capy's default branch.
- name: Resolve Capy branch
id: capy-ref
shell: bash
run: |
url=https://github.com/cppalliance/capy.git
ref=
for candidate in "${{ github.head_ref }}" "${{ github.base_ref }}" "${{ github.ref_name }}"; do
if [ -n "$candidate" ] && git ls-remote --exit-code --heads "$url" "$candidate" > /dev/null; then
ref="$candidate"
break
fi
done
if [ -z "$ref" ]; then
ref=$(git ls-remote --symref "$url" HEAD | awk '/^ref:/ { sub("refs/heads/", "", $2); print $2 }')
fi
echo "ref=$ref" >> "$GITHUB_OUTPUT"

- name: Clone Capy
uses: actions/checkout@v6
with:
repository: cppalliance/capy
ref: ${{ (github.ref_name == 'master' && github.ref_name) || 'develop' }}
ref: ${{ steps.capy-ref.outputs.ref }}
path: capy-root

- name: Clone Boost
Expand Down
24 changes: 22 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
push:
branches:
- master
- develop
- develop*
paths:
- 'doc/**'
- '*.adoc'
Expand Down Expand Up @@ -42,11 +42,31 @@ jobs:
with:
path: corosio-root

# Use the capy branch with the same name as this build's branch
# (for pull requests: the source branch, then the target branch);
# fall back to capy's default branch.
- name: Resolve Capy branch
id: capy-ref
shell: bash
run: |
url=https://github.com/cppalliance/capy.git
ref=
for candidate in "${{ github.head_ref }}" "${{ github.base_ref }}" "${{ github.ref_name }}"; do
if [ -n "$candidate" ] && git ls-remote --exit-code --heads "$url" "$candidate" > /dev/null; then
ref="$candidate"
break
fi
done
if [ -z "$ref" ]; then
ref=$(git ls-remote --symref "$url" HEAD | awk '/^ref:/ { sub("refs/heads/", "", $2); print $2 }')
fi
echo "ref=$ref" >> "$GITHUB_OUTPUT"

- name: Clone Capy
uses: actions/checkout@v4
with:
repository: cppalliance/capy
ref: ${{ (github.ref_name == 'master' && github.ref_name) || 'develop' }}
ref: ${{ steps.capy-ref.outputs.ref }}
path: capy-root

- name: Clone Boost
Expand Down
22 changes: 15 additions & 7 deletions example/client/http_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <boost/capy/task.hpp>
#include <boost/capy/ex/run_async.hpp>
#include <boost/capy/buffers.hpp>
#include <boost/capy/buffers/string_dynamic_buffer.hpp>
#include <boost/capy/error.hpp>
#include <boost/capy/read.hpp>
#include <boost/capy/write.hpp>
Expand Down Expand Up @@ -40,13 +39,22 @@ do_request(
stream, capy::const_buffer(request.data(), request.size())); ec)
throw std::system_error(ec);

// Read the entire response until EOF
// Read the entire response until EOF, one fixed chunk at a time
std::string response;
auto [ec, n] = co_await capy::read(
stream, capy::string_dynamic_buffer(&response));
// EOF is expected when server closes connection
if (ec && ec != capy::error::eof)
throw std::system_error(ec);
for (;;)
{
char chunk[4096];
auto [ec, n] = co_await capy::read(
stream, capy::mutable_buffer(chunk, sizeof(chunk)));
response.append(chunk, n);
if (ec)
{
// EOF is expected when the server closes the connection
if (ec != capy::error::eof)
throw std::system_error(ec);
break;
}
}

std::cout << response << std::endl;
}
Expand Down
22 changes: 15 additions & 7 deletions example/https-client/https_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <boost/capy/task.hpp>
#include <boost/capy/ex/run_async.hpp>
#include <boost/capy/buffers.hpp>
#include <boost/capy/buffers/string_dynamic_buffer.hpp>
#include <boost/capy/error.hpp>
#include <boost/capy/read.hpp>
#include <boost/capy/write.hpp>
Expand Down Expand Up @@ -42,13 +41,22 @@ do_request(
stream, capy::const_buffer(request.data(), request.size())); ec)
throw std::system_error(ec);

// Read entire response until EOF
// Read the entire response until EOF, one fixed chunk at a time
std::string response;
auto [ec, n] = co_await capy::read(
stream, capy::string_dynamic_buffer(&response));
// EOF is expected when server closes connection
if (ec && ec != capy::error::eof)
throw std::system_error(ec);
for (;;)
{
char chunk[4096];
auto [ec, n] = co_await capy::read(
stream, capy::mutable_buffer(chunk, sizeof(chunk)));
response.append(chunk, n);
if (ec)
{
// EOF is expected when the server closes the connection
if (ec != capy::error::eof)
throw std::system_error(ec);
break;
}
}

std::cout << response << std::endl;
}
Expand Down
122 changes: 0 additions & 122 deletions include/boost/corosio/detail/continuation_op.hpp

This file was deleted.

Loading
Loading