在流式发送应答时,不使用GZIP压缩
This commit is contained in:
@@ -75,8 +75,9 @@ static int __write_http_half_to_line(const struct tfe_stream * stream,
|
|||||||
|
|
||||||
if (hf_private->is_setup_by_stream)
|
if (hf_private->is_setup_by_stream)
|
||||||
{
|
{
|
||||||
/* By stream, first time to write http request/response, construct the header */
|
/* By stream, first time to write http request/response,
|
||||||
if (hf_private->write_ctx == NULL)
|
* and has been call body_begin, construct the header */
|
||||||
|
if (hf_private->evbuf_body != NULL && hf_private->write_ctx == NULL)
|
||||||
{
|
{
|
||||||
ret = __write_http_half(hf_private, stream, dir);
|
ret = __write_http_half(hf_private, stream, dir);
|
||||||
if (unlikely(ret < 0)) return ret;
|
if (unlikely(ret < 0)) return ret;
|
||||||
|
|||||||
@@ -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)
|
int hf_ops_body_begin(struct tfe_http_half * half, int by_stream)
|
||||||
{
|
{
|
||||||
struct http_half_private * hf_private = to_hf_private(half);
|
struct http_half_private * hf_private = to_hf_private(half);
|
||||||
|
|
||||||
assert(hf_private->evbuf_body == NULL);
|
assert(hf_private->evbuf_body == NULL);
|
||||||
if (hf_private->evbuf_body != NULL)
|
|
||||||
{
|
|
||||||
evbuffer_free(hf_private->evbuf_body);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (by_stream)
|
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;
|
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_allow_write = hf_ops_allow_write,
|
||||||
.ops_http_field_iterate = hf_ops_field_iterate,
|
.ops_http_field_iterate = hf_ops_field_iterate,
|
||||||
.ops_append_body = hf_ops_append_body,
|
.ops_append_body = hf_ops_append_body,
|
||||||
.ops_body_begin = NULL,
|
.ops_body_begin = hf_ops_body_begin,
|
||||||
.ops_body_data = NULL,
|
.ops_body_data = hf_ops_body_data,
|
||||||
.ops_body_end = NULL,
|
.ops_body_end = hf_ops_body_end,
|
||||||
.ops_free = hf_ops_free
|
.ops_free = hf_ops_free
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user