You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by du...@apache.org on 2023/10/26 17:18:58 UTC

[trafficserver] branch master updated: Do not overwrite the error code of GOAWAY frame (#10673)

This is an automated email from the ASF dual-hosted git repository.

duke8253 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new b59a8e3c8c Do not overwrite the error code of GOAWAY frame (#10673)
b59a8e3c8c is described below

commit b59a8e3c8cc4dfbac7a36cec825b0c7bd43a1d2a
Author: Fei Deng <fe...@yahooinc.com>
AuthorDate: Thu Oct 26 13:18:51 2023 -0400

    Do not overwrite the error code of GOAWAY frame (#10673)
    
    * do not overwrite the error code of GOAWAY frame
---
 src/proxy/http2/Http2ConnectionState.cc | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/proxy/http2/Http2ConnectionState.cc b/src/proxy/http2/Http2ConnectionState.cc
index fb7030b397..9b63997dd8 100644
--- a/src/proxy/http2/Http2ConnectionState.cc
+++ b/src/proxy/http2/Http2ConnectionState.cc
@@ -837,7 +837,7 @@ Http2ConnectionState::rcv_goaway_frame(const Http2Frame &frame)
 {
   Http2Goaway goaway;
   char buf[HTTP2_GOAWAY_LEN];
-  unsigned nbytes               = 0;
+  char *end;
   const Http2StreamId stream_id = frame.header().streamid;
 
   Http2StreamDebug(this->session, stream_id, "Received GOAWAY frame");
@@ -849,13 +849,11 @@ Http2ConnectionState::rcv_goaway_frame(const Http2Frame &frame)
                       "goaway id non-zero");
   }
 
-  while (nbytes < frame.header().length) {
-    unsigned read_bytes = read_rcv_buffer(buf, sizeof(buf), nbytes, frame);
+  end = frame.reader()->memcpy(buf, sizeof(buf), 0);
 
-    if (!http2_parse_goaway(make_iovec(buf, read_bytes), goaway)) {
-      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
-                        "goaway failed parse");
-    }
+  if (!http2_parse_goaway(make_iovec(buf, end - buf), goaway)) {
+    return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                      "goaway failed parse");
   }
 
   Http2StreamDebug(this->session, stream_id, "GOAWAY: last stream id=%d, error code=%d", goaway.last_streamid,