From 65e0ac29d5dff00652f2ed7a5c5da982f36d1417 Mon Sep 17 00:00:00 2001 From: fengweihao Date: Wed, 26 Jun 2019 20:53:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dredirect=E5=91=BD=E4=B8=ADRes?= =?UTF-8?q?pBody=E5=90=8E,=E4=BF=AE=E6=94=B9action=E7=8A=B6=E6=80=81?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E5=8F=91=E9=80=81=E6=97=A5=E5=BF=97=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8Dpcre2=5Fsubstitute=E5=A4=B1=E8=B4=A5=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E9=A1=B5=E9=9D=A2=E6=97=A0=E6=B3=95=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/business/pangu-http/src/pangu_http.cpp | 1 + plugin/business/pangu-http/src/pattern_replace.cpp | 2 +- plugin/protocol/http2/src/http2_stream.cpp | 7 ++++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/plugin/business/pangu-http/src/pangu_http.cpp b/plugin/business/pangu-http/src/pangu_http.cpp index 36a984a..e71e962 100644 --- a/plugin/business/pangu-http/src/pangu_http.cpp +++ b/plugin/business/pangu-http/src/pangu_http.cpp @@ -1516,6 +1516,7 @@ static void http_redirect(const struct tfe_http_session * session, enum tfe_http if ((events & EV_HTTP_RESP_BODY_BEGIN) || (events & EV_HTTP_RESP_BODY_CONT) || (events & EV_HTTP_RESP_BODY_END) || (events & EV_HTTP_RESP_END)) { + ctx->action = PG_ACTION_NONE; return; } diff --git a/plugin/business/pangu-http/src/pattern_replace.cpp b/plugin/business/pangu-http/src/pattern_replace.cpp index 34bb084..ea910c5 100644 --- a/plugin/business/pangu-http/src/pattern_replace.cpp +++ b/plugin/business/pangu-http/src/pattern_replace.cpp @@ -227,7 +227,7 @@ not_enough_mem_retry: if(rc<=0) { free(out_buffer); - outlen=rc; + outlen=0; } else { diff --git a/plugin/protocol/http2/src/http2_stream.cpp b/plugin/protocol/http2/src/http2_stream.cpp index 797f2f7..907a8e8 100644 --- a/plugin/protocol/http2/src/http2_stream.cpp +++ b/plugin/protocol/http2/src/http2_stream.cpp @@ -1261,8 +1261,9 @@ nghttp2_submit_frame_data(struct tfe_h2_stream *h2_stream_info,const nghttp2_fra nghttp2_session *ngh2_session = tfe_h2_stream_get_nghttp2_peer_session(h2_stream_info, dir); h2_session = (struct tfe_h2_session *)nghttp2_session_get_stream_user_data(ngh2_session, frame->hd.stream_id); - if (!h2_session) + if (h2_session == NULL) { + nghttp2_submit_end_data_by_h2_half(h2_stream_info, frame->hd.stream_id, dir); h2_stream_info->stream_action = ACTION_DROP_DATA; return 0; } @@ -1615,6 +1616,8 @@ nghttp2_server_submit_header(struct tfe_h2_stream *h2_stream_info, int32_t strea stream_id, h2_stream_info); goto finish; } + assert(h2_session->ngh2_stream_id == stream_id); + resp = h2_session->resp; fill_resp_spec_from_handle(h2_session->resp); @@ -1799,6 +1802,8 @@ nghttp2_client_submit_header(struct tfe_h2_stream *h2_stream_info, int32_t strea stream_action = ACTION_FORWARD_DATA; goto finish; } + assert(h2_session->ngh2_stream_id == stream_id); + req = h2_session->req; fill_req_spec_from_handle(h2_session->req);