Get down to a single write call

This commit is contained in:
Ian Gulliver
2019-04-28 18:19:32 +00:00
parent d486533dfc
commit 9d4f3241fe
8 changed files with 82 additions and 87 deletions

View File

@@ -2,6 +2,8 @@
#include <unordered_map>
#include "buffer.h"
class FastCGIConn;
class FastCGIRequest {
@@ -13,8 +15,10 @@ class FastCGIRequest {
const std::string& GetParam(const std::string& key);
void Write(const std::vector<std::pair<std::string_view, std::string_view>>& headers, const std::vector<std::string_view>& body);
void WriteEnd();
void WriteHeader(const std::string_view& name, const std::string_view& value);
void WriteBody(const std::string_view& body);
void Flush();
void End();
private:
const uint16_t request_id_;
@@ -22,5 +26,7 @@ class FastCGIRequest {
std::unordered_map<std::string, std::string> params_;
std::string in_;
Buffer out_buf_;
bool body_sent_ = false;
};