http请求头的相关处理

#define http_hdr_match_complete(buf, hdr, type, str) \
({ short index;\
int ret;\
if (type >= MAX_HTTP_TYPE || ((index = (hdr)->http_type[type]) == -1))\
ret = 0;\
else\
{\
ret = ((hdr)->fields[index].value_len == STRSIZE(str) && \
http_hdr_match(buf, (hdr)->fields[index].value_begin, str));\
}\
ret;\
})




#define http_hdr_match_head(buf, hdr, type, str) \
({ short index;\
int ret;\
if (type >= MAX_HTTP_TYPE || ((index = (hdr)->http_type[type]) == -1))\
ret = 0;\
else\
{\
ret = ((hdr)->fields[index].value_len >= STRSIZE(str) && \
http_hdr_match(buf, (hdr)->fields[index].value_begin, str));\
}\
ret;\
})


#define http_hdr_match_tail(buf, hdr, type, str) \
({ short index;\
 int ret;\
 if (type >= MAX_HTTP_TYPE || ((index = (hdr)->http_type[type]) == -1))\
 ret = 0;\
 else\
 {\
 ret = ((hdr)->fields[index].value_len >= STRSIZE(str) && \
 http_hdr_match(buf, (hdr)->fields[index].value_begin + (hdr)->fields[index].value_len - STRSIZE(str), str));\
 }\
 ret;\
 })

你可能感兴趣的:(http请求头的相关处理)