增加HTTP流式构造Body的接口及实现并修正HTTP单元测试用例
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user