Refactor treatment of status code and obsolete reason (API Change):

fix #398

A new enum status is added for the status code.

The function obsolete_reason returns default reason phrasing.

If a response has an empty reason, the serializer will
automatically insert the default reason phrase for the
status code.
This commit is contained in:
Vinnie Falco committed 2017-07-20 08:12:17 -07:00
1 parent f7211da154
commit e5cfe9c11f
14 files changed
+333 -108

No files matched your search

-3
View File
@@ -217,7 +217,6 @@ build_response(http::header<true, Fields> const& req,
{
response_type res;
res.status = 400;
res.reason(http::reason_string(res.status));
res.version = req.version;
res.body = text;
prepare(res);
@@ -248,7 +247,6 @@ build_response(http::header<true, Fields> const& req,
{
response_type res;
res.status = 426;
res.reason(http::reason_string(res.status));
res.version = req.version;
res.fields.insert("Sec-WebSocket-Version", "13");
prepare(res);
@@ -266,7 +264,6 @@ build_response(http::header<true, Fields> const& req,
res.fields, unused, offer, pmd_opts_);
}
res.status = 101;
res.reason(http::reason_string(res.status));
res.version = req.version;
res.fields.insert("Upgrade", "websocket");
res.fields.insert("Connection", "upgrade");