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

bcall pushed a commit to branch 7.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/7.1.x by this push:
     new 2fee129  Handle final delayed chunk size
2fee129 is described below

commit 2fee129209c2a016aa8d56ea69fc214b9dc1de2c
Author: Susan Hinrichs <shinr...@verizonmedia.com>
AuthorDate: Thu Feb 13 20:26:31 2020 +0000

    Handle final delayed chunk size
---
 iocore/eventsystem/I_VIO.h |  2 +-
 iocore/eventsystem/P_VIO.h |  2 +-
 proxy/http/HttpTransact.cc |  2 +-
 proxy/http2/Http2Stream.cc | 11 +----------
 proxy/http2/Http2Stream.h  | 14 +-------------
 5 files changed, 5 insertions(+), 26 deletions(-)

diff --git a/iocore/eventsystem/I_VIO.h b/iocore/eventsystem/I_VIO.h
index 7f44139..d49a6ef 100644
--- a/iocore/eventsystem/I_VIO.h
+++ b/iocore/eventsystem/I_VIO.h
@@ -96,7 +96,7 @@ public:
     @return The number of bytes to be processed by the operation.
 
   */
-  int64_t ntodo();
+  int64_t ntodo() const;
 
   /////////////////////
   // buffer settings //
diff --git a/iocore/eventsystem/P_VIO.h b/iocore/eventsystem/P_VIO.h
index 8901c48..6f24832 100644
--- a/iocore/eventsystem/P_VIO.h
+++ b/iocore/eventsystem/P_VIO.h
@@ -65,7 +65,7 @@ VIO::get_reader()
   return (buffer.reader());
 }
 TS_INLINE int64_t
-VIO::ntodo()
+VIO::ntodo() const
 {
   return nbytes - ndone;
 }
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 156441d..0988507 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -7140,7 +7140,7 @@ HttpTransact::handle_response_keep_alive_headers(State 
*s, HTTPVersion ver, HTTP
     // a PUSH request
     if (s->client_info.keep_alive != HTTP_KEEPALIVE) {
       ka_action = KA_DISABLED;
-    } else if (s->hdr_info.trust_response_cl == false &&
+    } else if (s->hdr_info.trust_response_cl == false && 
s->state_machine->ua_session->is_chunked_encoding_supported() &&
                !(s->client_info.receive_chunked_response == true ||
                  (s->method == HTTP_WKSIDX_PUSH && s->client_info.keep_alive 
== HTTP_KEEPALIVE))) {
       ka_action = KA_CLOSE;
diff --git a/proxy/http2/Http2Stream.cc b/proxy/http2/Http2Stream.cc
index 526a747..aa86876 100644
--- a/proxy/http2/Http2Stream.cc
+++ b/proxy/http2/Http2Stream.cc
@@ -602,12 +602,7 @@ Http2Stream::update_write_request(IOBufferReader 
*buf_reader, int64_t write_len,
 
       // If there is additional data, send it along in a data frame.  Or if 
this was header only
       // make sure to send the end of stream
-      is_done |= (write_vio.ntodo() + this->response_header.length_get()) == 
bytes_avail;
-      if (this->response_is_data_available() || is_done) {
-        if (is_done) {
-          this->mark_body_done();
-        }
-
+      if (this->response_is_data_available()) {
         this->send_response_body(call_update);
       }
       break;
@@ -619,10 +614,6 @@ Http2Stream::update_write_request(IOBufferReader 
*buf_reader, int64_t write_len,
       break;
     }
   } else {
-    if (write_vio.ntodo() == bytes_avail || is_done) {
-      this->mark_body_done();
-    }
-
     this->send_response_body(call_update);
   }
 
diff --git a/proxy/http2/Http2Stream.h b/proxy/http2/Http2Stream.h
index c67efb6..0704416 100644
--- a/proxy/http2/Http2Stream.h
+++ b/proxy/http2/Http2Stream.h
@@ -94,18 +94,7 @@ public:
   bool
   is_body_done() const
   {
-    return body_done;
-  }
-
-  void
-  mark_body_done()
-  {
-    body_done = true;
-    if (response_is_chunked()) {
-      ink_assert(chunked_handler.state == ChunkedHandler::CHUNK_READ_DONE ||
-                 chunked_handler.state == ChunkedHandler::CHUNK_READ_ERROR);
-      this->write_vio.nbytes = response_header.length_get() + 
chunked_handler.dechunked_size;
-    }
+    return this->write_vio.ntodo() == 0;
   }
 
   void
@@ -283,7 +272,6 @@ private:
   VIO write_vio;
 
   bool trailing_header = false;
-  bool body_done       = false;
   bool chunked         = false;
 
   // A brief disucssion of similar flags and state variables:  _state, closed, 
terminate_stream

Reply via email to