You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2021/02/22 17:00:56 UTC

[trafficserver] branch 9.0.x updated (b955e2c -> ba199e6)

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

zwoop pushed a change to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git.


    from b955e2c  Updated ChangeLog
     new c61a775  slice/handleFirstServerHeader: return sooner on requested range errors (#7486)
     new ba199e6  Add zlib1g-dev to Debian dependencies in README (#7495)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 README                                          |  1 +
 plugins/experimental/slice/Range.h              |  2 +-
 plugins/experimental/slice/server.cc            | 16 +++++-----------
 tests/gold_tests/pluginTest/slice/slice.test.py |  9 +++++++++
 4 files changed, 16 insertions(+), 12 deletions(-)


[trafficserver] 01/02: slice/handleFirstServerHeader: return sooner on requested range errors (#7486)

Posted by zw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit c61a775050e73049fe2c0a6df5adf652d8e972bf
Author: Brian Olsen <bn...@gmail.com>
AuthorDate: Fri Feb 12 11:51:15 2021 -0700

    slice/handleFirstServerHeader: return sooner on requested range errors (#7486)
    
    (cherry picked from commit df01ace2b0bdffd3ddcc5b2c7587b6d6fed5234c)
---
 plugins/experimental/slice/Range.h              |  2 +-
 plugins/experimental/slice/server.cc            | 16 +++++-----------
 tests/gold_tests/pluginTest/slice/slice.test.py |  9 +++++++++
 3 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/plugins/experimental/slice/Range.h b/plugins/experimental/slice/Range.h
index ba581c6..44ef1de 100644
--- a/plugins/experimental/slice/Range.h
+++ b/plugins/experimental/slice/Range.h
@@ -29,7 +29,7 @@
 
 struct Range {
 public:
-  static int64_t constexpr maxval = (std::numeric_limits<int64_t>::max() >> 2);
+  static int64_t constexpr maxval = (std::numeric_limits<int64_t>::max() / 2);
 
   int64_t m_beg{-1};
   int64_t m_end{-1}; // half open
diff --git a/plugins/experimental/slice/server.cc b/plugins/experimental/slice/server.cc
index 34a535c..cd31dc7 100644
--- a/plugins/experimental/slice/server.cc
+++ b/plugins/experimental/slice/server.cc
@@ -91,8 +91,6 @@ enum HeaderState {
 HeaderState
 handleFirstServerHeader(Data *const data, TSCont const contp)
 {
-  HeaderState state = HeaderState::Good;
-
   HttpHeader header(data->m_resp_hdrmgr.m_buffer, data->m_resp_hdrmgr.m_lochdr);
 
   if (TSIsDebugTagSet(PLUGIN_NAME)) {
@@ -119,8 +117,7 @@ handleFirstServerHeader(Data *const data, TSCont const contp)
       TSVIONBytesSet(output_vio, clen);
     }
     TSHttpHdrPrint(header.m_buffer, header.m_lochdr, output_buf);
-    state = HeaderState::Passthru;
-    return state;
+    return HeaderState::Passthru;
   }
 
   ContentRange const blockcr = contentRangeFrom(header);
@@ -131,8 +128,7 @@ handleFirstServerHeader(Data *const data, TSCont const contp)
     TSVIONBytesSet(output_vio, msg502.size());
     TSIOBufferWrite(output_buf, msg502.data(), msg502.size());
     TSVIOReenable(output_vio);
-    state = HeaderState::Fail;
-    return state;
+    return HeaderState::Fail;
   }
 
   // set the resource content length from block response
@@ -163,10 +159,8 @@ handleFirstServerHeader(Data *const data, TSCont const contp)
     TSHttpHdrPrint(header.m_buffer, header.m_lochdr, output_buf);
     TSIOBufferWrite(output_buf, bodystr.data(), bodystr.size());
     TSVIOReenable(output_vio);
-
     data->m_upstream.m_read.close();
-
-    state = HeaderState::Fail;
+    return HeaderState::Fail;
   }
 
   // save data header string
@@ -199,7 +193,7 @@ handleFirstServerHeader(Data *const data, TSCont const contp)
       data->m_dnstream.close();
 
       ERROR_LOG("Bad/invalid response content range");
-      state = HeaderState::Fail;
+      return HeaderState::Fail;
     }
 
     header.setKeyVal(TS_MIME_FIELD_CONTENT_RANGE, TS_MIME_LEN_CONTENT_RANGE, rangestr, rangelen);
@@ -223,7 +217,7 @@ handleFirstServerHeader(Data *const data, TSCont const contp)
   data->m_bytessent = hbytes;
   TSVIOReenable(output_vio);
 
-  return state;
+  return HeaderState::Good;
 }
 
 void
diff --git a/tests/gold_tests/pluginTest/slice/slice.test.py b/tests/gold_tests/pluginTest/slice/slice.test.py
index 0ac8119..fc73aa2 100644
--- a/tests/gold_tests/pluginTest/slice/slice.test.py
+++ b/tests/gold_tests/pluginTest/slice/slice.test.py
@@ -174,3 +174,12 @@ ps.Streams.stderr = "gold/slice_mid.stderr.gold"
 ps.Streams.stdout.Content = Testers.ContainsExpression("206 Partial Content", "expected 206 response")
 ps.Streams.stdout.Content += Testers.ContainsExpression("Content-Range: bytes 5-16/18", "mismatch byte content response")
 tr.StillRunningAfter = ts
+
+# 8 Test - special case, begin inside last slice block but outside asset len
+tr = Test.AddTestRun("Invalid end range request, 416")
+beg = len(body) + 1
+end = beg + block_bytes
+ps = tr.Processes.Default
+ps.Command = curl_and_args + ' http://slice/path' + ' -r {}-{}'.format(beg, end)
+ps.Streams.stdout.Content = Testers.ContainsExpression("416 Requested Range Not Satisfiable", "expected 416 response")
+tr.StillRunningAfter = ts


[trafficserver] 02/02: Add zlib1g-dev to Debian dependencies in README (#7495)

Posted by zw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit ba199e65236346167739f01f683df7f6d2bf006e
Author: Dan T <da...@gmail.com>
AuthorDate: Mon Feb 8 15:50:41 2021 +0000

    Add zlib1g-dev to Debian dependencies in README (#7495)
    
    (cherry picked from commit 35496345f826cbd4d1a5e5e9328a873791bdb866)
---
 README | 1 +
 1 file changed, 1 insertion(+)

diff --git a/README b/README
index c875b5a..fa4fa71 100644
--- a/README
+++ b/README
@@ -101,6 +101,7 @@ plugins to build large scale web applications.
     pkg-config
     libmodule-install-perl
     gcc/g++ or clang/clang++
+    zlib1g-dev
     libssl-dev
     libpcre3-dev
     libcap-dev (optional, highly recommended)