在流式发送应答时,不使用GZIP压缩

This commit is contained in:
Lu Qiuwen
2018-10-16 16:37:27 +08:00
parent 2bc366fb13
commit 95c57fe8a5
2 changed files with 15 additions and 10 deletions

View File

@@ -587,15 +587,19 @@ int hf_ops_append_body(struct tfe_http_half * half, char * buff, size_t size, in
int hf_ops_body_begin(struct tfe_http_half * half, int by_stream)
{
struct http_half_private * hf_private = to_hf_private(half);
assert(hf_private->evbuf_body == NULL);
if (hf_private->evbuf_body != NULL)
{
evbuffer_free(hf_private->evbuf_body);
}
if (by_stream)
{
/* By stream, we do not support content-encoding for now,
* send body directly without compression */
if(hf_private->cv_compress_object != NULL)
{
hf_content_compress_destroy(hf_private->cv_compress_object);
hf_private->cv_compress_object = NULL;
}
hf_private->content_encoding = HTTP_ACCEPT_ENCODING_NONE;
hf_private->is_setup_by_stream = true;
}
@@ -682,9 +686,9 @@ struct tfe_http_half_ops __http_half_ops =
.ops_http_allow_write = hf_ops_allow_write,
.ops_http_field_iterate = hf_ops_field_iterate,
.ops_append_body = hf_ops_append_body,
.ops_body_begin = NULL,
.ops_body_data = NULL,
.ops_body_end = NULL,
.ops_body_begin = hf_ops_body_begin,
.ops_body_data = hf_ops_body_data,
.ops_body_end = hf_ops_body_end,
.ops_free = hf_ops_free
};