增加获取evbase、线程数、标准HTTP field设置的工具函数

This commit is contained in:
zhengchao
2018-10-14 14:07:47 +08:00
parent a2fa705fa7
commit a925bf738e
4 changed files with 42 additions and 9 deletions

View File

@@ -158,11 +158,11 @@ enum tfe_http_std_field
TFE_HTTP_EXPIRES,
TFE_HTTP_ACCEPT_ENCODING,
TFE_HTTP_CACHE_CONTROL,
TLF_HTTP_IF_MATCH,
TLF_HTTP_IF_NONE_MATCH,
TLF_HTTP_IF_MODIFIED_SINCE,
TLF_HTTP_IF_UNMODIFIED_SINCE,
TLF_HTTP_LAST_MODIFIED
TFE_HTTP_IF_MATCH,
TFE_HTTP_IF_NONE_MATCH,
TFE_HTTP_IF_MODIFIED_SINCE,
TFE_HTTP_IF_UNMODIFIED_SINCE,
TFE_HTTP_LAST_MODIFIED
};
enum http_ev_bit_number
@@ -303,6 +303,13 @@ 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(struct tfe_http_half * half, enum tfe_http_std_field field_id)
{
struct http_field_name tmp_name;
tmp_name.field_id=field_id;
tmp_name.field_name=NULL;
return tfe_http_field_read(half, &tmp_name);
}
static inline int tfe_http_field_write(struct tfe_http_half * half,
const struct http_field_name * name, const char * value)
@@ -376,6 +383,18 @@ static inline struct tfe_http_half * tfe_http_session_response_create(struct tfe
{
return session->ops->ops_response_create(session, resp_code);
}
static inline int tfe_http_in_request(enum tfe_http_event events)
{
if ((events & EV_HTTP_REQ_HDR) | (events & EV_HTTP_REQ_BODY_BEGIN) | (events & EV_HTTP_REQ_BODY_END)
| (events & EV_HTTP_REQ_BODY_CONT))
{
return 1;
}
else
{
return 0;
}
}
//@flag EV_HTTP_RESP_BODY_END, EV_HTTP_RESP_BODY_FULL,