summaryrefslogtreecommitdiff
path: root/common/include
diff options
context:
space:
mode:
authorLu Qiuwen <[email protected]>2018-10-16 10:45:18 +0800
committerLu Qiuwen <[email protected]>2018-10-16 10:45:47 +0800
commit2bc366fb130b2a0e2bee73107f8e3102db59528a (patch)
treea2b3983b9de1cf20cc7e523b155d863054a02b80 /common/include
parent619f004c49903aa4a52863e617f6c520ec3b17e9 (diff)
增加HTTP流式构造Body的接口及实现并修正HTTP单元测试用例
Diffstat (limited to 'common/include')
-rw-r--r--common/include/tfe_http.h26
1 files changed, 23 insertions, 3 deletions
diff --git a/common/include/tfe_http.h b/common/include/tfe_http.h
index 1e78212..ae3c3b0 100644
--- a/common/include/tfe_http.h
+++ b/common/include/tfe_http.h
@@ -222,6 +222,9 @@ struct tfe_http_half_ops
struct tfe_http_half * (* ops_http_allow_write)(const struct tfe_http_half *);
const char * (* ops_http_field_iterate)(const struct tfe_http_half *, void **, struct http_field_name *);
int (* ops_append_body)(struct tfe_http_half *, char *, size_t, int);
+ int (* ops_body_begin)(struct tfe_http_half *, int by_stream);
+ int (* ops_body_data)(struct tfe_http_half *, const unsigned char * data, size_t sz_data);
+ int (* ops_body_end)(struct tfe_http_half *);
void (* ops_free)(struct tfe_http_half * half);
};
@@ -303,6 +306,7 @@ static inline const char * tfe_http_field_read(const struct tfe_http_half * half
{
return half->ops->ops_http_field_read(half, name);
}
+
static inline const char * tfe_http_std_field_read(const struct tfe_http_half * half, enum tfe_http_std_field field_id)
{
struct http_field_name tmp_name;
@@ -316,6 +320,7 @@ static inline int tfe_http_field_write(struct tfe_http_half * half,
{
return half->ops->ops_http_field_write(half, name, value);
}
+
static inline int tfe_http_std_field_write(struct tfe_http_half * half,
enum tfe_http_std_field field_id, const char * value)
{
@@ -338,10 +343,10 @@ static inline struct tfe_http_half * tfe_http_allow_write(const struct tfe_http_
return half->ops->ops_http_allow_write(half);
}
-static inline const char * tfe_http_field_iterate(const struct tfe_http_half * half,
- void ** interator, struct http_field_name * name)
+static inline const char * tfe_http_field_iterate(const struct tfe_http_half * half, void ** iterator,
+ struct http_field_name * name)
{
- return half->ops->ops_http_field_iterate(half, interator, name);
+ return half->ops->ops_http_field_iterate(half, iterator, name);
}
static inline int tfe_http_half_append_body(struct tfe_http_half * half, char * buff, size_t size, int flag)
@@ -354,6 +359,21 @@ static inline void tfe_http_half_free(struct tfe_http_half * half)
return half->ops->ops_free(half);
}
+static inline int tfe_http_half_write_body_begin(struct tfe_http_half * half, int by_stream)
+{
+ return half->ops->ops_body_begin(half, by_stream);
+}
+
+static inline int tfe_http_half_write_body_data(struct tfe_http_half * half, const unsigned char * data, size_t sz_data)
+{
+ return half->ops->ops_body_data(half, data, sz_data);
+}
+
+static inline int tfe_http_half_write_body_end(struct tfe_http_half * half)
+{
+ return half->ops->ops_body_end(half);
+}
+
static inline struct tfe_http_session * tfe_http_session_allow_write(const struct tfe_http_session * session)
{
return session->ops->ops_allow_write(session);