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:
Vinnie Falco
2017-10-25 18:04:54 -07:00
parent 6225c5bd2f
commit 5c14ab9f7c
5 changed files with 18 additions and 13 deletions

View File

@@ -8,12 +8,14 @@ API Changes:
* Remove serializer::chunked
* Add has_content_length_impl to Fields
* Add message::has_content_length
* Rename some basic_parser observers
Actions Required:
* Call message::keep_alive instead of serializer::keep_alive
* Call serializer::get::chunked instead of serializer::chunked
* Implement has_content_length_impl for user-defined Fields
* Remove the "is_" prefix from call sites invoking certain basic_parser members
--------------------------------------------------------------------------------

View File

@@ -319,7 +319,7 @@ public:
@ref is_header_done would return `true`.
*/
bool
is_upgrade() const
upgrade() const
{
return (f_ & flagConnectionUpgrade) != 0;
}
@@ -330,18 +330,21 @@ public:
@ref is_header_done would return `true`.
*/
bool
is_chunked() const
chunked() const
{
return (f_ & flagChunked) != 0;
}
/** 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
@ref is_header_done would return `true`.
*/
bool
is_keep_alive() const;
keep_alive() const;
/** Returns the optional value of Content-Length if known.

View File

@@ -57,7 +57,7 @@ basic_parser(basic_parser<
template<bool isRequest, class Derived>
bool
basic_parser<isRequest, Derived>::
is_keep_alive() const
keep_alive() const
{
BOOST_ASSERT(is_header_done());
if(f_ & flagHTTP11)

View File

@@ -96,13 +96,13 @@ public:
operator()(Parser const& p) const
{
if(flags_ & parse_flag::chunked)
s_.BEAST_EXPECT(p.is_chunked());
s_.BEAST_EXPECT(p.chunked());
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)
s_.BEAST_EXPECT(! p.is_keep_alive());
s_.BEAST_EXPECT(! p.keep_alive());
if(flags_ & parse_flag::upgrade)
s_.BEAST_EXPECT(! p.is_upgrade());
s_.BEAST_EXPECT(! p.upgrade());
}
};
@@ -122,7 +122,7 @@ public:
void
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",
[&](P const& p)
{
BEAST_EXPECT(p.is_upgrade());
BEAST_EXPECT(p.upgrade());
});
}

View File

@@ -129,7 +129,7 @@ public:
[&](parser_type<false> const& p)
{
auto const& m = p.get();
BEAST_EXPECT(! p.is_chunked());
BEAST_EXPECT(! p.chunked());
BEAST_EXPECT(p.need_eof());
BEAST_EXPECT(p.content_length() == boost::none);
BEAST_EXPECT(m.version() == 10);
@@ -157,7 +157,7 @@ public:
{
auto const& m = p.get();
BEAST_EXPECT(! p.need_eof());
BEAST_EXPECT(p.is_chunked());
BEAST_EXPECT(p.chunked());
BEAST_EXPECT(p.content_length() == boost::none);
BEAST_EXPECT(m.version() == 11);
BEAST_EXPECT(m.result() == status::ok);
@@ -192,7 +192,7 @@ public:
BEAST_EXPECT(m.target() == "/");
BEAST_EXPECT(m.version() == 11);
BEAST_EXPECT(! p.need_eof());
BEAST_EXPECT(! p.is_chunked());
BEAST_EXPECT(! p.chunked());
BEAST_EXPECT(p.content_length() == boost::none);
}
);