mirror of
https://github.com/boostorg/beast.git
synced 2025-08-03 23:04:35 +02:00
Rename some basic_parser observers (API Change):
Some `basic_parser` member functions are renamed: * chunked() was is_chunked() * upgrade() was is_upgrade() * keep_alive() was is_keep_alive() Actions Required: * Rename member function invocations at call sites
This commit is contained in:
@@ -8,12 +8,14 @@ API Changes:
|
|||||||
* Remove serializer::chunked
|
* Remove serializer::chunked
|
||||||
* Add has_content_length_impl to Fields
|
* Add has_content_length_impl to Fields
|
||||||
* Add message::has_content_length
|
* Add message::has_content_length
|
||||||
|
* Rename some basic_parser observers
|
||||||
|
|
||||||
Actions Required:
|
Actions Required:
|
||||||
|
|
||||||
* Call message::keep_alive instead of serializer::keep_alive
|
* Call message::keep_alive instead of serializer::keep_alive
|
||||||
* Call serializer::get::chunked instead of serializer::chunked
|
* Call serializer::get::chunked instead of serializer::chunked
|
||||||
* Implement has_content_length_impl for user-defined Fields
|
* Implement has_content_length_impl for user-defined Fields
|
||||||
|
* Remove the "is_" prefix from call sites invoking certain basic_parser members
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@@ -319,7 +319,7 @@ public:
|
|||||||
@ref is_header_done would return `true`.
|
@ref is_header_done would return `true`.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
is_upgrade() const
|
upgrade() const
|
||||||
{
|
{
|
||||||
return (f_ & flagConnectionUpgrade) != 0;
|
return (f_ & flagConnectionUpgrade) != 0;
|
||||||
}
|
}
|
||||||
@@ -330,18 +330,21 @@ public:
|
|||||||
@ref is_header_done would return `true`.
|
@ref is_header_done would return `true`.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
is_chunked() const
|
chunked() const
|
||||||
{
|
{
|
||||||
return (f_ & flagChunked) != 0;
|
return (f_ & flagChunked) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns `true` if the message has keep-alive connection semantics.
|
/** Returns `true` if the message has keep-alive connection semantics.
|
||||||
|
|
||||||
|
This function always returns `false` if @ref need_eof would return
|
||||||
|
`false`.
|
||||||
|
|
||||||
@note The return value is undefined unless
|
@note The return value is undefined unless
|
||||||
@ref is_header_done would return `true`.
|
@ref is_header_done would return `true`.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
is_keep_alive() const;
|
keep_alive() const;
|
||||||
|
|
||||||
/** Returns the optional value of Content-Length if known.
|
/** Returns the optional value of Content-Length if known.
|
||||||
|
|
||||||
|
@@ -57,7 +57,7 @@ basic_parser(basic_parser<
|
|||||||
template<bool isRequest, class Derived>
|
template<bool isRequest, class Derived>
|
||||||
bool
|
bool
|
||||||
basic_parser<isRequest, Derived>::
|
basic_parser<isRequest, Derived>::
|
||||||
is_keep_alive() const
|
keep_alive() const
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(is_header_done());
|
BOOST_ASSERT(is_header_done());
|
||||||
if(f_ & flagHTTP11)
|
if(f_ & flagHTTP11)
|
||||||
|
@@ -96,13 +96,13 @@ public:
|
|||||||
operator()(Parser const& p) const
|
operator()(Parser const& p) const
|
||||||
{
|
{
|
||||||
if(flags_ & parse_flag::chunked)
|
if(flags_ & parse_flag::chunked)
|
||||||
s_.BEAST_EXPECT(p.is_chunked());
|
s_.BEAST_EXPECT(p.chunked());
|
||||||
if(flags_ & parse_flag::connection_keep_alive)
|
if(flags_ & parse_flag::connection_keep_alive)
|
||||||
s_.BEAST_EXPECT(p.is_keep_alive());
|
s_.BEAST_EXPECT(p.keep_alive());
|
||||||
if(flags_ & parse_flag::connection_close)
|
if(flags_ & parse_flag::connection_close)
|
||||||
s_.BEAST_EXPECT(! p.is_keep_alive());
|
s_.BEAST_EXPECT(! p.keep_alive());
|
||||||
if(flags_ & parse_flag::upgrade)
|
if(flags_ & parse_flag::upgrade)
|
||||||
s_.BEAST_EXPECT(! p.is_upgrade());
|
s_.BEAST_EXPECT(! p.upgrade());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ public:
|
|||||||
void
|
void
|
||||||
operator()(Parser const& p) const
|
operator()(Parser const& p) const
|
||||||
{
|
{
|
||||||
s_.BEAST_EXPECT(p.is_keep_alive() == v_);
|
s_.BEAST_EXPECT(p.keep_alive() == v_);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -784,7 +784,7 @@ public:
|
|||||||
"\r\n",
|
"\r\n",
|
||||||
[&](P const& p)
|
[&](P const& p)
|
||||||
{
|
{
|
||||||
BEAST_EXPECT(p.is_upgrade());
|
BEAST_EXPECT(p.upgrade());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -129,7 +129,7 @@ public:
|
|||||||
[&](parser_type<false> const& p)
|
[&](parser_type<false> const& p)
|
||||||
{
|
{
|
||||||
auto const& m = p.get();
|
auto const& m = p.get();
|
||||||
BEAST_EXPECT(! p.is_chunked());
|
BEAST_EXPECT(! p.chunked());
|
||||||
BEAST_EXPECT(p.need_eof());
|
BEAST_EXPECT(p.need_eof());
|
||||||
BEAST_EXPECT(p.content_length() == boost::none);
|
BEAST_EXPECT(p.content_length() == boost::none);
|
||||||
BEAST_EXPECT(m.version() == 10);
|
BEAST_EXPECT(m.version() == 10);
|
||||||
@@ -157,7 +157,7 @@ public:
|
|||||||
{
|
{
|
||||||
auto const& m = p.get();
|
auto const& m = p.get();
|
||||||
BEAST_EXPECT(! p.need_eof());
|
BEAST_EXPECT(! p.need_eof());
|
||||||
BEAST_EXPECT(p.is_chunked());
|
BEAST_EXPECT(p.chunked());
|
||||||
BEAST_EXPECT(p.content_length() == boost::none);
|
BEAST_EXPECT(p.content_length() == boost::none);
|
||||||
BEAST_EXPECT(m.version() == 11);
|
BEAST_EXPECT(m.version() == 11);
|
||||||
BEAST_EXPECT(m.result() == status::ok);
|
BEAST_EXPECT(m.result() == status::ok);
|
||||||
@@ -192,7 +192,7 @@ public:
|
|||||||
BEAST_EXPECT(m.target() == "/");
|
BEAST_EXPECT(m.target() == "/");
|
||||||
BEAST_EXPECT(m.version() == 11);
|
BEAST_EXPECT(m.version() == 11);
|
||||||
BEAST_EXPECT(! p.need_eof());
|
BEAST_EXPECT(! p.need_eof());
|
||||||
BEAST_EXPECT(! p.is_chunked());
|
BEAST_EXPECT(! p.chunked());
|
||||||
BEAST_EXPECT(p.content_length() == boost::none);
|
BEAST_EXPECT(p.content_length() == boost::none);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user