增加标准HTTP请求转换为字符串的工具函数
This commit is contained in:
@@ -202,11 +202,16 @@ typedef void (http_session_data_cb)(const struct tfe_stream * stream,
|
|||||||
typedef void (http_session_end_cb)(const struct tfe_stream * stream,
|
typedef void (http_session_end_cb)(const struct tfe_stream * stream,
|
||||||
const struct tfe_http_session * session, unsigned int thread_id, void ** pme);
|
const struct tfe_http_session * session, unsigned int thread_id, void ** pme);
|
||||||
|
|
||||||
|
/* Tools functions for standard HTTP header field name */
|
||||||
struct http_field_name * http_field_name_duplicate(const struct http_field_name * orig);
|
struct http_field_name * http_field_name_duplicate(const struct http_field_name * orig);
|
||||||
int http_field_name_compare(const struct http_field_name * lvalue, const struct http_field_name * rvalue);
|
int http_field_name_compare(const struct http_field_name * lvalue, const struct http_field_name * rvalue);
|
||||||
const char * http_field_to_string(const struct http_field_name * field);
|
const char * http_field_to_string(const struct http_field_name * field);
|
||||||
void http_field_destory(struct http_field_name *);
|
void http_field_destory(struct http_field_name *);
|
||||||
|
|
||||||
|
/* Tools functions for standard HTTP method */
|
||||||
|
const char * http_std_method_to_string(enum tfe_http_std_method method);
|
||||||
|
enum tfe_http_std_method http_std_method_construct(const char * str_method);
|
||||||
|
|
||||||
static inline const char * tfe_http_field_read(const struct tfe_http_half * half,
|
static inline const char * tfe_http_field_read(const struct tfe_http_half * half,
|
||||||
const struct http_field_name * name)
|
const struct http_field_name * name)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -43,6 +43,18 @@ static const char * __str_std_header_field_map[] =
|
|||||||
[TFE_HTTP_ACCEPT_ENCODING] = "Accept-Encoding"
|
[TFE_HTTP_ACCEPT_ENCODING] = "Accept-Encoding"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const char * __str_std_method_map[] =
|
||||||
|
{
|
||||||
|
#define XX(num, name, string) [TFE_HTTP_##name] = #string,
|
||||||
|
HTTP_METHOD_MAP(XX)
|
||||||
|
#undef XX
|
||||||
|
};
|
||||||
|
|
||||||
|
const char * http_std_method_to_string(enum tfe_http_std_method method)
|
||||||
|
{
|
||||||
|
return __str_std_method_map[method];
|
||||||
|
}
|
||||||
|
|
||||||
struct http_field_name * http_field_name_duplicate(const struct http_field_name * orig)
|
struct http_field_name * http_field_name_duplicate(const struct http_field_name * orig)
|
||||||
{
|
{
|
||||||
struct http_field_name * __duplicated = ALLOC(struct http_field_name, 1);
|
struct http_field_name * __duplicated = ALLOC(struct http_field_name, 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user