H3 是一个 C 语言实现的快速的 HTTP Header 解析库。
示例代码:
#include <h3.h> int main() { RequestHeader *header; header = h3_request_header_new(); h3_request_header_parse(header, headerBody, len); printf("HEADER\n"); printf("===========================\n"); printf("%s", headerBody); printf("\n---------------------------\n"); printf("Method: %.*s\n", header->RequestMethodLen, header->RequestMethod); printf("Request-URI: %.*s\n", header->RequestURILen, header->RequestURI); printf("HTTP-Version: %.*s\n", header->HTTPVersionLen, header->HTTPVersion); printf("===========================\n"); h3_request_header_free(header); return 0; }