Rework the body of request and response

This commit is contained in:
Chunting Gu
2019-07-03 17:37:44 +08:00
parent b9f2ba6a41
commit 98aeeae012
39 changed files with 1122 additions and 677 deletions
+3 -10
View File
@@ -4,15 +4,6 @@
namespace webcc {
void Response::Prepare() {
PrepareStatusLine();
SetHeader(headers::kServer, utility::UserAgent());
SetHeader(headers::kDate, utility::GetTimestamp());
Message::Prepare();
}
static const std::pair<int, const char*> kTable[] = {
{ Status::kOK, "OK" },
{ Status::kCreated, "Created" },
@@ -35,7 +26,7 @@ static const char* GetReason(int status) {
return "";
}
void Response::PrepareStatusLine() {
void Response::Prepare() {
if (!start_line_.empty()) {
return;
}
@@ -49,6 +40,8 @@ void Response::PrepareStatusLine() {
} else {
start_line_ += reason_;
}
SetHeader(headers::kServer, utility::UserAgent());
}
} // namespace webcc