summaryrefslogtreecommitdiff
path: root/src/http.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/http.h')
-rw-r--r--src/http.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/http.h b/src/http.h
index 13bb481..6562a3f 100644
--- a/src/http.h
+++ b/src/http.h
@@ -1,6 +1,7 @@
#ifndef TFE_HTTP_H
#define TFE_HTTP_H
+#include <vector>
#include <memory>
#include <map>
#include <string>
@@ -168,6 +169,15 @@ public:
using for_each_header_cb_t = std::function<void(const std::string & field, const std::string & value)>;
virtual void ForEachHeader(for_each_header_cb_t cb) = 0;
+ /* Request Body */
+ using body_content_t = std::vector<char>;
+ using body_content_ptr_t = std::unique_ptr<body_content_t>;
+
+ /* Body读取、设置接口 */
+ virtual const body_content_t * Body() = 0;
+ virtual void Body(body_content_ptr_t body) = 0;
+ virtual body_content_ptr_t StolenBody() = 0;
+
/* ReadOnly,标记本请求为只读。
* 当一个请求为只读请求时,业务不应修改它的内容,底层处理Readonly的请求时,应直接转发不缓存 */
virtual bool ReadOnly() = 0;
@@ -179,7 +189,12 @@ public:
virtual void Forward(bool is_forward) = 0;
/* 完整标记,该请求是否已经完整可用 */
- virtual bool Complete() = 0;
+ enum section_t { kSectionHeader, kSectionBody, kSecionMessage };
+ virtual bool Complete(section_t section) = 0;
+
+ /* HTTP版本 */
+ using version_t = std::tuple<short, short>;
+ virtual version_t Version() = 0;
};
class HttpResponse