Add Server and Date fields to HTTP header of response.

This commit is contained in:
Chunting Gu
2018-11-05 13:34:18 +08:00
parent 364a37899d
commit e862153657
4 changed files with 31 additions and 14 deletions
+9
View File
@@ -1,6 +1,8 @@
#include "webcc/utility.h"
#include <algorithm>
#include <ctime>
#include <iomanip> // for put_time
#include <ostream>
#include <sstream>
@@ -55,4 +57,11 @@ std::string EndpointToString(const boost::asio::ip::tcp::endpoint& endpoint) {
return ss.str();
}
std::string GetHttpDateTimestamp() {
std::time_t t = std::time(nullptr);
std::stringstream ss;
ss << std::put_time(std::gmtime(&t), "%a, %d %b %Y %H:%M:%S") << " GMT";
return ss.str();
}
} // namespace webcc