Support persistent connection for server.

This commit is contained in:
Chunting Gu
2019-03-25 18:16:58 +08:00
parent 6c4ac75c35
commit 6c5dedb807
24 changed files with 193 additions and 72 deletions
-20
View File
@@ -3,7 +3,6 @@
#include <iosfwd>
#include <string>
#include <vector>
#include "boost/asio/ip/tcp.hpp"
@@ -23,25 +22,6 @@ std::string EndpointToString(const TcpEndpoint& endpoint);
// See: https://tools.ietf.org/html/rfc7231#section-7.1.1.2
std::string GetHttpDateTimestamp();
// Resize a buffer in ctor and restore its original size in dtor.
struct BufferResizer {
BufferResizer(std::vector<char>* buffer, std::size_t new_size)
: buffer_(buffer), old_size_(buffer->size()) {
if (new_size != 0 && new_size != old_size_) {
buffer_->resize(new_size);
}
}
~BufferResizer() {
if (buffer_->size() != old_size_) {
buffer_->resize(old_size_);
}
}
std::vector<char>* buffer_;
std::size_t old_size_;
};
} // namespace webcc
#endif // WEBCC_UTILITY_H_