[trafficserver] branch 9.0.x updated: Updated ChangeLog

2020-10-12 Thread zwoop
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


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 3486fb3  Updated ChangeLog
3486fb3 is described below

commit 3486fb3ee044d79059742dcc86b54addde800ea6
Author: Leif Hedstrom 
AuthorDate: Mon Oct 12 11:35:25 2020 -0600

Updated ChangeLog
---
 CHANGELOG-9.0.0 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CHANGELOG-9.0.0 b/CHANGELOG-9.0.0
index f03a770..fb687f3 100644
--- a/CHANGELOG-9.0.0
+++ b/CHANGELOG-9.0.0
@@ -1113,3 +1113,5 @@ Changes with Apache Traffic Server 9.0.0
   #7238 - Supporting out of source builds for AuTests.
   #7243 - RolledLogDeleter: do not sort on each candidate consideration.
   #7252 - Remove some useless defines, which just obfuscates code
+  #7260 - Treat objects with negative max-age CC directives as stale.
+  #7266 - Allow initial // in request targets.



[trafficserver] branch 9.0.x updated: Allow initial // in request targets. (#7266)

2020-10-12 Thread zwoop
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


The following commit(s) were added to refs/heads/9.0.x by this push:
 new f2d2e92  Allow initial // in request targets. (#7266)
f2d2e92 is described below

commit f2d2e92f8afd8f61eb59737f84dc78ba4e32fb27
Author: Brian Neradt 
AuthorDate: Mon Oct 12 12:25:03 2020 -0500

Allow initial // in request targets. (#7266)

Allow URI's with an initial double slash, such as:

//index.html

Co-authored-by: bneradt 
(cherry picked from commit aa16a29e523198728dc4dfe3b00140d4e2e913bc)
---
 proxy/hdrs/URL.cc|  8 +---
 proxy/hdrs/unit_tests/test_URL.cc| 27 ---
 tests/gold_tests/url/uri.replay.yaml | 86 
 tests/gold_tests/url/uri.test.py | 37 
 4 files changed, 146 insertions(+), 12 deletions(-)

diff --git a/proxy/hdrs/URL.cc b/proxy/hdrs/URL.cc
index c2a903b..4f7b4e8 100644
--- a/proxy/hdrs/URL.cc
+++ b/proxy/hdrs/URL.cc
@@ -1384,13 +1384,7 @@ url_parse_http(HdrHeap *heap, URLImpl *url, const char 
**start, const char *end,
 return err;
   }
 
-  cur = *start;
-  if (url->m_ptr_host == nullptr && ((end - cur) >= 2) && '/' == *cur && '/' 
== *(cur + 1)) {
-// RFC 3986 section-3.3:
-// If a URI does not contain an authority component, then the path cannot
-// begin with two slash characters ("//").
-return PARSE_RESULT_ERROR;
-  }
+  cur = *start;
   bool nothing_after_host = false;
   if (*start == end) {
 nothing_after_host = true;
diff --git a/proxy/hdrs/unit_tests/test_URL.cc 
b/proxy/hdrs/unit_tests/test_URL.cc
index 975bd5e..2fef10a 100644
--- a/proxy/hdrs/unit_tests/test_URL.cc
+++ b/proxy/hdrs/unit_tests/test_URL.cc
@@ -64,7 +64,8 @@ TEST_CASE("ParseRulesStrictURI", "[proxy][parseuri]")
   const struct {
 const char *const uri;
 bool valid;
-  } http_strict_uri_parsing_test_case[] = {{"/home", true},
+  } http_strict_uri_parsing_test_case[] = {{"//index.html", true},
+   {"/home", true},
{"/path/data?key=value#id", true},
{"/ABCDEFGHIJKLMNOPQRSTUVWXYZ", 
true},
{"/abcdefghijklmnopqrstuvwxyz", 
true},
@@ -109,6 +110,22 @@ constexpr bool VERIFY_HOST_CHARACTERS = true;
 // clang-format off
 std::vector url_parse_test_cases = {
   {
+"/index.html",
+"/index.html",
+VERIFY_HOST_CHARACTERS,
+"/index.html",
+IS_VALID,
+IS_VALID
+  },
+  {
+"//index.html",
+"//index.html",
+VERIFY_HOST_CHARACTERS,
+"//index.html",
+IS_VALID,
+IS_VALID
+  },
+  {
 // The following scheme-only URI is technically valid per the spec, but we
 // have historically returned this as invalid and I'm not comfortable
 // changing it in case something depends upon this behavior. Besides, a
@@ -131,13 +148,13 @@ std::vector url_parse_test_cases = {
   },
   {
 // RFC 3986 section-3: When authority is not present, the path cannot begin
-// with two slash characters ("//"). The parse_regex, though, is more
-// forgiving.
+// with two slash characters ("//"). We have historically allowed this,
+// however, and will continue to do so.
+"https:;,
 "https:;,
-"",
 VERIFY_HOST_CHARACTERS,
 "https:;,
-!IS_VALID,
+IS_VALID,
 IS_VALID
   },
   {
diff --git a/tests/gold_tests/url/uri.replay.yaml 
b/tests/gold_tests/url/uri.replay.yaml
new file mode 100644
index 000..4935ff7
--- /dev/null
+++ b/tests/gold_tests/url/uri.replay.yaml
@@ -0,0 +1,86 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+#
+# This replay file assumes that caching is enabled and
+# proxy.config.http.cache.ignore_client_cc_max_age is set to 0 so that we can
+# test max-age in the client requests.
+#
+
+meta:
+  version: "1.0"
+
+  blocks:
+  - 200_ok_response: &200_ok_response
+  server-response:
+status: 200
+reason: OK
+headers:
+  fields:
+  - [ 

[trafficserver] branch master updated (73d39b1 -> aa16a29)

2020-10-12 Thread zwoop
This is an automated email from the ASF dual-hosted git repository.

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


from 73d39b1  Document external log rotation support via SIGUSR2 (#7265)
 add aa16a29  Allow initial // in request targets. (#7266)

No new revisions were added by this update.

Summary of changes:
 proxy/hdrs/URL.cc  |  8 +-
 proxy/hdrs/unit_tests/test_URL.cc  | 27 +--
 tests/gold_tests/url/uri.replay.yaml   | 86 ++
 .../cppapi/cppapi.test.py => url/uri.test.py}  | 29 +---
 4 files changed, 126 insertions(+), 24 deletions(-)
 create mode 100644 tests/gold_tests/url/uri.replay.yaml
 copy tests/gold_tests/{pluginTest/cppapi/cppapi.test.py => url/uri.test.py} 
(57%)



[trafficserver] branch 9.0.x updated: Treat objects with negative max-age CC directives as stale. (#7260)

2020-10-12 Thread zwoop
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


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 94927a3  Treat objects with negative max-age CC directives as stale. 
(#7260)
94927a3 is described below

commit 94927a319675eb12cd51cbc282cc02be5b39c72a
Author: Brian Neradt 
AuthorDate: Thu Oct 8 17:46:12 2020 -0500

Treat objects with negative max-age CC directives as stale. (#7260)

Per RFC 7234, section-1.2.1, max-age values should be a non-negative
value. If it is negative, therefore, the value is invalid.  Per RFC
7234, section-4.2.1, invalid freshness specifications should be
considered stale.

Before this change, negative max-age values were considered non-existent
and treated with a default max-age value. This fixes that so that if the
max-age is negative, it is considered stale.

(cherry picked from commit 718bef406aacdb14564cb111c3ad14cb9bc1466d)
---
 proxy/http/HttpTransact.cc |  23 +-
 tests/gold_tests/cache/cache-control.test.py   |  24 ++
 .../cache/replay/cache-control-max-age.replay.yaml | 360 +
 3 files changed, 405 insertions(+), 2 deletions(-)

diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 79cca0e..c9a1c47 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -7187,12 +7187,31 @@ HttpTransact::get_max_age(HTTPHdr *response)
   int max_age  = -1;
   uint32_t cc_mask = response->get_cooked_cc_mask();
 
+  bool max_age_is_present = false;
   if (cc_mask & MIME_COOKED_MASK_CC_S_MAXAGE) {
 // Precedence to s-maxage
-max_age = static_cast(response->get_cooked_cc_s_maxage());
+max_age= static_cast(response->get_cooked_cc_s_maxage());
+max_age_is_present = true;
   } else if (cc_mask & MIME_COOKED_MASK_CC_MAX_AGE) {
 // If s-maxage isn't set, try max-age
-max_age = static_cast(response->get_cooked_cc_max_age());
+max_age= static_cast(response->get_cooked_cc_max_age());
+max_age_is_present = true;
+  }
+
+  // Negative max-age values:
+  //
+  // Per RFC 7234, section-1.2.1, max-age values should be a non-negative
+  // value. If it is negative, therefore, the value is invalid.  Per RFC 7234,
+  // section-4.2.1, invalid freshness specifications should be considered
+  // stale.
+  //
+  // Negative return values from this function are used to indicate that the
+  // max-age value was not present, resulting in a default value likely being
+  // used. If the max-age is negative, therefore, we return 0 to indicate to
+  // the caller that the max-age directive was present and indicates that the
+  // object should be considered stale.
+  if (max_age_is_present && max_age < 0) {
+max_age = 0;
   }
 
   return max_age;
diff --git a/tests/gold_tests/cache/cache-control.test.py 
b/tests/gold_tests/cache/cache-control.test.py
index 3f59659..11964ad 100644
--- a/tests/gold_tests/cache/cache-control.test.py
+++ b/tests/gold_tests/cache/cache-control.test.py
@@ -118,3 +118,27 @@ tr.Processes.Default.Command = "printf 'GET 
/no_cache_control HTTP/1.1\r\n''Cach
 tr.Processes.Default.ReturnCode = 0
 tr.Processes.Default.Streams.stdout = "gold/cache_no_cache.gold"
 tr.StillRunningAfter = ts
+
+#
+# Verify correct handling of various max-age directives in both clients and
+# responses.
+#
+ts = Test.MakeATSProcess("ts-for-proxy-verifier")
+replay_file = "replay/cache-control-max-age.replay.yaml"
+server = Test.MakeVerifierServerProcess("proxy-verifier-server", replay_file)
+ts.Disk.records_config.update({
+'proxy.config.diags.debug.enabled': 1,
+'proxy.config.diags.debug.tags': 'http',
+'proxy.config.http.insert_age_in_response': 0,
+
+# Disable ignoring max-age in the client request so we can test that
+# behavior too.
+'proxy.config.http.cache.ignore_client_cc_max_age': 0,
+})
+ts.Disk.remap_config.AddLine(
+'map / http://127.0.0.1:{0}'.format(server.Variables.http_port)
+)
+tr = Test.AddTestRun("Verify correct max-age cache-control behavior.")
+tr.Processes.Default.StartBefore(server)
+tr.Processes.Default.StartBefore(ts)
+tr.AddVerifierClientProcess("proxy-verifier-client", replay_file, 
http_ports=[ts.Variables.port])
diff --git a/tests/gold_tests/cache/replay/cache-control-max-age.replay.yaml 
b/tests/gold_tests/cache/replay/cache-control-max-age.replay.yaml
new file mode 100644
index 000..ba6305d
--- /dev/null
+++ b/tests/gold_tests/cache/replay/cache-control-max-age.replay.yaml
@@ -0,0 +1,360 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you 

[trafficserver] branch master updated (bea630e -> 73d39b1)

2020-10-12 Thread bneradt
This is an automated email from the ASF dual-hosted git repository.

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


from bea630e  Let Dedicated EThreads use `EThread::schedule` (#7228)
 add 73d39b1  Document external log rotation support via SIGUSR2 (#7265)

No new revisions were added by this update.

Summary of changes:
 doc/appendices/command-line/traffic_manager.en.rst | 8 
 1 file changed, 8 insertions(+)