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
3 changes: 2 additions & 1 deletion include/boost/http_proto.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#include <boost/http_proto/rfc/upgrade_rule.hpp>

#include <boost/http_proto/service/service.hpp>
#include <boost/http_proto/service/zlib_service.hpp>
#include <boost/http_proto/service/deflate_service.hpp>
#include <boost/http_proto/service/inflate_service.hpp>

#endif
10 changes: 10 additions & 0 deletions include/boost/http_proto/detail/workspace.hpp
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -128,6 +129,15 @@ class workspace
reserve_front(
std::size_t n);

/** Convert unused storage to reserved storage.

@return nullptr if n >= this->size()
*/
BOOST_HTTP_PROTO_DECL
unsigned char*
try_reserve_front(
std::size_t n) noexcept;

template<class T, class... Args>
typename std::decay<T>::type&
emplace(Args&&... args);
Expand Down
5 changes: 1 addition & 4 deletions include/boost/http_proto/message_view_base.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//
// Copyright (c) 2021 Vinnie Falco (vinnie.falco@gmail.com)
// Copyright (c) 2024 Christian Mazakas
// 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)
Expand All @@ -13,10 +14,6 @@

#include <boost/http_proto/detail/config.hpp>
#include <boost/http_proto/fields_view_base.hpp>
#include <boost/url/grammar/recycled.hpp>
#include <boost/url/grammar/type_traits.hpp>
#include <memory>
#include <string>

namespace boost {
namespace http_proto {
Expand Down
6 changes: 4 additions & 2 deletions include/boost/http_proto/parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ class parser
to @ref parse completes with an error code
equal to @ref condition::need_more_input.

@returns A non-empty mutable buffer.
@return A non-empty mutable buffer.

@see
@ref commit,
Expand Down Expand Up @@ -535,6 +535,8 @@ class parser
private:
friend class request_parser;
friend class response_parser;
friend class parser_service;
class filter;

BOOST_HTTP_PROTO_DECL
parser(context&, detail::kind);
Expand Down Expand Up @@ -602,7 +604,7 @@ class parser
buffers::mutable_buffer_pair mbp_;
buffers::const_buffer_pair cbp_;

detail::filter* filter_;
filter* filter_;
buffers::any_dynamic_buffer* eb_;
sink* sink_;

Expand Down
9 changes: 3 additions & 6 deletions include/boost/http_proto/serializer.hpp
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -24,7 +25,6 @@
#include <boost/buffers/type_traits.hpp>
#include <boost/system/result.hpp>

#include <memory>
#include <numeric>
#include <type_traits>
#include <utility>
Expand All @@ -34,9 +34,6 @@ namespace http_proto {

#ifndef BOOST_HTTP_PROTO_DOCS
class message_view_base;
namespace detail {
class filter;
} // namespace detail
#endif

/** A serializer for HTTP/1 messages
Expand Down Expand Up @@ -219,8 +216,8 @@ class serializer
consume(std::size_t n);

private:
class filter;
class const_buf_gen_base;

template<class>
class const_buf_gen;

Expand Down Expand Up @@ -288,7 +285,7 @@ class serializer
detail::workspace ws_;

const_buf_gen_base* buf_gen_;
detail::filter* filter_;
filter* filter_;
source* source_;

buffers::circular_buffer cb0_;
Expand Down
31 changes: 17 additions & 14 deletions include/boost/http_proto/service/deflate_service.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,26 @@ namespace zlib {

/** Provides the ZLib compression API
*/
struct deflate_service

struct BOOST_SYMBOL_VISIBLE
deflate_service
: public http_proto::service
{
virtual char const* version() const noexcept = 0;
virtual int init(stream_t& st, int level) const = 0;
virtual int init2(stream_t& st, int level, int method,
virtual int init(stream& st, int level) const = 0;
virtual int init2(stream& st, int level, int method,
int windowBits, int memLevel, int strategy) const = 0;
virtual int set_dict(stream_t& st, unsigned char const* dict, unsigned len) const = 0;
virtual int get_dict(stream_t& st, unsigned char* dest, unsigned* len) const = 0;
virtual int dup(stream_t& dest, stream_t& src) const = 0;
virtual int deflate(stream_t& st, int flush) const = 0;
virtual int deflate_end(stream_t& st) const = 0;
virtual int reset(stream_t& st) const = 0;
virtual int params(stream_t& st, int level, int strategy) const = 0;
virtual std::size_t bound(stream_t& st, unsigned long sourceLen) const = 0;
virtual int pending(stream_t& st, unsigned* pending, int* bits) const = 0;
virtual int prime(stream_t& st, int bits, int value) const = 0;
virtual int set_header(stream_t& st, void* header) const = 0;
virtual int set_dict(stream& st, unsigned char const* dict, unsigned len) const = 0;
virtual int get_dict(stream& st, unsigned char* dest, unsigned* len) const = 0;
virtual int dup(stream& dest, stream& src) const = 0;
virtual int deflate(stream& st, int flush) const = 0;
virtual int deflate_end(stream& st) const = 0;
virtual int reset(stream& st) const = 0;
virtual int params(stream& st, int level, int strategy) const = 0;
virtual std::size_t bound(stream& st, unsigned long sourceLen) const = 0;
virtual int pending(stream& st, unsigned* pending, int* bits) const = 0;
virtual int prime(stream& st, int bits, int value) const = 0;
virtual int set_header(stream& st, void* header) const = 0;
};

BOOST_HTTP_PROTO_ZLIB_DECL
Expand Down
35 changes: 19 additions & 16 deletions include/boost/http_proto/service/inflate_service.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// Copyright (c) 2025 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)
Expand All @@ -19,24 +20,26 @@ namespace zlib {

/** Provides the ZLib decompression API
*/
struct inflate_service
struct BOOST_SYMBOL_VISIBLE
inflate_service
: public http_proto::service
{
virtual char const* version() const noexcept = 0;
virtual int init(stream_t& st) const = 0;
virtual int init2(stream_t& st, int windowBits) const = 0;
virtual int inflate(stream_t& st, int flush) const = 0;
virtual int inflate_end(stream_t& st) const = 0;
virtual int set_dict(stream_t& st, unsigned char const* dict, unsigned len) const = 0;
virtual int get_dict(stream_t& st, unsigned char* dest, unsigned* len) const = 0;
virtual int sync(stream_t& st) const = 0;
virtual int dup(stream_t& dest, stream_t& src) const = 0;
virtual int reset(stream_t& st) const = 0;
virtual int reset2(stream_t& st, int windowBits) const = 0;
virtual int prime(stream_t& st, int bits, int value) const = 0;
virtual long mark(stream_t& st) const = 0;
virtual int get_header(stream_t& st, void* header) const = 0;
virtual int back_init(stream_t& st, int windowBits, unsigned char* window) const = 0;
virtual int back_end(stream_t& st) const = 0;
virtual int init(stream& st) const = 0;
virtual int init2(stream& st, int windowBits) const = 0;
virtual int inflate(stream& st, int flush) const = 0;
virtual int inflate_end(stream& st) const = 0;
virtual int set_dict(stream& st, unsigned char const* dict, unsigned len) const = 0;
virtual int get_dict(stream& st, unsigned char* dest, unsigned* len) const = 0;
virtual int sync(stream& st) const = 0;
virtual int dup(stream& dest, stream& src) const = 0;
virtual int reset(stream& st) const = 0;
virtual int reset2(stream& st, int windowBits) const = 0;
virtual int prime(stream& st, int bits, int value) const = 0;
virtual long mark(stream& st) const = 0;
virtual int get_header(stream& st, void* header) const = 0;
virtual int back_init(stream& st, int windowBits, unsigned char* window) const = 0;
virtual int back_end(stream& st) const = 0;
virtual unsigned long compile_flags() const = 0;
};

Expand Down
Loading
Loading