From 01ec332844821b8b7d1c002e859099c13a2e95e2 Mon Sep 17 00:00:00 2001 From: Lu Qiuwen Date: Tue, 16 Oct 2018 17:24:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=B5=81=E5=BC=8F=E6=9E=84?= =?UTF-8?q?=E5=BB=BAHTTP=E5=93=8D=E5=BA=94=E6=97=B6=EF=BC=8C=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E7=94=B3=E8=AF=B7write=5Fctx=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/protocol/http/src/http_entry.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/plugin/protocol/http/src/http_entry.cpp b/plugin/protocol/http/src/http_entry.cpp index 187af9c..aa9c82e 100644 --- a/plugin/protocol/http/src/http_entry.cpp +++ b/plugin/protocol/http/src/http_entry.cpp @@ -61,9 +61,17 @@ static int __write_http_half(struct http_half_private * hf_private, unsigned char * __to_write = evbuffer_pullup(hf_private->evbuf_raw, __to_write_len); /* Write the data to stream, UPSTREAM is the incoming direction for response */ - int ret = tfe_stream_write(stream, dir, __to_write, __to_write_len); - if (unlikely(ret < 0)) { assert(0); } + int ret = 0; + if (hf_private->write_ctx) + { + ret = tfe_stream_write_frag(hf_private->write_ctx, __to_write, __to_write_len); + } + else + { + ret = tfe_stream_write(stream, dir, __to_write, __to_write_len); + } + if (unlikely(ret < 0)) { assert(0); } evbuffer_drain(hf_private->evbuf_raw, __to_write_len); return ret; } @@ -327,6 +335,11 @@ enum tfe_stream_action __http_connection_entry_on_response(const struct tfe_stre hf_private_destory(hf_private_resp_user); hs_private->hf_private_resp_user = NULL; } + + if (hf_private_resp_in->stream_action == ACTION_DEFER_DATA) + { + hf_private_resp_in->stream_action = ACTION_DROP_DATA; + } } __stream_action = hf_private_resp_in->stream_action;