Skip to content

Commit 7432375

Browse files
committed
parser and serializer take const reference to rts::context
1 parent d8d3efe commit 7432375

7 files changed

Lines changed: 18 additions & 18 deletions

File tree

include/boost/http_proto/parser.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ class parser
646646

647647
BOOST_HTTP_PROTO_DECL
648648
parser(
649-
rts::context&,
649+
const rts::context&,
650650
detail::kind);
651651

652652
BOOST_HTTP_PROTO_DECL
@@ -693,7 +693,7 @@ class parser
693693
elastic,
694694
};
695695

696-
rts::context& ctx_;
696+
const rts::context& ctx_;
697697
detail::parser_service& svc_;
698698

699699
detail::workspace ws_;

include/boost/http_proto/request_parser.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class request_parser
8484
*/
8585
BOOST_HTTP_PROTO_DECL
8686
explicit
87-
request_parser(rts::context& ctx);
87+
request_parser(const rts::context& ctx);
8888

8989
/// @copydoc parser
9090
~request_parser() = default;

include/boost/http_proto/response_parser.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class response_parser
8484
*/
8585
BOOST_HTTP_PROTO_DECL
8686
explicit
87-
response_parser(rts::context& ctx);
87+
response_parser(const rts::context& ctx);
8888

8989
/// @copydoc parser::~parser
9090
~response_parser() = default;

src/parser.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ class zlib_filter
304304

305305
public:
306306
zlib_filter(
307-
rts::context& ctx,
307+
const rts::context& ctx,
308308
http_proto::detail::workspace& ws,
309309
int window_bits)
310310
: zlib_filter_base(ws)
@@ -354,7 +354,7 @@ class brotli_filter
354354

355355
public:
356356
brotli_filter(
357-
rts::context& ctx,
357+
const rts::context& ctx,
358358
http_proto::detail::workspace&)
359359
: svc_(ctx.get_service<rts::brotli::decode_service>())
360360
{
@@ -420,7 +420,7 @@ class parser_service
420420
std::size_t max_codec = 0;
421421

422422
parser_service(
423-
rts::context&,
423+
const rts::context&,
424424
parser::config_base const& cfg_)
425425
: cfg(cfg_)
426426
{
@@ -519,7 +519,7 @@ install_parser_service(
519519
//------------------------------------------------
520520

521521
parser::
522-
parser(rts::context& ctx, detail::kind k)
522+
parser(const rts::context& ctx, detail::kind k)
523523
: ctx_(ctx)
524524
, svc_(ctx.get_service<detail::parser_service>())
525525
, ws_(svc_.space_needed)

src/request_parser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace http_proto {
1414

1515
request_parser::
1616
request_parser(
17-
rts::context& ctx)
17+
const rts::context& ctx)
1818
: parser(
1919
ctx,
2020
detail::kind::request)

src/response_parser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace http_proto {
1414

1515
response_parser::
1616
response_parser(
17-
rts::context& ctx)
17+
const rts::context& ctx)
1818
: parser(
1919
ctx,
2020
detail::kind::response)

src/serializer.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,13 @@ class zlib_filter
9494

9595
public:
9696
zlib_filter(
97-
const rts::context* ctx,
97+
const rts::context& ctx,
9898
http_proto::detail::workspace& ws,
9999
int comp_level,
100100
int window_bits,
101101
int mem_level)
102102
: zlib_filter_base(ws)
103-
, svc_(ctx->get_service<rts::zlib::deflate_service>())
103+
, svc_(ctx.get_service<rts::zlib::deflate_service>())
104104
{
105105
system::error_code ec = static_cast<rts::zlib::error>(svc_.init2(
106106
strm_,
@@ -160,11 +160,11 @@ class brotli_filter
160160

161161
public:
162162
brotli_filter(
163-
const rts::context* ctx,
163+
const rts::context& ctx,
164164
http_proto::detail::workspace&,
165165
std::uint32_t comp_quality,
166166
std::uint32_t comp_window)
167-
: svc_(ctx->get_service<rts::brotli::encode_service>())
167+
: svc_(ctx.get_service<rts::brotli::encode_service>())
168168
{
169169
// TODO: use custom allocator
170170
state_ = svc_.create_instance(nullptr, nullptr, nullptr);
@@ -242,7 +242,7 @@ class serializer_service
242242
std::size_t space_needed = 0;
243243

244244
serializer_service(
245-
rts::context&,
245+
const rts::context&,
246246
serializer::config const& cfg_)
247247
: cfg(cfg_)
248248
{
@@ -719,7 +719,7 @@ start_init(
719719
if(!svc_->cfg.apply_deflate_encoder)
720720
goto no_filter;
721721
filter_ = &ws_.emplace<zlib_filter>(
722-
ctx_,
722+
*ctx_,
723723
ws_,
724724
svc_->cfg.zlib_comp_level,
725725
svc_->cfg.zlib_window_bits,
@@ -731,7 +731,7 @@ start_init(
731731
if(!svc_->cfg.apply_gzip_encoder)
732732
goto no_filter;
733733
filter_ = &ws_.emplace<zlib_filter>(
734-
ctx_,
734+
*ctx_,
735735
ws_,
736736
svc_->cfg.zlib_comp_level,
737737
svc_->cfg.zlib_window_bits + 16,
@@ -743,7 +743,7 @@ start_init(
743743
if(!svc_->cfg.apply_brotli_encoder)
744744
goto no_filter;
745745
filter_ = &ws_.emplace<brotli_filter>(
746-
ctx_,
746+
*ctx_,
747747
ws_,
748748
svc_->cfg.brotli_comp_quality,
749749
svc_->cfg.brotli_comp_window);

0 commit comments

Comments
 (0)