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
1 change: 0 additions & 1 deletion include/boost/http/concept/buffer_sink.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#ifndef BOOST_HTTP_CONCEPT_BUFFER_SINK_HPP
#define BOOST_HTTP_CONCEPT_BUFFER_SINK_HPP

#include <boost/capy/detail/config.hpp>
#include <boost/capy/buffers.hpp>
#include <boost/capy/concept/decomposes_to.hpp>
#include <boost/capy/concept/context_awaitable.hpp>
Expand Down
1 change: 0 additions & 1 deletion include/boost/http/concept/buffer_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#ifndef BOOST_HTTP_CONCEPT_BUFFER_SOURCE_HPP
#define BOOST_HTTP_CONCEPT_BUFFER_SOURCE_HPP

#include <boost/capy/detail/config.hpp>
#include <boost/capy/buffers.hpp>
#include <boost/capy/cond.hpp>
#include <boost/capy/concept/decomposes_to.hpp>
Expand Down
1 change: 0 additions & 1 deletion include/boost/http/concept/read_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#ifndef BOOST_HTTP_CONCEPT_READ_SOURCE_HPP
#define BOOST_HTTP_CONCEPT_READ_SOURCE_HPP

#include <boost/capy/detail/config.hpp>
#include <boost/capy/concept/buffer_archetype.hpp>
#include <boost/capy/concept/decomposes_to.hpp>
#include <boost/capy/concept/context_awaitable.hpp>
Expand Down
1 change: 0 additions & 1 deletion include/boost/http/concept/write_sink.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#ifndef BOOST_HTTP_CONCEPT_WRITE_SINK_HPP
#define BOOST_HTTP_CONCEPT_WRITE_SINK_HPP

#include <boost/capy/detail/config.hpp>
#include <boost/capy/concept/buffer_archetype.hpp>
#include <boost/capy/concept/decomposes_to.hpp>
#include <boost/capy/concept/context_awaitable.hpp>
Expand Down
30 changes: 30 additions & 0 deletions include/boost/http/detail/max_iovec.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// Copyright (c) 2026 Steve Gerbino
//
// 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)
//
// Official repository: https://github.com/cppalliance/http
//

#ifndef BOOST_HTTP_DETAIL_MAX_IOVEC_HPP
#define BOOST_HTTP_DETAIL_MAX_IOVEC_HPP

#include <cstddef>

namespace boost {
namespace http {
namespace detail {

// Buffers the sources, sinks and transfer loops hand on per call.
// POSIX guarantees an IOV_MAX of at least 16, so one window fits one
// vectored call on any backend. A larger window copies descriptors a
// backend may not use in that call, and each one adds 16 bytes to the
// awaiting frame.
inline constexpr std::size_t max_iovec_ = 16;

} // detail
} // http
} // boost

#endif
8 changes: 4 additions & 4 deletions include/boost/http/io/any_buffer_sink.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#ifndef BOOST_HTTP_IO_ANY_BUFFER_SINK_HPP
#define BOOST_HTTP_IO_ANY_BUFFER_SINK_HPP

#include <boost/capy/detail/config.hpp>
#include <boost/capy/detail/await_suspend_helper.hpp>
#include <boost/http/detail/max_iovec.hpp>
#include <boost/capy/buffers.hpp>
#include <boost/capy/buffers/buffer_copy.hpp>
#include <boost/http/io/buffer_param.hpp>
Expand Down Expand Up @@ -1052,7 +1052,7 @@ any_buffer_sink::write_some(CB buffers)
co_return co_await write_some_(src);

// Synthesized path: prepare + capy::buffer_copy + commit
capy::mutable_buffer arr[capy::detail::max_iovec_];
capy::mutable_buffer arr[detail::max_iovec_];
auto dst_bufs = prepare(arr);
if(dst_bufs.empty())
{
Expand Down Expand Up @@ -1103,7 +1103,7 @@ any_buffer_sink::write(CB buffers)
if(src.empty())
break;

capy::mutable_buffer arr[capy::detail::max_iovec_];
capy::mutable_buffer arr[detail::max_iovec_];
auto dst_bufs = prepare(arr);
if(dst_bufs.empty())
{
Expand Down Expand Up @@ -1224,7 +1224,7 @@ any_buffer_sink::write_eof(CB buffers)
if(src.empty())
break;

capy::mutable_buffer arr[capy::detail::max_iovec_];
capy::mutable_buffer arr[detail::max_iovec_];
auto dst_bufs = prepare(arr);
if(dst_bufs.empty())
{
Expand Down
6 changes: 3 additions & 3 deletions include/boost/http/io/any_buffer_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#ifndef BOOST_HTTP_IO_ANY_BUFFER_SOURCE_HPP
#define BOOST_HTTP_IO_ANY_BUFFER_SOURCE_HPP

#include <boost/capy/detail/config.hpp>
#include <boost/capy/detail/await_suspend_helper.hpp>
#include <boost/http/detail/max_iovec.hpp>
#include <boost/capy/buffers.hpp>
#include <boost/capy/buffers/buffer_copy.hpp>
#include <boost/http/io/buffer_param.hpp>
Expand Down Expand Up @@ -768,7 +768,7 @@ any_buffer_source::read_some(MB buffers)
co_return co_await read_some_(dest);

// Synthesized path: pull + capy::buffer_copy + consume
capy::const_buffer arr[capy::detail::max_iovec_];
capy::const_buffer arr[detail::max_iovec_];
auto [ec, bufs] = co_await pull(arr);
if(ec)
co_return {ec, 0};
Expand Down Expand Up @@ -810,7 +810,7 @@ any_buffer_source::read(MB buffers)
if(dest.empty())
break;

capy::const_buffer arr[capy::detail::max_iovec_];
capy::const_buffer arr[detail::max_iovec_];
auto [ec, bufs] = co_await pull(arr);

if(ec)
Expand Down
4 changes: 2 additions & 2 deletions include/boost/http/io/any_read_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#ifndef BOOST_HTTP_IO_ANY_READ_SOURCE_HPP
#define BOOST_HTTP_IO_ANY_READ_SOURCE_HPP

#include <boost/capy/detail/config.hpp>
#include <boost/capy/detail/await_suspend_helper.hpp>
#include <boost/http/detail/max_iovec.hpp>
#include <boost/capy/buffers.hpp>
#include <boost/capy/detail/buffer_array.hpp>
#include <boost/http/io/buffer_param.hpp>
Expand Down Expand Up @@ -473,7 +473,7 @@ any_read_source::read_some(MB buffers)
struct awaitable
{
any_read_source* self_;
capy::detail::mutable_buffer_array<capy::detail::max_iovec_> ba_;
capy::detail::mutable_buffer_array<detail::max_iovec_> ba_;

awaitable(any_read_source* self, MB const& buffers)
: self_(self)
Expand Down
4 changes: 2 additions & 2 deletions include/boost/http/io/any_write_sink.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#ifndef BOOST_HTTP_IO_ANY_WRITE_SINK_HPP
#define BOOST_HTTP_IO_ANY_WRITE_SINK_HPP

#include <boost/capy/detail/config.hpp>
#include <boost/capy/detail/await_suspend_helper.hpp>
#include <boost/http/detail/max_iovec.hpp>
#include <boost/capy/buffers.hpp>
#include <boost/capy/detail/buffer_array.hpp>
#include <boost/http/io/buffer_param.hpp>
Expand Down Expand Up @@ -799,7 +799,7 @@ any_write_sink::write_some(CB buffers)
struct awaitable
{
any_write_sink* self_;
capy::detail::const_buffer_array<capy::detail::max_iovec_> ba_;
capy::detail::const_buffer_array<detail::max_iovec_> ba_;

awaitable(
any_write_sink* self,
Expand Down
6 changes: 3 additions & 3 deletions include/boost/http/io/buffer_param.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#ifndef BOOST_HTTP_IO_BUFFER_PARAM_HPP
#define BOOST_HTTP_IO_BUFFER_PARAM_HPP

#include <boost/capy/detail/config.hpp>
#include <boost/http/detail/max_iovec.hpp>
#include <boost/capy/buffers.hpp>

#include <new>
Expand Down Expand Up @@ -151,7 +151,7 @@ class buffer_param
decltype(capy::buffer_sequence_end(std::declval<BS const&>())) end_;
union {
int dummy_;
buffer_type arr_[capy::detail::max_iovec_];
buffer_type arr_[detail::max_iovec_];
};
std::size_t size_ = 0;
std::size_t pos_ = 0;
Expand All @@ -161,7 +161,7 @@ class buffer_param
{
pos_ = 0;
size_ = 0;
for(; it_ != end_ && size_ < capy::detail::max_iovec_; ++it_)
for(; it_ != end_ && size_ < detail::max_iovec_; ++it_)
{
buffer_type buf(*it_);
if(buf.size() > 0)
Expand Down
6 changes: 3 additions & 3 deletions include/boost/http/io/pull_from.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#ifndef BOOST_HTTP_IO_PULL_FROM_HPP
#define BOOST_HTTP_IO_PULL_FROM_HPP

#include <boost/capy/detail/config.hpp>
#include <boost/http/detail/max_iovec.hpp>
#include <boost/capy/buffers.hpp>
#include <boost/capy/cond.hpp>
#include <boost/http/concept/buffer_sink.hpp>
Expand Down Expand Up @@ -64,7 +64,7 @@ template<ReadSource Src, BufferSink Sink>
capy::task<capy::results<std::size_t>>
pull_from(Src& source, Sink& sink)
{
capy::mutable_buffer dst_arr[capy::detail::max_iovec_];
capy::mutable_buffer dst_arr[detail::max_iovec_];
std::size_t total = 0;

for(;;)
Expand Down Expand Up @@ -144,7 +144,7 @@ template<capy::ReadStream Src, BufferSink Sink>
capy::task<capy::results<std::size_t>>
pull_from(Src& source, Sink& sink)
{
capy::mutable_buffer dst_arr[capy::detail::max_iovec_];
capy::mutable_buffer dst_arr[detail::max_iovec_];
std::size_t total = 0;

for(;;)
Expand Down
6 changes: 3 additions & 3 deletions include/boost/http/io/push_to.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#ifndef BOOST_HTTP_IO_PUSH_TO_HPP
#define BOOST_HTTP_IO_PUSH_TO_HPP

#include <boost/capy/detail/config.hpp>
#include <boost/http/detail/max_iovec.hpp>
#include <boost/capy/buffers.hpp>
#include <boost/capy/cond.hpp>
#include <boost/http/concept/buffer_source.hpp>
Expand Down Expand Up @@ -63,7 +63,7 @@ template<BufferSource Src, WriteSink Sink>
capy::task<capy::results<std::size_t>>
push_to(Src& source, Sink& sink)
{
capy::const_buffer arr[capy::detail::max_iovec_];
capy::const_buffer arr[detail::max_iovec_];
std::size_t total = 0;

for(;;)
Expand Down Expand Up @@ -128,7 +128,7 @@ template<BufferSource Src, capy::WriteStream Stream>
capy::task<capy::results<std::size_t>>
push_to(Src& source, Stream& stream)
{
capy::const_buffer arr[capy::detail::max_iovec_];
capy::const_buffer arr[detail::max_iovec_];
std::size_t total = 0;

for(;;)
Expand Down
3 changes: 1 addition & 2 deletions include/boost/http/test/buffer_sink.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#ifndef BOOST_HTTP_TEST_BUFFER_SINK_HPP
#define BOOST_HTTP_TEST_BUFFER_SINK_HPP

#include <boost/capy/detail/config.hpp>
#include <boost/capy/buffers.hpp>
#include <boost/capy/buffers/make_buffer.hpp>
#include <coroutine>
Expand Down Expand Up @@ -172,7 +171,7 @@ class buffer_sink

// The operation completes synchronously, but await_suspend is
// the only place capy::await_context is delivered (the promise's
// transform_awaiter forwards it here). Returning false means
// awaiter forwards it here). Returning false means
// the coroutine does not actually suspend; it resumes
// immediately, having observed the stop token. See capy::await_context,
// ContextAwaitable.
Expand Down
3 changes: 1 addition & 2 deletions include/boost/http/test/buffer_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#ifndef BOOST_HTTP_TEST_BUFFER_SOURCE_HPP
#define BOOST_HTTP_TEST_BUFFER_SOURCE_HPP

#include <boost/capy/detail/config.hpp>
#include <boost/capy/buffers.hpp>
#include <boost/capy/buffers/make_buffer.hpp>
#include <coroutine>
Expand Down Expand Up @@ -162,7 +161,7 @@ class buffer_source

// The operation completes synchronously, but await_suspend is
// the only place capy::await_context is delivered (the promise's
// transform_awaiter forwards it here). Returning false means
// awaiter forwards it here). Returning false means
// the coroutine does not actually suspend; it resumes
// immediately, having observed the stop token. See capy::await_context,
// ContextAwaitable.
Expand Down
3 changes: 1 addition & 2 deletions include/boost/http/test/read_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#ifndef BOOST_HTTP_TEST_READ_SOURCE_HPP
#define BOOST_HTTP_TEST_READ_SOURCE_HPP

#include <boost/capy/detail/config.hpp>
#include <boost/capy/buffers.hpp>
#include <boost/capy/buffers/buffer_copy.hpp>
#include <boost/capy/buffers/make_buffer.hpp>
Expand Down Expand Up @@ -146,7 +145,7 @@ class read_source

// The operation completes synchronously, but await_suspend is
// the only place capy::await_context is delivered (the promise's
// transform_awaiter forwards it here). Returning false means
// awaiter forwards it here). Returning false means
// the coroutine does not actually suspend; it resumes
// immediately, having observed the stop token. See capy::await_context,
// ContextAwaitable.
Expand Down
3 changes: 1 addition & 2 deletions include/boost/http/test/write_sink.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#ifndef BOOST_HTTP_TEST_WRITE_SINK_HPP
#define BOOST_HTTP_TEST_WRITE_SINK_HPP

#include <boost/capy/detail/config.hpp>
#include <boost/capy/buffers.hpp>
#include <boost/capy/buffers/buffer_copy.hpp>
#include <boost/capy/buffers/make_buffer.hpp>
Expand Down Expand Up @@ -179,7 +178,7 @@ class write_sink

// The operation completes synchronously, but await_suspend is
// the only place capy::await_context is delivered (the promise's
// transform_awaiter forwards it here). Returning false means
// awaiter forwards it here). Returning false means
// the coroutine does not actually suspend; it resumes
// immediately, having observed the stop token. See capy::await_context,
// ContextAwaitable.
Expand Down
Loading
Loading