增加GZIP压缩功能及对应的单元测试

This commit is contained in:
Lu Qiuwen
2018-09-28 15:05:54 +08:00
parent 5bf18848c1
commit a14b665f90
5 changed files with 208 additions and 53 deletions

View File

@@ -2,18 +2,20 @@
#include <tfe_http.h>
#include <http_half.h>
struct hf_content_converter;
struct hf_content_uncompress;
struct hf_content_compress;
enum hf_content_conv_work_mode
{
HF_CONTENT_CONV_COMPRASS,
HF_CONTENT_CONV_UNCOMPRASS
};
int hf_content_converter_write(struct hf_content_converter * cv_object,
int hf_content_uncompress_write(struct hf_content_uncompress * cv_object,
struct http_half_private * hf_private, tfe_http_event http_ev, const unsigned char * data, size_t datalen);
void hf_content_converter_destroy(struct hf_content_converter * cv_object);
void hf_content_uncompress_destroy(struct hf_content_uncompress * cv_object);
struct hf_content_converter * hf_content_converter_create(enum hf_content_conv_work_mode mode,
unsigned int content_encode, hf_private_cb * data_cb, void * data_cb_user);
struct hf_content_uncompress * hf_content_uncompress_create(unsigned int content_encode, hf_private_cb * data_cb,
void * data_cb_user);
struct hf_content_compress * hf_content_compress_create(unsigned int content_encode);
int hf_content_compress_write(struct hf_content_compress * cv_object,
const unsigned char * in_data, size_t sz_in_data, struct evbuffer * out_ev_buf, int end);
void hf_content_compress_destroy(hf_content_compress * cv_object);

View File

@@ -66,7 +66,7 @@ struct http_half_private
/* Content-Encoding */
uint16_t content_encoding;
struct hf_content_converter * cv_unpress_object;
struct hf_content_uncompress * cv_uncompress_object;
/* Header Parser */
struct evbuffer * evbuf_header_field;