增加GZIP压缩功能及对应的单元测试
This commit is contained in:
@@ -332,10 +332,10 @@ static int __parser_callback_on_body(struct http_parser * parser, const char * a
|
||||
/* Create ungzip context */
|
||||
if (hf_private->content_encoding != HTTP_ACCEPT_ENCODING_NONE)
|
||||
{
|
||||
hf_private->cv_unpress_object = hf_content_converter_create(HF_CONTENT_CONV_UNCOMPRASS,
|
||||
hf_private->cv_uncompress_object = hf_content_uncompress_create(
|
||||
hf_private->content_encoding, hf_private->event_cb, hf_private->event_cb_user);
|
||||
|
||||
if (unlikely(hf_private->cv_unpress_object == NULL)) assert(0);
|
||||
if (unlikely(hf_private->cv_uncompress_object == NULL)) assert(0);
|
||||
}
|
||||
|
||||
hf_private->event_cb(hf_private, ev_body_begin, NULL, parser->content_length, hf_private->event_cb_user);
|
||||
@@ -345,10 +345,10 @@ static int __parser_callback_on_body(struct http_parser * parser, const char * a
|
||||
int ret = 0;
|
||||
if (hf_private->event_cb && length != 0)
|
||||
{
|
||||
if (hf_private->cv_unpress_object != NULL)
|
||||
if (hf_private->cv_uncompress_object != NULL)
|
||||
{
|
||||
ret = hf_content_converter_write(hf_private->cv_unpress_object, hf_private, ev_body_cont,
|
||||
(const unsigned char *)at, length);
|
||||
ret = hf_content_uncompress_write(hf_private->cv_uncompress_object, hf_private, ev_body_cont,
|
||||
(const unsigned char *) at, length);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user