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
+9 -5
View File
@@ -22,9 +22,13 @@ public:
void Init(Message* message);
bool finished() const { return finished_; }
bool finished() const {
return finished_;
}
std::size_t content_length() const { return content_length_; }
std::size_t content_length() const {
return content_length_;
}
bool Parse(const char* data, std::size_t length);
@@ -59,14 +63,13 @@ protected:
void AppendContent(const char* data, std::size_t count);
void AppendContent(const std::string& data);
// TODO: Rename to IsFixedContentFull.
bool IsContentFull() const;
bool IsFixedContentFull() const;
// Check header Content-Encoding to see if the content is compressed.
bool IsContentCompressed() const;
protected:
// The result HTTP message.
// The message parsed.
Message* message_;
// Data waiting to be parsed.
@@ -74,6 +77,7 @@ protected:
// Temporary data and helper flags for parsing.
std::size_t content_length_;
ContentType content_type_;
std::string content_;
bool start_line_parsed_;
bool content_length_parsed_;