增加标准HTTP头部定义转字符串的工具函数,修正pango-http插件在初始化时没有设置PME的错误。
This commit is contained in:
@@ -201,42 +201,10 @@ typedef void (http_session_data_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);
|
||||
|
||||
static inline 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);
|
||||
assert(__duplicated != NULL);
|
||||
|
||||
if (orig->field_id == TFE_HTTP_UNKNOWN_FIELD)
|
||||
{
|
||||
__duplicated->field_id = TFE_HTTP_UNKNOWN_FIELD;
|
||||
__duplicated->field_name = tfe_strdup(orig->field_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
__duplicated->field_id = orig->field_id;
|
||||
__duplicated->field_name = NULL;
|
||||
}
|
||||
|
||||
return __duplicated;
|
||||
}
|
||||
|
||||
static inline int http_field_name_compare(const struct http_field_name * lvalue,
|
||||
const struct http_field_name * rvalue)
|
||||
{
|
||||
if (lvalue->field_id != rvalue->field_id)
|
||||
{
|
||||
return (lvalue->field_id - rvalue->field_id);
|
||||
}
|
||||
|
||||
/* unknown field, compare field_name in string */
|
||||
if (lvalue->field_id == TFE_HTTP_UNKNOWN_FIELD)
|
||||
{
|
||||
return strcasecmp(lvalue->field_name, rvalue->field_name);
|
||||
}
|
||||
|
||||
/* field_id is equal, but not unknown, hit */
|
||||
return 0;
|
||||
}
|
||||
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);
|
||||
const char * http_field_to_string(const struct http_field_name * field);
|
||||
void http_field_destory(struct http_field_name *);
|
||||
|
||||
static inline const char * tfe_http_field_read(const struct tfe_http_half * half,
|
||||
const struct http_field_name * name)
|
||||
|
||||
Reference in New Issue
Block a user