Refactor header status, reason, and target (API Change):

* header::result is a family of functions to replace header::status

* header interface now uses status enum and also ints

* reason-phrase is no longer stored unless the user explicitly
  requests it.

* When serializing, the standard reason is used for the
  corresponding status code unless the user has changed it.
This commit is contained in:
Vinnie Falco committed 2017-06-04 17:26:20 -07:00
1 parent 60f044aff0
commit e67c0abe79
31 files changed
+588 -220

No files matched your search

+3 -6
View File
@@ -23,6 +23,7 @@ void
write_start_line(std::ostream& os,
header<true, Fields> const& msg)
{
// VFALCO This should all be done without dynamic allocation
BOOST_ASSERT(msg.version == 10 || msg.version == 11);
os << msg.method() << " " << msg.target();
switch(msg.version)
@@ -37,18 +38,14 @@ void
write_start_line(std::ostream& os,
header<false, Fields> const& msg)
{
// VFALCO This should all be done without dynamic allocation
BOOST_ASSERT(msg.version == 10 || msg.version == 11);
switch(msg.version)
{
case 10: os << "HTTP/1.0 "; break;
case 11: os << "HTTP/1.1 "; break;
}
auto const reason = msg.reason();
if(reason.empty())
os << msg.status << " " << msg.reason() << "\r\n";
else
os << msg.status << " " <<
obsolete_reason(static_cast<status>(msg.status)) << "\r\n";
os << msg.result_int() << " " << msg.reason() << "\r\n";
}
template<class FieldSequence>