[trafficserver-ci] branch main updated: Use LLVM toolchain on ubuntu pipeline

2023-09-26 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/trafficserver-ci.git


The following commit(s) were added to refs/heads/main by this push:
 new 11f2388  Use LLVM toolchain on ubuntu pipeline
 new 5d6c8b5  Merge pull request #216 from masaori335/ubuntu2304-llvm
11f2388 is described below

commit 11f23888c3bfa0ec5dad6f0e122297ed60e8e736
Author: Masaori Koshiba 
AuthorDate: Tue Sep 26 13:43:31 2023 +0900

Use LLVM toolchain on ubuntu pipeline
---
 jenkins/github/ubuntu.pipeline | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jenkins/github/ubuntu.pipeline b/jenkins/github/ubuntu.pipeline
index fe7a049..bf87244 100644
--- a/jenkins/github/ubuntu.pipeline
+++ b/jenkins/github/ubuntu.pipeline
@@ -56,7 +56,7 @@ pipeline {
 autoreconf -fiv
 mkdir out_of_source_build_dir
 cd out_of_source_build_dir
-CC="clang" CXX="clang++" ../configure 
--enable-experimental-plugins --enable-example-plugins --enable-expensive-tests 
--prefix=/tmp/ats/ --enable-werror --enable-ccache
+CC="clang" CXX="clang++" LD="lld" AR="llvm-ar" 
NM="llvm-nm" ../configure --enable-experimental-plugins 
--enable-example-plugins --enable-expensive-tests --prefix=/tmp/ats/ 
--enable-werror --enable-ccache
 make -j4 V=1 Q=
 make -j4 check VERBOSE=Y V=1
 make install



[trafficserver] branch master updated: Suppress leak of pcre_jit_stack_alloc for unit tests (#10525)

2023-09-26 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 91f9375993 Suppress leak of pcre_jit_stack_alloc for unit tests 
(#10525)
91f9375993 is described below

commit 91f93759932adb61f9bf68b7dfe3295e0a1a8301
Author: Masaori Koshiba 
AuthorDate: Wed Sep 27 14:02:46 2023 +0900

Suppress leak of pcre_jit_stack_alloc for unit tests (#10525)
---
 ci/asan_leak_suppression/unit_tests.txt | 2 ++
 iocore/cache/Makefile.am| 1 +
 mgmt/rpc/Makefile.am| 1 +
 3 files changed, 4 insertions(+)

diff --git a/ci/asan_leak_suppression/unit_tests.txt 
b/ci/asan_leak_suppression/unit_tests.txt
index b75dec9a9c..f1848dacd5 100644
--- a/ci/asan_leak_suppression/unit_tests.txt
+++ b/ci/asan_leak_suppression/unit_tests.txt
@@ -4,3 +4,5 @@ leak:libcrypto.so.1.1
 leak:CRYPTO_malloc
 leak:CRYPTO_realloc
 leak:ConsCell
+# PR#10295
+leak:pcre_jit_stack_alloc
diff --git a/iocore/cache/Makefile.am b/iocore/cache/Makefile.am
index 2313b66f5e..6cceca8a78 100644
--- a/iocore/cache/Makefile.am
+++ b/iocore/cache/Makefile.am
@@ -64,6 +64,7 @@ libinkcache_a_SOURCES += \
 endif
 
 TESTS = $(check_PROGRAMS)
+TESTS_ENVIRONMENT = 
LSAN_OPTIONS=suppressions=$(abs_top_srcdir)/ci/asan_leak_suppression/unit_tests.txt
 
 test_CPPFLAGS = \
$(AM_CPPFLAGS) \
diff --git a/mgmt/rpc/Makefile.am b/mgmt/rpc/Makefile.am
index d8afc528fe..f6cd65082c 100644
--- a/mgmt/rpc/Makefile.am
+++ b/mgmt/rpc/Makefile.am
@@ -32,6 +32,7 @@ check_PROGRAMS = test_jsonrpc test_jsonrpcserver
 
 
 TESTS = $(check_PROGRAMS)
+TESTS_ENVIRONMENT = 
LSAN_OPTIONS=suppressions=$(abs_top_srcdir)/ci/asan_leak_suppression/unit_tests.txt
 
 
###
 # Protocol library only, no transport.



[trafficserver] branch master updated (f75cee4311 -> a3f807d298)

2023-09-18 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from f75cee4311 adding a pristine option for strategies (#10410)
 add a3f807d298 CID 1518583: Unchecked return value (#10394)

No new revisions were added by this update.

Summary of changes:
 plugins/experimental/cache_fill/cache_fill.cc | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)



[trafficserver] branch master updated (1ecdebb4d4 -> c120dcd24e)

2023-10-11 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from 1ecdebb4d4 Move APIHook classes to tsapicore (#10148)
 add c120dcd24e Make NextHopConsistentHash unit test stable (#10551)

No new revisions were added by this update.

Summary of changes:
 .../remap/unit-tests/test_NextHopConsistentHash.cc | 67 +-
 1 file changed, 40 insertions(+), 27 deletions(-)



[trafficserver] branch master updated: Improve performance of finding SNI Actions (#9736)

2023-10-08 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 362786af70 Improve performance of finding SNI Actions (#9736)
362786af70 is described below

commit 362786af705894caee880d4a4f81514495c687bd
Author: Masaori Koshiba 
AuthorDate: Sun Oct 8 19:32:31 2023 +0900

Improve performance of finding SNI Actions (#9736)

* Improve performance of finding SNI Actions

* Fix AuTest
---
 include/tscpp/util/Convert.h   | 46 +++
 iocore/net/SSLCertLookup.cc| 31 +++-
 iocore/net/SSLSNIConfig.cc | 89 +++---
 iocore/net/SSLSNIConfig.h  | 12 +--
 iocore/net/unit_tests/sni_conf_test.yaml   | 11 +++
 iocore/net/unit_tests/test_SSLSNIConfig.cc | 10 ++-
 iocore/net/unit_tests/test_YamlSNIConfig.cc|  2 +-
 iocore/net/unit_tests/unit_test_main.cc|  5 ++
 tests/gold_tests/h2/h2disable.test.py  |  2 +-
 .../h2/h2disable_no_accept_threads.test.py |  2 +-
 tests/gold_tests/h2/h2enable.test.py   |  2 +-
 .../h2/h2enable_no_accept_threads.test.py  |  2 +-
 tests/gold_tests/tls/tls_client_cert2.test.py  |  4 +-
 .../gold_tests/tls/tls_client_cert2_plugin.test.py |  4 +-
 tests/gold_tests/tls/tls_client_verify.test.py |  8 +-
 tests/gold_tests/tls/tls_client_verify2.test.py|  4 +-
 tests/gold_tests/tls/tls_tunnel.test.py| 16 ++--
 tests/gold_tests/tls/tls_verify3.test.py   | 10 +--
 18 files changed, 197 insertions(+), 63 deletions(-)

diff --git a/include/tscpp/util/Convert.h b/include/tscpp/util/Convert.h
new file mode 100644
index 00..b95fc3675a
--- /dev/null
+++ b/include/tscpp/util/Convert.h
@@ -0,0 +1,46 @@
+/** @file
+
+  Collection of utility functions for converting between different chars.
+
+  @section license License
+
+  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.
+ */
+
+#pragma once
+
+#include "swoc/MemSpan.h"
+
+#include 
+
+namespace ts
+{
+/** Copy @a src to @a dst, transforming to lower case.
+ *
+ * @param src Input string.
+ * @param dst Output buffer.
+ */
+inline void
+transform_lower(std::string_view src, swoc::MemSpan dst)
+{
+  if (src.size() > dst.size() - 1) { // clip @a src, reserving space for the 
terminal nul.
+src = std::string_view{src.data(), dst.size() - 1};
+  }
+  auto final = std::transform(src.begin(), src.end(), dst.data(), [](char c) 
-> char { return std::tolower(c); });
+  *final++   = '\0';
+}
+} // namespace ts
diff --git a/iocore/net/SSLCertLookup.cc b/iocore/net/SSLCertLookup.cc
index f736f84db8..ac570e28ea 100644
--- a/iocore/net/SSLCertLookup.cc
+++ b/iocore/net/SSLCertLookup.cc
@@ -35,6 +35,8 @@
 
 #include "tscore/TestBox.h"
 
+#include "tscpp/util/Convert.h"
+
 #include "I_EventSystem.h"
 
 #include "P_SSLUtils.h"
@@ -143,24 +145,6 @@ private:
   int store(SSLCertContext const );
 };
 
-namespace
-{
-/** Copy @a src to @a dst, transforming to lower case.
- *
- * @param src Input string.
- * @param dst Output buffer.
- */
-inline void
-transform_lower(std::string_view src, swoc::MemSpan dst)
-{
-  if (src.size() > dst.size() - 1) { // clip @a src, reserving space for the 
terminal nul.
-src = std::string_view{src.data(), dst.size() - 1};
-  }
-  auto final = std::transform(src.begin(), src.end(), dst.data(), [](char c) 
-> char { return std::tolower(c); });
-  *final++   = '\0';
-}
-} // namespace
-
 // Zero out and free the heap space allocated for ticket keys to avoid leaking 
secrets.
 // The first several bytes stores the number of keys and the rest stores the 
ticket keys.
 void
@@ -461,7 +445,7 @@ SSLContextStorage::insert(const char *name, int idx)
 {
   ats_wildcard_matcher wildcard;
   char lower_case_name[TS_MAX_HOST_NAME_LEN + 1];
-  transform_lower(name, lower_case_name);
+  ts::transform_lower(name, lower_case_name);
 
   shared_SSL_CTX ctx = this->ctx_store[idx].getCtx();
   if (wildcard.matc

[trafficserver] branch master updated: Cleanup: Move Vol implementations into Vol.cc (#10600)

2023-10-17 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 8e0e9262df Cleanup: Move Vol implementations into Vol.cc (#10600)
8e0e9262df is described below

commit 8e0e9262dfc082af6ed28465c91bace8348b78fa
Author: Masaori Koshiba 
AuthorDate: Wed Oct 18 08:48:10 2023 +0900

Cleanup: Move Vol implementations into Vol.cc (#10600)
---
 iocore/cache/CMakeLists.txt |   1 +
 iocore/cache/Cache.cc   | 722 +-
 iocore/cache/CacheDir.cc| 170 
 iocore/cache/Makefile.am|   3 +-
 iocore/cache/P_CacheDir.h   |   2 +-
 iocore/cache/P_CacheVol.h   |   6 +-
 iocore/cache/Vol.cc | 918 
 7 files changed, 927 insertions(+), 895 deletions(-)

diff --git a/iocore/cache/CMakeLists.txt b/iocore/cache/CMakeLists.txt
index 2a632b7439..e4180a62f1 100644
--- a/iocore/cache/CMakeLists.txt
+++ b/iocore/cache/CMakeLists.txt
@@ -32,6 +32,7 @@ add_library(
   RamCacheCLFUS.cc
   RamCacheLRU.cc
   Store.cc
+  Vol.cc
 )
 add_library(ts::inkcache ALIAS inkcache)
 
diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index 516feab766..2a590a116d 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -21,18 +21,14 @@
   limitations under the License.
  */
 
-#include "P_Cache.h"
+#include "I_Cache.h"
 
 // Cache Inspector and State Pages
 #include "P_CacheTest.h"
 #include "StatPages.h"
 
-#include "tscore/I_Layout.h"
 #include "tscore/Filenames.h"
 
-#include "api/InkAPIInternal.h"
-
-#include "tscore/hugepages.h"
 #include "records/P_RecProcess.h"
 
 #ifdef AIO_FAULT_INJECTION
@@ -45,9 +41,6 @@ constexpr ts::VersionNumber 
CACHE_DB_VERSION(CACHE_DB_MAJOR_VERSION, CACHE_DB_MI
 
 static size_t DEFAULT_RAM_CACHE_MULTIPLIER = 10; // I.e. 10x 1MB per 1GB of 
disk.
 
-// This is the oldest version number that is still usable.
-static short int const CACHE_DB_MAJOR_VERSION_COMPATIBLE = 21;
-
 // Configuration
 
 int64_t cache_config_ram_cache_size= AUTO_SIZE_RAM_CACHE;
@@ -112,28 +105,6 @@ DbgCtl dbg_ctl_ram_cache{"ram_cache"};
 
 } // end anonymous namespace
 
-struct VolInitInfo {
-  off_t recover_pos;
-  AIOCallbackInternal vol_aio[4];
-  char *vol_h_f;
-
-  VolInitInfo()
-  {
-recover_pos = 0;
-vol_h_f = static_cast(ats_memalign(ats_pagesize(), 4 * 
STORE_BLOCK_SIZE));
-memset(vol_h_f, 0, 4 * STORE_BLOCK_SIZE);
-  }
-
-  ~VolInitInfo()
-  {
-for (auto  : vol_aio) {
-  i.action = nullptr;
-  i.mutex.clear();
-}
-free(vol_h_f);
-  }
-};
-
 void cplist_init();
 static void cplist_update();
 int cplist_reconfigure();
@@ -298,72 +269,6 @@ update_cache_config(const char * /* name ATS_UNUSED */, 
RecDataT /* data_type AT
   return 0;
 }
 
-int
-Vol::begin_read(CacheVC *cont) const
-{
-  ink_assert(cont->mutex->thread_holding == this_ethread());
-  ink_assert(mutex->thread_holding == this_ethread());
-#ifdef CACHE_STAT_PAGES
-  ink_assert(!cont->stat_link.next && !cont->stat_link.prev);
-  stat_cache_vcs.enqueue(cont, cont->stat_link);
-#endif
-  // no need for evacuation as the entire document is already in memory
-  if (cont->f.single_fragment) {
-return 0;
-  }
-  int i = dir_evac_bucket(>earliest_dir);
-  EvacuationBlock *b;
-  for (b = evacuate[i].head; b; b = b->link.next) {
-if (dir_offset(>dir) != dir_offset(>earliest_dir)) {
-  continue;
-}
-if (b->readers) {
-  b->readers = b->readers + 1;
-}
-return 0;
-  }
-  // we don't actually need to preserve this block as it is already in
-  // memory, but this is easier, and evacuations are rare
-  EThread *t= cont->mutex->thread_holding;
-  b = new_EvacuationBlock(t);
-  b->readers= 1;
-  b->dir= cont->earliest_dir;
-  b->evac_frags.key = cont->earliest_key;
-  evacuate[i].push(b);
-  return 1;
-}
-
-int
-Vol::close_read(CacheVC *cont) const
-{
-  EThread *t = cont->mutex->thread_holding;
-  ink_assert(t == this_ethread());
-  ink_assert(t == mutex->thread_holding);
-  if (dir_is_empty(>earliest_dir)) {
-return 1;
-  }
-  int i = dir_evac_bucket(>earliest_dir);
-  EvacuationBlock *b;
-  for (b = evacuate[i].head; b;) {
-EvacuationBlock *next = b->link.next;
-if (dir_offset(>dir) != dir_offset(>earliest_dir)) {
-  b = next;
-  continue;
-}
-if (b->readers && !--b->readers) {
-  evacuate[i].remove(b);
-  free_EvacuationBlock(b, t);
-  break;
-}
-b = next;
-  }
-#ifdef CACHE_STAT_PAGES
-  stat_cache_vcs.remove(cont, cont->stat_link);
-  ink_assert(!cont->stat_link.next && !cont->stat_link.prev)

[trafficserver] branch master updated (a8efca5897 -> 3264569366)

2023-10-10 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from a8efca5897 Fix H2 debug message for a rate limit (#10583)
 add 3264569366 LSan: Fix memory leak of Cache Unit Tests (#10540)

No new revisions were added by this update.

Summary of changes:
 iocore/cache/test/main.h | 19 +++
 1 file changed, 19 insertions(+)



[trafficserver] branch master updated: s3_auth: Clear handling TSAction in the config_reloader (#10556)

2023-10-15 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 baeaf9a07f s3_auth: Clear handling TSAction in the config_reloader 
(#10556)
baeaf9a07f is described below

commit baeaf9a07f627a463f6fcfc0df6e0ae19e31fd0e
Author: Masaori Koshiba 
AuthorDate: Mon Oct 16 08:03:54 2023 +0900

s3_auth: Clear handling TSAction in the config_reloader (#10556)
---
 plugins/s3_auth/s3_auth.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/plugins/s3_auth/s3_auth.cc b/plugins/s3_auth/s3_auth.cc
index f43ce16006..a849cabf94 100644
--- a/plugins/s3_auth/s3_auth.cc
+++ b/plugins/s3_auth/s3_auth.cc
@@ -1053,7 +1053,9 @@ int
 config_reloader(TSCont cont, TSEvent event, void *edata)
 {
   Dbg(dbg_ctl, "reloading configs");
-  S3Config *s3  = static_cast(TSContDataGet(cont));
+  S3Config *s3 = static_cast(TSContDataGet(cont));
+  s3->check_current_action(edata);
+
   S3Config *file_config = gConfCache.get(s3->conf_fname());
 
   if (!file_config || !file_config->valid()) {
@@ -1064,7 +1066,6 @@ config_reloader(TSCont cont, TSEvent event, void *edata)
   {
 std::unique_lock lock(s3->reload_mutex);
 s3->copy_changes_from(file_config);
-s3->check_current_action(edata);
   }
 
   if (s3->expiration() == 0) {



[trafficserver] branch master updated: doc: fix typo min to max, and disabled by default for TLSv1 and TLSv1_0 (#10557)

2023-10-04 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 492aa3216f doc: fix typo min to max, and disabled by default for TLSv1 
and TLSv1_0 (#10557)
492aa3216f is described below

commit 492aa3216f56cb8973e3a5725c4dc9d711567d5b
Author: Hiroaki Nakamura 
AuthorDate: Thu Oct 5 10:37:49 2023 +0900

doc: fix typo min to max, and disabled by default for TLSv1 and TLSv1_0 
(#10557)
---
 doc/admin-guide/files/records.yaml.en.rst | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/doc/admin-guide/files/records.yaml.en.rst 
b/doc/admin-guide/files/records.yaml.en.rst
index 048b92927d..f30e8f87b6 100644
--- a/doc/admin-guide/files/records.yaml.en.rst
+++ b/doc/admin-guide/files/records.yaml.en.rst
@@ -4097,23 +4097,23 @@ Client-Related Configuration
:deprecated:
 
This setting is deprecated in favor of 
:ts:cv:`proxy.config.ssl.client.version.min` and
-   :ts:cv:`proxy.config.ssl.client.version.min`, and will be ignored if those 
new settings are used.
+   :ts:cv:`proxy.config.ssl.client.version.max`, and will be ignored if those 
new settings are used.
 
-   Enables (``1``) or disables (``0``) TLSv1.0 in the ATS client context. If 
not specified, enabled by default
+   Enables (``1``) or disables (``0``) TLSv1.0 in the ATS client context. If 
not specified, disabled by default
 
 .. ts:cv:: CONFIG proxy.config.ssl.client.TLSv1_1 INT 0
:deprecated:
 
This setting is deprecated in favor of 
:ts:cv:`proxy.config.ssl.client.version.min` and
-   :ts:cv:`proxy.config.ssl.client.version.min`, and will be ignored if those 
new settings are used.
+   :ts:cv:`proxy.config.ssl.client.version.max`, and will be ignored if those 
new settings are used.
 
-   Enables (``1``) or disables (``0``) TLSv1_1 in the ATS client context. If 
not specified, enabled by default
+   Enables (``1``) or disables (``0``) TLSv1_1 in the ATS client context. If 
not specified, disabled by default
 
 .. ts:cv:: CONFIG proxy.config.ssl.client.TLSv1_2 INT 1
:deprecated:
 
This setting is deprecated in favor of 
:ts:cv:`proxy.config.ssl.client.version.min` and
-   :ts:cv:`proxy.config.ssl.client.version.min`, and will be ignored if those 
new settings are used.
+   :ts:cv:`proxy.config.ssl.client.version.max`, and will be ignored if those 
new settings are used.
 
Enables (``1``) or disables (``0``) TLSv1_2 in the ATS client context. If 
not specified, enabled by default
 
@@ -4121,7 +4121,7 @@ Client-Related Configuration
:deprecated:
 
This setting is deprecated in favor of 
:ts:cv:`proxy.config.ssl.client.version.min` and
-   :ts:cv:`proxy.config.ssl.client.version.min`, and will be ignored if those 
new settings are used.
+   :ts:cv:`proxy.config.ssl.client.version.max`, and will be ignored if those 
new settings are used.
 
Enables (``1``) or disables (``0``) TLSv1_3 in the ATS client context. If 
not specified, enabled by default
 



[trafficserver] branch master updated: Convert CacheVol regression tests into unit tests (#10649)

2023-10-23 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 ed16edfa2d Convert CacheVol regression tests into unit tests (#10649)
ed16edfa2d is described below

commit ed16edfa2d50e2cbd75b8455b9d4ba48ff7d1e01
Author: Masaori Koshiba 
AuthorDate: Tue Oct 24 08:59:15 2023 +0900

Convert CacheVol regression tests into unit tests (#10649)
---
 src/iocore/cache/CacheHosting.cc | 330 --
 src/iocore/cache/Makefile.am |   8 +
 src/iocore/cache/unit_tests/storage.config   |   2 +-
 src/iocore/cache/unit_tests/test_CacheVol.cc | 396 +++
 src/tests/CMakeLists.txt |   1 +
 5 files changed, 406 insertions(+), 331 deletions(-)

diff --git a/src/iocore/cache/CacheHosting.cc b/src/iocore/cache/CacheHosting.cc
index ac28fcd1d5..e2c0ccbf79 100644
--- a/src/iocore/cache/CacheHosting.cc
+++ b/src/iocore/cache/CacheHosting.cc
@@ -27,11 +27,8 @@
 #include "tscore/Layout.h"
 #include "tscore/HostLookup.h"
 #include "tscore/Tokenizer.h"
-#include "tscore/Regression.h"
 #include "tscore/Filenames.h"
 
-extern int gndisks;
-
 namespace
 {
 
@@ -797,330 +794,3 @@ ConfigVolumes::BuildListFromString(char 
*config_file_path, char *file_buf)
 
   return;
 }
-
-/* Test the cache volume with different configurations */
-#define MEGS_128  (128 * 1024 * 1024)
-#define ROUND_TO_VOL_SIZE(_x) (((_x) + (MEGS_128 - 1)) & ~(MEGS_128 - 1))
-extern CacheDisk **gdisks;
-extern Queue cp_list;
-extern int cp_list_len;
-extern ConfigVolumes config_volumes;
-
-extern void cplist_init();
-extern int cplist_reconfigure();
-static int configs = 4;
-
-Queue saved_cp_list;
-int saved_cp_list_len;
-ConfigVolumes saved_config_volumes;
-int saved_gnvol;
-
-static int ClearConfigVol(ConfigVolumes *configp);
-static int ClearCacheVolList(Queue *cpl, int len);
-static int create_config(RegressionTest *t, int i);
-static int execute_and_verify(RegressionTest *t);
-static void save_state();
-static void restore_state();
-
-EXCLUSIVE_REGRESSION_TEST(Cache_vol)(RegressionTest *t, int /* atype 
ATS_UNUSED */, int *status)
-{
-  save_state();
-  srand48(time(nullptr));
-  *status = REGRESSION_TEST_PASSED;
-  for (int i = 0; i < configs; i++) {
-if (create_config(t, i)) {
-  if (execute_and_verify(t) == REGRESSION_TEST_FAILED) {
-*status = REGRESSION_TEST_FAILED;
-  }
-}
-  }
-  restore_state();
-  return;
-}
-
-int
-create_config(RegressionTest *t, int num)
-{
-  int i   = 0;
-  int vol_num = 1;
-  // clear all old configurations before adding new test cases
-  config_volumes.clear_all();
-  switch (num) {
-  case 0:
-for (i = 0; i < gndisks; i++) {
-  CacheDisk *d = gdisks[i];
-  int blocks   = d->num_usable_blocks;
-  if (blocks < STORE_BLOCKS_PER_VOL) {
-rprintf(t, "Cannot run Cache_vol regression: not enough disk space\n");
-return 0;
-  }
-  /* create 128 MB volumes */
-  for (; blocks >= STORE_BLOCKS_PER_VOL; blocks -= STORE_BLOCKS_PER_VOL) {
-if (vol_num > 255) {
-  break;
-}
-ConfigVol *cp  = new ConfigVol();
-cp->number = vol_num++;
-cp->scheme = CACHE_HTTP_TYPE;
-cp->size   = 128;
-cp->in_percent = false;
-cp->cachep = nullptr;
-config_volumes.cp_queue.enqueue(cp);
-config_volumes.num_volumes++;
-config_volumes.num_http_volumes++;
-  }
-}
-rprintf(t, "%d 128 Megabyte Volumes\n", vol_num - 1);
-break;
-
-  case 1: {
-for (i = 0; i < gndisks; i++) {
-  gdisks[i]->delete_all_volumes();
-}
-
-// calculate the total free space
-off_t total_space = 0;
-for (i = 0; i < gndisks; i++) {
-  off_t vol_blocks = gdisks[i]->num_usable_blocks;
-  /* round down the blocks to the nearest
- multiple of STORE_BLOCKS_PER_VOL */
-  vol_blocks   = (vol_blocks / STORE_BLOCKS_PER_VOL) * 
STORE_BLOCKS_PER_VOL;
-  total_space += vol_blocks;
-}
-
-// make sure we have at least 1280 M bytes
-if (total_space < ((10 << 27) >> STORE_BLOCK_SHIFT)) {
-  rprintf(t, "Not enough space for 10 volume\n");
-  return 0;
-}
-
-vol_num = 1;
-rprintf(t, "Cleared  disk\n");
-for (i = 0; i < 10; i++) {
-  ConfigVol *cp  = new ConfigVol();
-  cp->number = vol_num++;
-  cp->scheme = CACHE_HTTP_TYPE;
-  cp->size   = 10;
-  cp->percent= 10;
-  cp->in_percent = true;
-  cp->cachep = nullptr;
-  config_volumes.cp_queue.enqueue(cp);
-  config_volumes.num_volumes++;
-  config_volumes.num

[trafficserver] branch master updated: Fix good_request_after_bad AuTest (#10664)

2023-10-23 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 78506e0f2d Fix good_request_after_bad AuTest (#10664)
78506e0f2d is described below

commit 78506e0f2d2f9632c65f93c06b0fb50c7e72444a
Author: Masaori Koshiba 
AuthorDate: Tue Oct 24 08:59:30 2023 +0900

Fix good_request_after_bad AuTest (#10664)
---
 tests/gold_tests/headers/gold/bad_method.gold | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/gold_tests/headers/gold/bad_method.gold 
b/tests/gold_tests/headers/gold/bad_method.gold
index 635506f6c9..42098613f9 100644
--- a/tests/gold_tests/headers/gold/bad_method.gold
+++ b/tests/gold_tests/headers/gold/bad_method.gold
@@ -2,7 +2,7 @@ HTTP/1.1 501 Unsupported method ('gET')
 Content-Type: text/html;charset=utf-8
 Content-Length: ``
 Date: ``
-Age: 0
+Age: ``
 Connection: keep-alive
 Server: ATS/``
 



[trafficserver] branch master updated: LSan: Fix memory leak of test_X509HostnameValidator (#10161)

2023-08-15 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 9ea4a175ba LSan: Fix memory leak of test_X509HostnameValidator (#10161)
9ea4a175ba is described below

commit 9ea4a175ba2ad364a61202b19e591837103ee5df
Author: Masaori Koshiba 
AuthorDate: Wed Aug 16 07:10:21 2023 +0900

LSan: Fix memory leak of test_X509HostnameValidator (#10161)
---
 src/tscore/unit_tests/test_X509HostnameValidator.cc | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/src/tscore/unit_tests/test_X509HostnameValidator.cc 
b/src/tscore/unit_tests/test_X509HostnameValidator.cc
index 14ef0d0a88..cc1e69b952 100644
--- a/src/tscore/unit_tests/test_X509HostnameValidator.cc
+++ b/src/tscore/unit_tests/test_X509HostnameValidator.cc
@@ -35,6 +35,8 @@
 #include "tscore/ink_queue.h"
 #include "tscore/X509HostnameValidator.h"
 
+#include "tscpp/util/PostScript.h"
+
 // clang-format off
 
 // A simple certificate for CN=test.sslheaders.trafficserver.apache.org.
@@ -98,6 +100,8 @@ static X509 *
 load_cert_from_string(const char *cert_string)
 {
   BIO *bio = BIO_new_mem_buf((void *)cert_string, -1);
+  ts::PostScript bio_defer([&]() -> void { BIO_free(bio); });
+
   return PEM_read_bio_X509(bio, nullptr, nullptr, nullptr);
 }
 
@@ -105,6 +109,8 @@ TEST_CASE("CN_match", "[libts][X509HostnameValidator]")
 {
   char *matching;
   X509 *x = load_cert_from_string(test_certificate_cn);
+  ts::PostScript x_defer([&]() -> void { X509_free(x); });
+
   REQUIRE(x != nullptr);
   REQUIRE(validate_hostname(x, (unsigned char *)test_certificate_cn_name, 
false, ) == true);
   REQUIRE(strcmp(test_certificate_cn_name, matching) == 0);
@@ -115,6 +121,8 @@ TEST_CASE("CN_match", "[libts][X509HostnameValidator]")
 TEST_CASE("bad_wildcard_SANs", "[libts][X509HostnameValidator]")
 {
   X509 *x = load_cert_from_string(test_certificate_bad_sans);
+  ts::PostScript x_defer([&]() -> void { X509_free(x); });
+
   REQUIRE(x != nullptr);
   REQUIRE(validate_hostname(x, (unsigned char *)"something.or.other", false, 
nullptr) == false);
   REQUIRE(validate_hostname(x, (unsigned char *)"a.b.c", false, nullptr) == 
false);
@@ -127,6 +135,8 @@ TEST_CASE("wildcard_SAN_and_CN", 
"[libts][X509HostnameValidator]")
 {
   char *matching;
   X509 *x = load_cert_from_string(test_certificate_cn_and_SANs);
+  ts::PostScript x_defer([&]() -> void { X509_free(x); });
+
   REQUIRE(x != nullptr);
   REQUIRE(validate_hostname(x, (unsigned char *)test_certificate_cn_name, 
false, ) == true);
   REQUIRE(strcmp(test_certificate_cn_name, matching) == 0);
@@ -143,6 +153,8 @@ TEST_CASE("IDNA_hostnames", 
"[libts][X509HostnameValidator]")
 {
   char *matching;
   X509 *x = load_cert_from_string(test_certificate_cn_and_SANs);
+  ts::PostScript x_defer([&]() -> void { X509_free(x); });
+
   REQUIRE(x != nullptr);
   REQUIRE(validate_hostname(x, (unsigned char 
*)"xn--foobar.trafficserver.org", false, ) == true);
   REQUIRE(strcmp("*.trafficserver.org", matching) == 0);
@@ -156,6 +168,8 @@ TEST_CASE("middle_label_match", 
"[libts][X509HostnameValidator]")
 {
   char *matching;
   X509 *x = load_cert_from_string(test_certificate_cn_and_SANs);
+  ts::PostScript x_defer([&]() -> void { X509_free(x); });
+
   REQUIRE(x != nullptr);
   REQUIRE(validate_hostname(x, (unsigned char 
*)"foosomething.trafficserver.com", false, ) == true);
   REQUIRE(strcmp("foo*.trafficserver.com", matching) == 0);



[trafficserver] branch master updated (9ea4a175ba -> 1405ba1d20)

2023-08-15 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from 9ea4a175ba LSan: Fix memory leak of test_X509HostnameValidator (#10161)
 add 1405ba1d20 LSan: Fix memory leak of test_EventSystem (#10178)

No new revisions were added by this update.

Summary of changes:
 iocore/eventsystem/unit_tests/test_EventSystem.cc | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)



[trafficserver] branch master updated (1405ba1d20 -> ba95aa1ba3)

2023-08-15 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from 1405ba1d20 LSan: Fix memory leak of test_EventSystem (#10178)
 add ba95aa1ba3 LSan: Fix leak of test_Metrics (#10179)

No new revisions were added by this update.

Summary of changes:
 include/api/Metrics.h | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)



(trafficserver) branch master updated: Rename VOL macros to STRIPE (#10755)

2023-11-09 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 5986624ff0 Rename VOL macros to STRIPE (#10755)
5986624ff0 is described below

commit 5986624ff0f42e624d7951c143e44bd289db4454
Author: Masaori Koshiba 
AuthorDate: Fri Nov 10 12:01:53 2023 +0900

Rename VOL macros to STRIPE (#10755)
---
 .../cache-architecture/cache-initialization.en.rst |  6 +++---
 .../cache-architecture/data-structures.en.rst  |  4 ++--
 src/iocore/cache/Cache.cc  | 24 +++---
 src/iocore/cache/CacheDisk.cc  | 11 +-
 src/iocore/cache/CacheTest.cc  |  4 ++--
 src/iocore/cache/P_CacheDisk.h |  9 +---
 src/iocore/cache/P_CacheVol.h  | 24 --
 src/iocore/cache/Stripe.cc | 12 +--
 src/iocore/cache/unit_tests/test_CacheVol.cc   | 17 +++
 src/traffic_cache_tool/CacheDefs.h | 24 +++---
 src/traffic_cache_tool/CacheTool.cc| 16 +++
 11 files changed, 74 insertions(+), 77 deletions(-)

diff --git a/doc/developer-guide/cache-architecture/cache-initialization.en.rst 
b/doc/developer-guide/cache-architecture/cache-initialization.en.rst
index 91fe64fadc..ea26ed47d4 100644
--- a/doc/developer-guide/cache-architecture/cache-initialization.en.rst
+++ b/doc/developer-guide/cache-architecture/cache-initialization.en.rst
@@ -84,10 +84,10 @@ stripes to be assigned are in 
:member:`CacheHostRecord::vols`.
 An indirect index mapping is created to account for stripes that are not 
available. The total size
 of the stripes is computed at the same time. The :code:`forvol` and 
:code:`getvol` arrays are used
 for debugging, they are not essential to the assignment setup. 
:code:`rtable_entries` is filled with
-stripe size divided by :code:`VOL_HASH_ALLOC_SIZE`. These values are used to 
determine the number of
+stripe size divided by :code:`STRIPE_HASH_ALLOC_SIZE`. These values are used 
to determine the number of
 assignment slots given to each stripe. For each stripe a seed for a 32 bit 
pseudo random number
 generator is created based on stripe properties. Another array of pairs of 
value and stripe index is
-filled using these. For each :code:`VOL_HASH_ALLOC_SIZE` amount of space in a 
stripe, a pair is
+filled using these. For each :code:`STRIPE_HASH_ALLOC_SIZE` amount of space in 
a stripe, a pair is
 generated containing the stripe index and the next random number from that 
stripe's generator. This
 array is then sorted in ascending order.
 
@@ -97,7 +97,7 @@ array is then sorted in ascending order.
<http://random.org>`__ is used.
 
 The result is sampled in sections, the size of the sections selected to yield
-:code:`VOL_HASH_TABLE_SIZE` sections. For each section the sample value is the 
midpoint of the
+:code:`STRIPE_HASH_TABLE_SIZE` sections. For each section the sample value is 
the midpoint of the
 section.For the example, the number of sections is set to 17 (because the 
number of sections should
 be a prime number). This yields 17 sections each of width 15 with a sample 
value equal to 7 more
 than the initial value. The results of applying this to the :code:`rtable` is
diff --git a/doc/developer-guide/cache-architecture/data-structures.en.rst 
b/doc/developer-guide/cache-architecture/data-structures.en.rst
index 22f1fef4c9..e3c3fc00fa 100644
--- a/doc/developer-guide/cache-architecture/data-structures.en.rst
+++ b/doc/developer-guide/cache-architecture/data-structures.en.rst
@@ -306,7 +306,7 @@ Data Structures
 
.. member:: unsigned int magic
 
-  Container for a magic value, ``VOL_MAGIC``, to indicate the instance is 
valid.
+  Container for a magic value, ``STRIPE_MAGIC``, to indicate the instance 
is valid.
 
.. member:: VersionNumber version
 
@@ -467,7 +467,7 @@ Data Structures
   Compute the stripe (:code:`Stripe *`) for a cache :arg:`key` and 
:arg:`host`. The :arg:`host` is
   used to find the appropriate :class:`CacheHostRecord` instance. From 
there the stripe
   assignment slot is determined by taking bits 64..83 (20 bits) of the 
cache :arg:`key` modulo
-  the stripe assignment array count (:code:`VOL_HASH_TABLE_SIZE`). These 
bits are the third 32
+  the stripe assignment array count (:code:`STRIPE_HASH_TABLE_SIZE`). 
These bits are the third 32
   bit slice of the :arg:`key` less the bottom :code:`DIR_TAG_WIDTH` (12) 
bits.
 
 .. rubric:: Footnotes
diff --git a/src/iocore/cache/Cache.cc b/src/iocore/cache/Cache.cc
index c700251b83..fd29b76ef4 100644
--- a/src/iocore/cache/Cache.cc
+++ b/src/iocore/cache/Cache.cc
@@ -905,21 +905,21 @@ build_vol_hash_table(CacheHostRecord *cp)
   unsigned int *forvol   = static_cast(ats_

(trafficserver) branch master updated: Remove ProxyMutex dependency from rand_CacheKey (#10705)

2023-11-09 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 6d7ffc6ac7 Remove ProxyMutex dependency from rand_CacheKey (#10705)
6d7ffc6ac7 is described below

commit 6d7ffc6ac72715ef858a1293e2afaf95775cf76a
Author: Masaori Koshiba 
AuthorDate: Fri Nov 10 08:02:02 2023 +0900

Remove ProxyMutex dependency from rand_CacheKey (#10705)
---
 src/iocore/cache/CacheTest.cc| 10 --
 src/iocore/cache/CacheWrite.cc   |  6 +++---
 src/iocore/cache/P_CacheInternal.h   |  8 +---
 src/iocore/cache/unit_tests/test_CacheDir.cc | 16 
 4 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/src/iocore/cache/CacheTest.cc b/src/iocore/cache/CacheTest.cc
index bc669ecb31..2b3bd8e3f6 100644
--- a/src/iocore/cache/CacheTest.cc
+++ b/src/iocore/cache/CacheTest.cc
@@ -298,13 +298,11 @@ EXCLUSIVE_REGRESSION_TEST(cache)(RegressionTest *t, int 
/* atype ATS_UNUSED */,
 return;
   }
 
-  EThread *thread = this_ethread();
-
   CACHE_SM(t, write_test, { cacheProcessor.open_write(this, , 
CACHE_FRAG_TYPE_NONE, 100, CACHE_WRITE_OPT_SYNC); });
   write_test.expect_initial_event = CACHE_EVENT_OPEN_WRITE;
   write_test.expect_event = VC_EVENT_WRITE_COMPLETE;
   write_test.nbytes   = 100;
-  rand_CacheKey(_test.key, thread->mutex);
+  rand_CacheKey(_test.key);
 
   CACHE_SM(t, lookup_test, { cacheProcessor.lookup(this, ); });
   lookup_test.expect_event = CACHE_EVENT_LOOKUP;
@@ -330,7 +328,7 @@ EXCLUSIVE_REGRESSION_TEST(cache)(RegressionTest *t, int /* 
atype ATS_UNUSED */,
 
   CACHE_SM(t, remove_fail_test, { cacheProcessor.remove(this, ); });
   remove_fail_test.expect_event = CACHE_EVENT_REMOVE_FAILED;
-  rand_CacheKey(_fail_test.key, thread->mutex);
+  rand_CacheKey(_fail_test.key);
 
   CACHE_SM(
 t, replace_write_test,
@@ -343,7 +341,7 @@ EXCLUSIVE_REGRESSION_TEST(cache)(RegressionTest *t, int /* 
atype ATS_UNUSED */,
   replace_write_test.expect_initial_event = CACHE_EVENT_OPEN_WRITE;
   replace_write_test.expect_event = VC_EVENT_WRITE_COMPLETE;
   replace_write_test.nbytes   = 100;
-  rand_CacheKey(_write_test.key, thread->mutex);
+  rand_CacheKey(_write_test.key);
 
   CACHE_SM(
 t, replace_test,
@@ -387,7 +385,7 @@ EXCLUSIVE_REGRESSION_TEST(cache)(RegressionTest *t, int /* 
atype ATS_UNUSED */,
   large_write_test.expect_initial_event = CACHE_EVENT_OPEN_WRITE;
   large_write_test.expect_event = VC_EVENT_WRITE_COMPLETE;
   large_write_test.nbytes   = 1000;
-  rand_CacheKey(_write_test.key, thread->mutex);
+  rand_CacheKey(_write_test.key);
 
   CACHE_SM(
 t, pread_test, { cacheProcessor.open_read(this, ); } int 
open_read_callout() override {
diff --git a/src/iocore/cache/CacheWrite.cc b/src/iocore/cache/CacheWrite.cc
index 25b6673577..7e5878d930 100644
--- a/src/iocore/cache/CacheWrite.cc
+++ b/src/iocore/cache/CacheWrite.cc
@@ -692,7 +692,7 @@ agg_copy(char *p, CacheVC *vc)
   } else { // the vector is being written by itself
 if (vc->earliest_key.is_zero()) {
   do {
-rand_CacheKey(>key, vc->vol->mutex);
+rand_CacheKey(>key);
   } while (DIR_MASK_TAG(doc->key.slice32(2)) == 
DIR_MASK_TAG(vc->first_key.slice32(2)));
 } else {
   prev_CacheKey(>key, >earliest_key);
@@ -1582,7 +1582,7 @@ Cache::open_write(Continuation *cont, const CacheKey 
*key, CacheFragType frag_ty
  or the earliest_key based on the dir_tag.
*/
   do {
-rand_CacheKey(>key, cont->mutex);
+rand_CacheKey(>key);
   } while (DIR_MASK_TAG(c->key.slice32(2)) == 
DIR_MASK_TAG(c->first_key.slice32(2)));
   c->earliest_key = c->key;
   c->info = nullptr;
@@ -1643,7 +1643,7 @@ Cache::open_write(Continuation *cont, const CacheKey 
*key, CacheHTTPInfo *info,
  or the earliest_key based on the dir_tag.
*/
   do {
-rand_CacheKey(>key, cont->mutex);
+rand_CacheKey(>key);
   } while (DIR_MASK_TAG(c->key.slice32(2)) == 
DIR_MASK_TAG(c->first_key.slice32(2)));
   c->earliest_key = c->key;
   c->frag_type= CACHE_FRAG_TYPE_HTTP;
diff --git a/src/iocore/cache/P_CacheInternal.h 
b/src/iocore/cache/P_CacheInternal.h
index 4023565194..2b8452a7b1 100644
--- a/src/iocore/cache/P_CacheInternal.h
+++ b/src/iocore/cache/P_CacheInternal.h
@@ -23,6 +23,7 @@
 
 #pragma once
 
+#include "iocore/eventsystem/Continuation.h"
 #include "tscore/ink_platform.h"
 #include "tscore/InkErrno.h"
 
@@ -508,10 +509,11 @@ dir_overwrite_lock(CacheKey *key, Stripe *vol, Dir 
*to_part, ProxyMutex *m, Dir
   return dir_overwrite(key, vol, to_part, overwrite, must_overwrite);
 }
 
-void inline rand_CacheKey(CacheKey *next_key

(trafficserver) branch master updated (6d7ffc6ac7 -> 73c8ac0aea)

2023-11-09 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from 6d7ffc6ac7 Remove ProxyMutex dependency from rand_CacheKey (#10705)
 add 73c8ac0aea Cleanup: Move stripe init functions (#10739)

No new revisions were added by this update.

Summary of changes:
 src/iocore/cache/P_CacheVol.h|  10 +-
 src/iocore/cache/Stripe.cc   | 172 ++-
 src/iocore/cache/unit_tests/test_CacheDir.cc |   4 +-
 3 files changed, 99 insertions(+), 87 deletions(-)



[trafficserver] branch master updated: Fix % with PROXY Protocol (#8893)

2022-07-05 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 cc2979d36 Fix % with PROXY Protocol (#8893)
cc2979d36 is described below

commit cc2979d36722fc40f0434be0cd7a431414371c6a
Author: Masaori Koshiba 
AuthorDate: Wed Jul 6 07:42:00 2022 +0900

Fix % with PROXY Protocol (#8893)
---
 doc/admin-guide/logging/formatting.en.rst  |  3 +-
 iocore/net/P_NetVConnection.h  |  6 +---
 iocore/net/SSLNetVConnection.cc|  4 +--
 proxy/ProtocolProbeSessionAccept.cc|  3 +-
 proxy/http/HttpTransactHeaders.cc  | 15 ++--
 tests/gold_tests/proxy_protocol/gold/access.gold   |  3 ++
 .../proxy_protocol/gold/test_case_0_stdout.gold|  2 +-
 .../proxy_protocol/gold/test_case_1_stdout.gold|  2 +-
 .../proxy_protocol/gold/test_case_2_stdout.gold| 14 
 .../proxy_protocol/proxy_protocol.test.py  | 42 +-
 10 files changed, 77 insertions(+), 17 deletions(-)

diff --git a/doc/admin-guide/logging/formatting.en.rst 
b/doc/admin-guide/logging/formatting.en.rst
index 2849694d0..e1ba9f3e5 100644
--- a/doc/admin-guide/logging/formatting.en.rst
+++ b/doc/admin-guide/logging/formatting.en.rst
@@ -488,7 +488,8 @@ incoming/outgoing ports, and network interfaces used during 
transactions.
 = == ==
 Field Source Description
 = == ==
-chi   Client IP address of the client's host.
+chi   Client IP address of the client's host. If :ref:`Proxy Protocol 
`
+ is used, this represents the IP address of the previous 
hop.
 chih  Client IP address of the client's host, in hexadecimal.
 hii   Proxy  IP address for the proxy's incoming interface (to which
  the client connected).
diff --git a/iocore/net/P_NetVConnection.h b/iocore/net/P_NetVConnection.h
index b878eabcb..b25a75078 100644
--- a/iocore/net/P_NetVConnection.h
+++ b/iocore/net/P_NetVConnection.h
@@ -28,11 +28,7 @@ inline sockaddr const *
 NetVConnection::get_remote_addr()
 {
   if (!got_remote_addr) {
-if (pp_info.version != ProxyProtocolVersion::UNDEFINED) {
-  set_remote_addr(get_proxy_protocol_src_addr());
-} else {
-  set_remote_addr();
-}
+set_remote_addr();
 got_remote_addr = true;
   }
   return _addr.sa;
diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc
index 87d5e09b4..bee4f5c07 100644
--- a/iocore/net/SSLNetVConnection.cc
+++ b/iocore/net/SSLNetVConnection.cc
@@ -439,8 +439,7 @@ SSLNetVConnection::read_raw_data()
   // what we want now.
   void *payload = nullptr;
   if (!pp_ipmap->contains(get_remote_addr(), )) {
-Debug("proxyprotocol", "proxy protocol src IP is NOT in the configured 
allowlist of trusted IPs - "
-   "closing connection");
+Debug("proxyprotocol", "Source IP is NOT in the configured allowlist 
of trusted IPs - closing connection");
 r = -ENOTCONN; // Need a quick close/exit here to refuse the 
connection!
 goto proxy_protocol_bypass;
   } else {
@@ -455,7 +454,6 @@ SSLNetVConnection::read_raw_data()
 
 if (this->has_proxy_protocol(buffer, )) {
   Debug("proxyprotocol", "ssl has proxy protocol header");
-  set_remote_addr(get_proxy_protocol_src_addr());
   if (is_debug_tag_set("proxyprotocol")) {
 IpEndpoint dst;
 dst.sa = *(this->get_proxy_protocol_dst_addr());
diff --git a/proxy/ProtocolProbeSessionAccept.cc 
b/proxy/ProtocolProbeSessionAccept.cc
index 36bba6856..dad9de9c9 100644
--- a/proxy/ProtocolProbeSessionAccept.cc
+++ b/proxy/ProtocolProbeSessionAccept.cc
@@ -108,7 +108,7 @@ struct ProtocolProbeTrampoline : public Continuation, 
public ProtocolProbeSessio
 void *payload = nullptr;
 if (!pp_ipmap->contains(netvc->get_remote_addr(), )) {
   Debug("proxyprotocol",
-"ioCompletionEvent: proxy protocol src IP is NOT in the 
configured allowlist of trusted IPs - closing connection");
+"ioCompletionEvent: Source IP is NOT in the configured 
allowlist of trusted IPs - closing connection");
   goto done;
 } else {
   char new_host[INET6_ADDRSTRLEN];
@@ -123,7 +123,6 @@ struct ProtocolProbeTrampoline : public Continuation, 
public ProtocolProbeSessio
 
   if (netvc->has_proxy_protocol(reader)) {
 Debug("proxyprotocol", "ioCompletionEvent: http has proxy protocol 
header");
-netvc->set_remote_ad

[trafficserver] branch master updated: Add nullptr check of HTTPInfo (#8937)

2022-07-05 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 b2cef8bdb Add nullptr check of HTTPInfo (#8937)
b2cef8bdb is described below

commit b2cef8bdbc81e4f001757994d926f25d14b5738a
Author: Masaori Koshiba 
AuthorDate: Wed Jul 6 07:29:52 2022 +0900

Add nullptr check of HTTPInfo (#8937)
---
 proxy/http/HttpSM.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 746794eb5..ded644801 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -4579,7 +4579,7 @@ HttpSM::parse_range_and_compare(MIMEField *field, int64_t 
content_length)
 ranges[nr]._end   = end;
 ++nr;
 
-if (cache_sm.cache_read_vc) {
+if (cache_sm.cache_read_vc && t_state.cache_info.object_read) {
   if (!cache_sm.cache_read_vc->is_pread_capable() && 
cache_config_read_while_writer == 2) {
 // write in progress, check if request range not in cache yet
 HTTPInfo::FragOffset *frag_offset_tbl = 
t_state.cache_info.object_read->get_frag_table();



[trafficserver] branch 10-Dev updated: Cleanup: Get rid of afterpoll net stats (#8891)

2022-06-09 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch 10-Dev
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/10-Dev by this push:
 new 74a036437 Cleanup: Get rid of afterpoll net stats (#8891)
74a036437 is described below

commit 74a0364370bb5ca114857d5c80fa48e750a76311
Author: Masaori Koshiba 
AuthorDate: Fri Jun 10 09:57:51 2022 +0900

Cleanup: Get rid of afterpoll net stats (#8891)
---
 doc/admin-guide/monitoring/statistics/core/network-io.en.rst |  8 
 iocore/net/Net.cc|  4 
 iocore/net/P_Net.h   |  2 --
 iocore/net/UnixNetVConnection.cc |  1 -
 src/traffic_server/traffic_server.cc | 11 ++-
 5 files changed, 2 insertions(+), 24 deletions(-)

diff --git a/doc/admin-guide/monitoring/statistics/core/network-io.en.rst 
b/doc/admin-guide/monitoring/statistics/core/network-io.en.rst
index 5ea768745..56168ab95 100644
--- a/doc/admin-guide/monitoring/statistics/core/network-io.en.rst
+++ b/doc/admin-guide/monitoring/statistics/core/network-io.en.rst
@@ -25,10 +25,6 @@ Network I/O
 .. ts:stat:: global proxy.process.net.accepts_currently_open integer
:type: counter
 
-.. ts:stat:: global proxy.process.net.calls_to_readfromnet_afterpoll integer
-   :type: counter
-   :ungathered:
-
 .. ts:stat:: global proxy.process.net.calls_to_readfromnet integer
:type: counter
:ungathered:
@@ -49,10 +45,6 @@ Network I/O
:type: counter
:ungathered:
 
-.. ts:stat:: global proxy.process.net.calls_to_writetonet_afterpoll integer
-   :type: counter
-   :ungathered:
-
 .. ts:stat:: global proxy.process.net.calls_to_writetonet integer
:type: counter
:ungathered:
diff --git a/iocore/net/Net.cc b/iocore/net/Net.cc
index f0cac5b47..7f1ec3ceb 100644
--- a/iocore/net/Net.cc
+++ b/iocore/net/Net.cc
@@ -84,11 +84,9 @@ register_net_stats()
 {"proxy.process.net.calls_to_read", net_calls_to_read_stat},
 {"proxy.process.net.calls_to_read_nodata", net_calls_to_read_nodata_stat},
 {"proxy.process.net.calls_to_readfromnet", net_calls_to_readfromnet_stat},
-{"proxy.process.net.calls_to_readfromnet_afterpoll", 
net_calls_to_readfromnet_afterpoll_stat},
 {"proxy.process.net.calls_to_write", net_calls_to_write_stat},
 {"proxy.process.net.calls_to_write_nodata", 
net_calls_to_write_nodata_stat},
 {"proxy.process.net.calls_to_writetonet", net_calls_to_writetonet_stat},
-{"proxy.process.net.calls_to_writetonet_afterpoll", 
net_calls_to_writetonet_afterpoll_stat},
 {"proxy.process.net.inactivity_cop_lock_acquire_failure", 
inactivity_cop_lock_acquire_failure_stat},
 {"proxy.process.net.net_handler_run", net_handler_run_stat},
 {"proxy.process.net.read_bytes", net_read_bytes_stat},
@@ -121,11 +119,9 @@ register_net_stats()
   NET_CLEAR_DYN_STAT(net_connections_currently_open_stat);
   NET_CLEAR_DYN_STAT(net_accepts_currently_open_stat);
   NET_CLEAR_DYN_STAT(net_calls_to_readfromnet_stat);
-  NET_CLEAR_DYN_STAT(net_calls_to_readfromnet_afterpoll_stat);
   NET_CLEAR_DYN_STAT(net_calls_to_read_stat);
   NET_CLEAR_DYN_STAT(net_calls_to_read_nodata_stat);
   NET_CLEAR_DYN_STAT(net_calls_to_writetonet_stat);
-  NET_CLEAR_DYN_STAT(net_calls_to_writetonet_afterpoll_stat);
   NET_CLEAR_DYN_STAT(net_calls_to_write_stat);
   NET_CLEAR_DYN_STAT(net_calls_to_write_nodata_stat);
   NET_CLEAR_DYN_STAT(socks_connections_currently_open_stat);
diff --git a/iocore/net/P_Net.h b/iocore/net/P_Net.h
index 6ac9bdd85..9381b0a1a 100644
--- a/iocore/net/P_Net.h
+++ b/iocore/net/P_Net.h
@@ -38,11 +38,9 @@ enum Net_Stats {
   net_connections_currently_open_stat,
   net_accepts_currently_open_stat,
   net_calls_to_readfromnet_stat,
-  net_calls_to_readfromnet_afterpoll_stat,
   net_calls_to_read_stat,
   net_calls_to_read_nodata_stat,
   net_calls_to_writetonet_stat,
-  net_calls_to_writetonet_afterpoll_stat,
   net_calls_to_write_stat,
   net_calls_to_write_nodata_stat,
   socks_connections_successful_stat,
diff --git a/iocore/net/UnixNetVConnection.cc b/iocore/net/UnixNetVConnection.cc
index 3edecc955..c71baf3fb 100644
--- a/iocore/net/UnixNetVConnection.cc
+++ b/iocore/net/UnixNetVConnection.cc
@@ -350,7 +350,6 @@ write_to_net(NetHandler *nh, UnixNetVConnection *vc, 
EThread *thread)
   ProxyMutex *mutex = thread->mutex.get();
 
   NET_INCREMENT_DYN_STAT(net_calls_to_writetonet_stat);
-  NET_INCREMENT_DYN_STAT(net_calls_to_writetonet_afterpoll_stat);
 
   write_to_net_io(nh, vc, thread);
 }
diff --git a/src/traffic_server/traffic_server.cc 
b/src/traffic_server/traffic_server.cc
index 0ecda9eb5..6e5e87593 100644
--- a/src/traffic_server/traffic_server.cc
+++ b/src/traffic_server/traffic_server.cc
@@ -1464,

[trafficserver] branch master updated: Do not modify Transfer-Encoding header on retry (#8899)

2022-06-13 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 f45d490b7 Do not modify Transfer-Encoding header on retry (#8899)
f45d490b7 is described below

commit f45d490b7c3a3cb91cbc6a815b9939b19101e4d2
Author: Masaori Koshiba 
AuthorDate: Tue Jun 14 13:34:53 2022 +0900

Do not modify Transfer-Encoding header on retry (#8899)
---
 proxy/http/HttpSM.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index ee8f0464f..746794eb5 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -6315,7 +6315,8 @@ HttpSM::attach_server_session()
   if (ua_txn->has_request_body(t_state.hdr_info.request_content_length,
t_state.client_info.transfer_encoding == 
HttpTransact::CHUNKED_ENCODING)) {
 // See if we need to insert a chunked header
-if 
(!t_state.hdr_info.server_request.presence(MIME_PRESENCE_CONTENT_LENGTH)) {
+if 
(!t_state.hdr_info.server_request.presence(MIME_PRESENCE_CONTENT_LENGTH) &&
+
!t_state.hdr_info.server_request.presence(MIME_PRESENCE_TRANSFER_ENCODING)) {
   // Stuff in a TE setting so we treat this as chunked, sort of.
   t_state.server_info.transfer_encoding = HttpTransact::CHUNKED_ENCODING;
   
t_state.hdr_info.server_request.value_append(MIME_FIELD_TRANSFER_ENCODING, 
MIME_LEN_TRANSFER_ENCODING, HTTP_VALUE_CHUNKED,



[trafficserver] branch master updated: Cleanup SNIConfig (#8892)

2022-06-08 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 12801c966 Cleanup SNIConfig (#8892)
12801c966 is described below

commit 12801c966e5710d818287e79a7a977e837bfddc6
Author: Masaori Koshiba 
AuthorDate: Thu Jun 9 12:59:14 2022 +0900

Cleanup SNIConfig (#8892)
---
 iocore/net/P_SSLSNI.h   | 101 ++--
 iocore/net/SSLNetVConnection.cc |  10 ++--
 iocore/net/SSLSNIConfig.cc  |  99 ---
 proxy/http/HttpSM.cc|   2 +-
 proxy/http/PreWarmManager.cc|   4 +-
 5 files changed, 115 insertions(+), 101 deletions(-)

diff --git a/iocore/net/P_SSLSNI.h b/iocore/net/P_SSLSNI.h
index dbc1cc276..2d25982ce 100644
--- a/iocore/net/P_SSLSNI.h
+++ b/iocore/net/P_SSLSNI.h
@@ -37,22 +37,19 @@
 
 #include "ProxyConfig.h"
 #include "P_SNIActionPerformer.h"
-#include "tscore/MatcherUtils.h"
 #include "YamlSNIConfig.h"
 
 // Properties for the next hop server
 struct NextHopProperty {
-  std::string client_cert_file;
// full path to client cert file for lookup
-  std::string client_key_file; 
// full path to client key file for lookup
-  YamlSNIConfig::Policy verifyServerPolicy   = 
YamlSNIConfig::Policy::UNSET;   // whether to verify the next hop
-  YamlSNIConfig::Property verifyServerProperties = 
YamlSNIConfig::Property::UNSET; // what to verify on the next hop
-
-  NextHopProperty() {}
+  std::string client_cert_file;
  // full path to client cert file for lookup
+  std::string client_key_file; 
  // full path to client key file for lookup
+  YamlSNIConfig::Policy verify_server_policy   = 
YamlSNIConfig::Policy::UNSET;   // whether to verify the next hop
+  YamlSNIConfig::Property verify_server_properties = 
YamlSNIConfig::Property::UNSET; // what to verify on the next hop
 };
 
-using actionVector = std::vector>;
+using ActionVector = std::vector>;
 
-struct pcreFreer {
+struct PcreFreer {
   void
   operator()(void *p)
   {
@@ -60,85 +57,55 @@ struct pcreFreer {
   }
 };
 
-struct namedElement {
-public:
-  namedElement() {}
-
-  namedElement &
-  operator=(namedElement &)
-  {
-if (this != ) {
-  match = std::move(other.match);
-}
-return *this;
-  }
-  namedElement(namedElement &) { *this = std::move(other); }
+struct NamedElement {
+  NamedElement() {}
 
-  void
-  setGlobName(std::string name)
-  {
-std::string::size_type pos = 0;
-while ((pos = name.find('.', pos)) != std::string::npos) {
-  name.replace(pos, 1, "\\.");
-  pos += 2;
-}
-pos = 0;
-while ((pos = name.find('*', pos)) != std::string::npos) {
-  name.replace(pos, 1, "(.{0,})");
-}
-Debug("ssl_sni", "Regexed fqdn=%s", name.c_str());
-setRegexName(name);
-  }
+  NamedElement(NamedElement &);
+  NamedElement =(NamedElement &);
 
-  void
-  setRegexName(const std::string )
-  {
-const char *err_ptr;
-int err_offset = 0;
-if (!regexName.empty()) {
-  match.reset(pcre_compile(regexName.c_str(), PCRE_ANCHORED | 
PCRE_CASELESS, _ptr, _offset, nullptr));
-}
-  }
+  void set_glob_name(std::string name);
+  void set_regex_name(const std::string _name);
 
-  std::unique_ptr match;
+  std::unique_ptr match;
 };
 
-struct actionElement : public namedElement {
-public:
-  actionVector actions;
+struct ActionElement : public NamedElement {
+  ActionVector actions;
 };
 
-struct NextHopItem : public namedElement {
-public:
+struct NextHopItem : public NamedElement {
   NextHopProperty prop;
 };
 
-typedef std::vector SNIList;
-typedef std::vector NextHopPropertyList;
+using SNIList = std::vector;
+using NextHopPropertyList = std::vector;
 
 struct SNIConfigParams : public ConfigInfo {
+  SNIConfigParams() = default;
+  ~SNIConfigParams() override;
+
+  const NextHopProperty *get_property_config(const std::string ) 
const;
+  int initialize();
+  void load_sni_config();
+  std::pair get(std::string_view 
servername) const;
+
   SNIList sni_action_list;
   NextHopPropertyList next_hop_list;
-  YamlSNIConfig Y_sni;
-  const NextHopProperty *getPropertyConfig(const std::string ) 
const;
-  SNIConfigParams();
-  ~SNIConfigParams() override;
-  void cleanup();
-  int Initialize();
-  void loadSNIConfig();
-  std::pair get(std::string_view 
servername) const;
+  YamlSNIConfig yaml_sni;
 };
 
-struct SNIConfig {
+class SNIConfig
+{
+public:
+  using scoped_config = ConfigProcessor::scoped_config;
+
   static void startup();
   static void reconfigure();
   static

[trafficserver] branch master updated: Fix reverting PR#7302 (#8975)

2022-07-21 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 3cccd2d94 Fix reverting PR#7302 (#8975)
3cccd2d94 is described below

commit 3cccd2d94d73fe9aa8452adaa9fdc30ad9215e84
Author: Masaori Koshiba 
AuthorDate: Fri Jul 22 07:29:20 2022 +0900

Fix reverting PR#7302 (#8975)

PR#7302 was reverted by PR#8316 as an incompatible change for 9.2.0.
It looks like the revert commit has a mistake that made a crash by
calling `HttpSM::send_origin_throttled_response()` twice.
---
 proxy/http/HttpSM.cc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 813b6032c..35bac199e 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -5201,7 +5201,6 @@ HttpSM::do_http_server_open(bool raw)
 
   ct_state.Warn_Blocked(_state.txn_conf->outbound_conntrack, sm_id, 
ccount - 1, _state.current.server->dst_addr.sa,
 debug_on && is_debug_tag_set("http") ? "http" : 
nullptr);
-  send_origin_throttled_response();
 
   return;
 } else {



[trafficserver] branch master updated (b23e8a0d1 -> cbe0beaa8)

2022-07-26 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from b23e8a0d1 add a metric to track how often the range seek bug is 
detected (#8970)
 add cbe0beaa8 Setup UA consumer only if ua_entry is not nullptr (#8949)

No new revisions were added by this update.

Summary of changes:
 proxy/http/HttpSM.cc | 24 ++--
 1 file changed, 14 insertions(+), 10 deletions(-)



[trafficserver] branch master updated (cbe0beaa8 -> 80a0ff9e9)

2022-07-27 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from cbe0beaa8 Setup UA consumer only if ua_entry is not nullptr (#8949)
 add 80a0ff9e9 Update roadmap doc with latest releases (#8977)

No new revisions were added by this update.

Summary of changes:
 doc/release-notes/roadmap.en.rst | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)



[trafficserver] branch master updated (a4de562e5 -> e26ee17f8)

2022-09-26 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from a4de562e5 Fix unused-but-set-variable warnings by llvm-15 (#9106)
 add e26ee17f8 Fix compile error with llvm-15 (#9105)

No new revisions were added by this update.

Summary of changes:
 include/tscore/Ptr.h | 2 ++
 1 file changed, 2 insertions(+)



[trafficserver] branch master updated (f0c127a89 -> a4de562e5)

2022-09-26 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from f0c127a89 Cleanup of SocketManager (struct -> namespace). (#8986)
 add a4de562e5 Fix unused-but-set-variable warnings by llvm-15 (#9106)

No new revisions were added by this update.

Summary of changes:
 iocore/cache/Cache.cc   | 5 -
 iocore/cache/Store.cc   | 5 -
 proxy/http/remap/RemapConfig.cc | 2 +-
 proxy/logging/LogObject.cc  | 3 ---
 src/traffic_cache_tool/CacheDefs.cc | 2 --
 tests/gold_tests/tls/ssl-post.c | 4 
 6 files changed, 1 insertion(+), 20 deletions(-)



[trafficserver] branch master updated: Remove deprecated ld option (--add-needed) (#9141)

2022-10-24 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 875c73e53 Remove deprecated ld option (--add-needed) (#9141)
875c73e53 is described below

commit 875c73e53e4d5eae6b6587e26943528314ea885b
Author: Masaori Koshiba 
AuthorDate: Tue Oct 25 08:22:31 2022 +0900

Remove deprecated ld option (--add-needed) (#9141)
---
 build/jemalloc.m4 | 2 +-
 build/mimalloc.m4 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/build/jemalloc.m4 b/build/jemalloc.m4
index 2af684859..7acf1ebec 100644
--- a/build/jemalloc.m4
+++ b/build/jemalloc.m4
@@ -58,7 +58,7 @@ if test "$has_jemalloc" != "no"; then
   if test "$jemalloc_base_dir" != "/usr"; then
 TS_ADDTO(CPPFLAGS, [-I${jemalloc_include}])
 TS_ADDTO(LDFLAGS, [-L${jemalloc_ldflags}])
-TS_ADDTO(LDFLAGS, [-Wl,--add-needed -L${jemalloc_ldflags} 
-Wl,-rpath,${jemalloc_ldflags} -Wl,--no-as-needed])
+TS_ADDTO(LDFLAGS, [-Wl,--as-needed -L${jemalloc_ldflags} 
-Wl,-rpath,${jemalloc_ldflags} -Wl,--no-as-needed])
 TS_ADDTO_RPATH(${jemalloc_ldflags})
   fi
   # On Darwin, jemalloc symbols are prefixed with je_. Search for that first, 
then fall back
diff --git a/build/mimalloc.m4 b/build/mimalloc.m4
index b54320157..f291d04af 100644
--- a/build/mimalloc.m4
+++ b/build/mimalloc.m4
@@ -62,7 +62,7 @@ if test "$has_mimalloc" != "no"; then
   if test "$mimalloc_base_dir" != "/usr"; then
 TS_ADDTO(CPPFLAGS, [-I${mimalloc_include}])
 TS_ADDTO(LDFLAGS, [-L${mimalloc_ldflags}])
-TS_ADDTO(LDFLAGS, [-Wl,--add-needed -L${mimalloc_ldflags} 
-Wl,-rpath,${mimalloc_ldflags} -Wl,--no-as-needed])
+TS_ADDTO(LDFLAGS, [-Wl,--as-needed -L${mimalloc_ldflags} 
-Wl,-rpath,${mimalloc_ldflags} -Wl,--no-as-needed])
 TS_ADDTO_RPATH(${mimalloc_ldflags})
   fi
   AC_SEARCH_LIBS([mi_malloc], [mimalloc], [mimalloc_has_libs=1])



[trafficserver] branch master updated: Cleanup: const correctness of Vol and Doc (#9165)

2022-10-30 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 d17fe29b0 Cleanup: const correctness of Vol and Doc (#9165)
d17fe29b0 is described below

commit d17fe29b0a5c8b130541f4ecb8e193be1831f3dd
Author: Masaori Koshiba 
AuthorDate: Mon Oct 31 08:56:30 2022 +0900

Cleanup: const correctness of Vol and Doc (#9165)
---
 iocore/cache/P_CacheDir.h |   4 ++
 iocore/cache/P_CacheVol.h | 113 --
 2 files changed, 64 insertions(+), 53 deletions(-)

diff --git a/iocore/cache/P_CacheDir.h b/iocore/cache/P_CacheDir.h
index c5992f0ea..70e6bfded 100644
--- a/iocore/cache/P_CacheDir.h
+++ b/iocore/cache/P_CacheDir.h
@@ -321,12 +321,14 @@ dir_from_offset(int64_t i, Dir *seg)
   return dir_in_seg(seg, i);
 #endif
 }
+
 TS_INLINE Dir *
 next_dir(Dir *d, Dir *seg)
 {
   int i = dir_next(d);
   return dir_from_offset(i, seg);
 }
+
 TS_INLINE int64_t
 dir_to_offset(const Dir *d, const Dir *seg)
 {
@@ -338,11 +340,13 @@ dir_to_offset(const Dir *d, const Dir *seg)
   return i;
 #endif
 }
+
 TS_INLINE Dir *
 dir_bucket(int64_t b, Dir *seg)
 {
   return dir_in_seg(seg, b * DIR_DEPTH);
 }
+
 TS_INLINE Dir *
 dir_bucket_row(Dir *b, int64_t i)
 {
diff --git a/iocore/cache/P_CacheVol.h b/iocore/cache/P_CacheVol.h
index b2f69b13c..24d9d4313 100644
--- a/iocore/cache/P_CacheVol.h
+++ b/iocore/cache/P_CacheVol.h
@@ -206,17 +206,9 @@ struct Vol : public Continuation {
   int dir_check(bool fix);
   int db_check(bool fix);
 
-  bool
-  evac_bucket_valid(off_t bucket)
-  {
-return (bucket >= 0 && bucket < evacuate_size);
-  }
+  bool evac_bucket_valid(off_t bucket) const;
 
-  int
-  is_io_in_progress()
-  {
-return io.aiocb.aio_fildes != AIO_NOT_IN_PROGRESS;
-  }
+  int is_io_in_progress() const;
   int
   increment_generation()
   {
@@ -227,11 +219,7 @@ struct Vol : public Continuation {
   header->generation++;
 return header->generation;
   }
-  void
-  set_io_not_in_progress()
-  {
-io.aiocb.aio_fildes = AIO_NOT_IN_PROGRESS;
-  }
+  void set_io_not_in_progress();
 
   int aggWriteDone(int event, Event *e);
   int aggWrite(int event, void *e);
@@ -247,25 +235,25 @@ struct Vol : public Continuation {
   void evacuate_cleanup_blocks(int i);
   void evacuate_cleanup();
   EvacuationBlock *force_evacuate_head(Dir *dir, int pinned);
-  int within_hit_evacuate_window(Dir *dir);
-  uint32_t round_to_approx_size(uint32_t l);
+  int within_hit_evacuate_window(Dir *dir) const;
+  uint32_t round_to_approx_size(uint32_t l) const;
 
   // inline functions
-  int headerlen(); // calculates the total length of the vol header 
and the freelist
-  int direntries();// total number of dir entries
-  Dir *dir_segment(int s); // returns the first dir in the segment s
-  size_t dirlen(); // calculates the total length of header, 
directories and footer
-  int vol_out_of_phase_valid(Dir *e);
-
-  int vol_out_of_phase_agg_valid(Dir *e);
-  int vol_out_of_phase_write_valid(Dir *e);
-  int vol_in_phase_valid(Dir *e);
-  int vol_in_phase_agg_buf_valid(Dir *e);
-
-  off_t vol_offset(Dir *e);
-  off_t offset_to_vol_offset(off_t pos);
-  off_t vol_offset_to_offset(off_t pos);
-  off_t vol_relative_length(off_t start_offset);
+  int headerlen() const; // calculates the total length of the vol 
header and the freelist
+  int direntries() const;// total number of dir entries
+  Dir *dir_segment(int s) const; // returns the first dir in the segment s
+  size_t dirlen() const; // calculates the total length of header, 
directories and footer
+  int vol_out_of_phase_valid(Dir *e) const;
+
+  int vol_out_of_phase_agg_valid(Dir *e) const;
+  int vol_out_of_phase_write_valid(Dir *e) const;
+  int vol_in_phase_valid(Dir *e) const;
+  int vol_in_phase_agg_buf_valid(Dir *e) const;
+
+  off_t vol_offset(Dir *e) const;
+  off_t offset_to_vol_offset(off_t pos) const;
+  off_t vol_offset_to_offset(off_t pos) const;
+  off_t vol_relative_length(off_t start_offset) const;
 
   Vol() : Continuation(new_ProxyMutex())
   {
@@ -326,9 +314,9 @@ struct Doc {
   CryptoHash key; ///< Key for this doc.
 #endif
 
-  uint32_t data_len();
-  uint32_t prefix_len();
-  int single_fragment();
+  uint32_t data_len() const;
+  uint32_t prefix_len() const;
+  int single_fragment() const;
   int no_data_in_fragment();
   char *hdr();
   char *data();
@@ -346,98 +334,99 @@ extern unsigned short *vol_hash_table;
 // inline Functions
 
 TS_INLINE int
-Vol::headerlen()
+Vol::headerlen() const
 {
   return ROUND_TO_STORE_BLOCK(sizeof(VolHeaderFooter) + sizeof(uint16_t) * 
(this->segments - 1));
 }
 
 TS_INLINE Dir *
-Vol::dir_segment(int s)
+Vol::dir_segment(int s) const
 {
   return (Dir *)(((char *)this->dir) + (s * this->buckets) * DIR_DEPTH * 
SIZEOF_DIR);
 }

[trafficserver] branch master updated: Cleanup: Remove dead code (CacheLink) (#9153)

2022-10-23 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 5f6e2223d Cleanup: Remove dead code (CacheLink) (#9153)
5f6e2223d is described below

commit 5f6e2223d131d1ee6b3afd0254abbed361e61dcc
Author: Masaori Koshiba 
AuthorDate: Mon Oct 24 07:54:08 2022 +0900

Cleanup: Remove dead code (CacheLink) (#9153)
---
 iocore/cache/CacheLink.cc  | 176 -
 iocore/cache/Makefile.am   |   1 -
 iocore/cache/P_CacheInternal.h |   7 --
 3 files changed, 184 deletions(-)

diff --git a/iocore/cache/CacheLink.cc b/iocore/cache/CacheLink.cc
deleted file mode 100644
index d3055f4e8..0
--- a/iocore/cache/CacheLink.cc
+++ /dev/null
@@ -1,176 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  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.
- */
-
-#include "P_Cache.h"
-
-Action *
-Cache::link(Continuation *cont, const CacheKey *from, const CacheKey *to, 
CacheFragType type, const char *hostname, int host_len)
-{
-  if (!CacheProcessor::IsCacheReady(type)) {
-cont->handleEvent(CACHE_EVENT_LINK_FAILED, nullptr);
-return ACTION_RESULT_DONE;
-  }
-
-  ink_assert(caches[type] == this);
-
-  CacheVC *c = new_CacheVC(cont);
-  c->vol = key_to_vol(from, hostname, host_len);
-  c->write_len   = sizeof(*to); // so that the earliest_key will be used
-  c->f.use_first_key = 1;
-  c->first_key   = *from;
-  c->earliest_key= *to;
-
-  c->buf = new_IOBufferData(BUFFER_SIZE_INDEX_512);
-#ifdef DEBUG
-  Doc *doc = reinterpret_cast(c->buf->data());
-  memcpy(doc->data(), to, sizeof(*to)); // doublecheck
-#endif
-
-  SET_CONTINUATION_HANDLER(c, ::linkWrite);
-
-  if (c->do_write_lock() == EVENT_DONE) {
-return ACTION_RESULT_DONE;
-  } else {
-return >_action;
-  }
-}
-
-int
-CacheVC::linkWrite(int event, Event * /* e ATS_UNUSED */)
-{
-  ink_assert(event == AIO_EVENT_DONE);
-  set_io_not_in_progress();
-  dir_insert(_key, vol, );
-  if (_action.cancelled) {
-goto Ldone;
-  }
-  if (io.ok()) {
-_action.continuation->handleEvent(CACHE_EVENT_LINK, nullptr);
-  } else {
-_action.continuation->handleEvent(CACHE_EVENT_LINK_FAILED, nullptr);
-  }
-Ldone:
-  return free_CacheVC(this);
-}
-
-Action *
-Cache::deref(Continuation *cont, const CacheKey *key, CacheFragType type, 
const char *hostname, int host_len)
-{
-  if (!CacheProcessor::IsCacheReady(type)) {
-cont->handleEvent(CACHE_EVENT_DEREF_FAILED, nullptr);
-return ACTION_RESULT_DONE;
-  }
-
-  ink_assert(caches[type] == this);
-
-  Vol *vol = key_to_vol(key, hostname, host_len);
-  Dir result;
-  Dir *last_collision = nullptr;
-  CacheVC *c  = nullptr;
-  {
-MUTEX_TRY_LOCK(lock, vol->mutex, cont->mutex->thread_holding);
-if (lock.is_locked()) {
-  if (!dir_probe(key, vol, , _collision)) {
-cont->handleEvent(CACHE_EVENT_DEREF_FAILED, (void *)-ECACHE_NO_DOC);
-return ACTION_RESULT_DONE;
-  }
-}
-c = new_CacheVC(cont);
-SET_CONTINUATION_HANDLER(c, ::derefRead);
-c->first_key = c->key = *key;
-c->vol= vol;
-c->dir= result;
-c->last_collision = last_collision;
-
-if (!lock.is_locked()) {
-  c->mutex->thread_holding->schedule_in_local(c, 
HRTIME_MSECONDS(cache_config_mutex_retry_delay));
-  return >_action;
-}
-
-switch (c->do_read_call(>key)) {
-case EVENT_DONE:
-  return ACTION_RESULT_DONE;
-case EVENT_RETURN:
-  goto Lcallreturn;
-default:
-  return >_action;
-}
-  }
-Lcallreturn:
-  if (c->handleEvent(AIO_EVENT_DONE, nullptr) == EVENT_DONE) {
-return ACTION_RESULT_DONE;
-  } else {
-return >_action;
-  }
-}
-
-int
-CacheVC::derefRead(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
-{
-  Doc *doc = nullptr;
-
-  cancel_trigger();
-  set_io_not_in_progress();
-  if (_action.cancelled) {
-return free_CacheVC(this);
-  }
- 

[trafficserver] branch master updated: Add stack guard pages (#8996)

2022-08-03 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 1abf6c011 Add stack guard pages (#8996)
1abf6c011 is described below

commit 1abf6c01164e3893f25cb14460d7da0a5007112d
Author: Mo Chen 
AuthorDate: Wed Aug 3 18:08:07 2022 -0500

Add stack guard pages (#8996)

Use r/w protected pages on top of stacks to guard against stack
overflow.  The number of VM pages to use for guarding can be set
via the config option proxy.config.thread.default.stackguard_pages.
---
 iocore/eventsystem/UnixEventProcessor.cc | 59 
 mgmt/RecordsConfig.cc|  2 ++
 2 files changed, 54 insertions(+), 7 deletions(-)

diff --git a/iocore/eventsystem/UnixEventProcessor.cc 
b/iocore/eventsystem/UnixEventProcessor.cc
index ec860943d..2217d6115 100644
--- a/iocore/eventsystem/UnixEventProcessor.cc
+++ b/iocore/eventsystem/UnixEventProcessor.cc
@@ -47,7 +47,7 @@ public:
   void init();
   /// Set the affinity for the current thread.
   int set_affinity(int, Event *);
-  /// Allocate a stack.
+  /// Allocate a stack and set guard pages.
   /// @internal This is the external entry point and is different depending on
   /// whether HWLOC is enabled.
   void *alloc_stack(EThread *t, size_t stacksize);
@@ -55,7 +55,8 @@ public:
 protected:
   /// Allocate a hugepage stack.
   /// If huge pages are not enable, allocate a basic stack.
-  void *alloc_hugepage_stack(size_t stacksize);
+  void *do_alloc_stack(size_t stacksize);
+  void setup_stack_guard(void *stack, int stackguard_pages);
 
 #if TS_USE_HWLOC
 
@@ -136,10 +137,54 @@ public:
 } Thread_Init_Func;
 } // namespace
 
+void
+ThreadAffinityInitializer::setup_stack_guard(void *stack, int stackguard_pages)
+{
+#if !(defined(__i386__) || defined(__x86_64__) || defined(__arm__) || 
defined(__mips__))
+#error Unknown stack growth direction.  Determine the stack growth direction 
of your platform.
+// If your stack grows upwards, you need to change this function and the 
calculation of stack_begin in do_alloc_stack.
+#endif
+  // Assumption: stack grows down
+  if (stackguard_pages <= 0) {
+return;
+  }
+
+  size_t pagesize  = ats_hugepage_enabled() ? ats_hugepage_size() : 
ats_pagesize();
+  size_t guardsize = stackguard_pages * pagesize;
+  int ret  = mprotect(stack, guardsize, 0);
+  if (ret != 0) {
+Fatal("Failed to set up stack guard pages: %s (%d)", strerror(errno), 
errno);
+  }
+}
+
 void *
-ThreadAffinityInitializer::alloc_hugepage_stack(size_t stacksize)
+ThreadAffinityInitializer::do_alloc_stack(size_t stacksize)
 {
-  return ats_hugepage_enabled() ? ats_alloc_hugepage(stacksize) : 
ats_memalign(ats_pagesize(), stacksize);
+  size_t pagesize = ats_hugepage_enabled() ? ats_hugepage_size() : 
ats_pagesize();
+  int stackguard_pages;
+  REC_ReadConfigInteger(stackguard_pages, 
"proxy.config.thread.default.stackguard_pages");
+  ink_release_assert(stackguard_pages >= 0);
+
+  size_t size= INK_ALIGN(stacksize + stackguard_pages * pagesize, 
pagesize);
+  int mmap_flags = MAP_PRIVATE | MAP_ANONYMOUS;
+#ifdef MAP_HUGETLB
+  if (ats_hugepage_enabled()) {
+mmap_flags |= MAP_HUGETLB;
+  }
+#endif
+  void *stack_and_guard = mmap(nullptr, size, PROT_READ | PROT_WRITE, 
mmap_flags, -1, 0);
+  if (stack_and_guard == MAP_FAILED) {
+Error("Failed to allocate stack pages: size = %zu", size);
+return nullptr;
+  }
+
+  setup_stack_guard(stack_and_guard, stackguard_pages);
+
+  void *stack_begin = static_cast(stack_and_guard) + stackguard_pages 
* pagesize;
+  Debug("iocore_thread", "Allocated %zu bytes (%zu bytes in guard pages) for 
stack {%p-%p guard, %p-%p stack}", size,
+stackguard_pages * pagesize, stack_and_guard, stack_begin, 
stack_begin, static_cast(stack_begin) + stacksize);
+
+  return stack_begin;
 }
 
 #if TS_USE_HWLOC
@@ -239,7 +284,7 @@ ThreadAffinityInitializer::alloc_numa_stack(EThread *t, 
size_t stacksize)
   }
 
   // Alloc our stack
-  stack = this->alloc_hugepage_stack(stacksize);
+  stack = this->do_alloc_stack(stacksize);
 
   if (mem_policy != HWLOC_MEMBIND_DEFAULT) {
 // Now let's set it back to default for this thread.
@@ -260,7 +305,7 @@ ThreadAffinityInitializer::alloc_numa_stack(EThread *t, 
size_t stacksize)
 void *
 ThreadAffinityInitializer::alloc_stack(EThread *t, size_t stacksize)
 {
-  return this->obj_count > 0 ? this->alloc_numa_stack(t, stacksize) : 
this->alloc_hugepage_stack(stacksize);
+  return this->obj_count > 0 ? this->alloc_numa_stack(t, stacksize) : 
this->do_alloc_stack(stacksize);
 }
 
 #else
@@ -279,7 +324,7 @@ ThreadAffinityInitializer::set_affinity(int, Event *)
 void *
 ThreadAffinityInitializer::alloc_stack(EThread *, size_t stacksize)
 {
-  

[trafficserver] branch master updated: Add RangeTransform::m_write_vio state checks (#8980)

2022-08-02 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 e912ecef7 Add RangeTransform::m_write_vio state checks (#8980)
e912ecef7 is described below

commit e912ecef7065b6c04183e10e29b15f1056a7f281
Author: Masaori Koshiba 
AuthorDate: Wed Aug 3 07:37:09 2022 +0900

Add RangeTransform::m_write_vio state checks (#8980)
---
 proxy/Transform.cc | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/proxy/Transform.cc b/proxy/Transform.cc
index 664e310df..5013d3192 100644
--- a/proxy/Transform.cc
+++ b/proxy/Transform.cc
@@ -791,7 +791,9 @@ RangeTransform::handle_event(int event, void *edata)
   } else {
 switch (event) {
 case VC_EVENT_ERROR:
-  m_write_vio.cont->handleEvent(VC_EVENT_ERROR, _write_vio);
+  if (m_write_vio.cont) {
+m_write_vio.cont->handleEvent(VC_EVENT_ERROR, _write_vio);
+  }
   break;
 case VC_EVENT_WRITE_COMPLETE:
   ink_assert(m_output_vio == (VIO *)edata);
@@ -814,6 +816,10 @@ RangeTransform::handle_event(int event, void *edata)
 }
   }
 
+  if (!m_write_vio.mutex) {
+return 0;
+  }
+
   MUTEX_TRY_LOCK(trylock, m_write_vio.mutex, this_ethread());
   if (!trylock.is_locked()) {
 retry(10);



[trafficserver] 02/02: Correct error class of HTTP/2 malformed requests

2022-08-08 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch asf-master-0809-4
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 8880f3c93887d5b154f951e99c35f92652c3a650
Author: Masaori Koshiba 
AuthorDate: Wed Apr 27 15:03:31 2022 +0900

Correct error class of HTTP/2 malformed requests
---
 proxy/http2/Http2ConnectionState.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/proxy/http2/Http2ConnectionState.cc 
b/proxy/http2/Http2ConnectionState.cc
index e37025d70..b0e3a1cd9 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -139,7 +139,7 @@ Http2ConnectionState::rcv_data_frame(const Http2Frame 
)
   return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_NONE);
 }
 if (!stream->payload_length_is_valid()) {
-  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, 
Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM, 
Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
 "recv data bad payload length");
 }
 
@@ -386,7 +386,7 @@ Http2ConnectionState::rcv_headers_frame(const Http2Frame 
)
 
 // Check Content-Length & payload length when END_STREAM flag is true
 if (stream->recv_end_stream && !stream->payload_length_is_valid()) {
-  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, 
Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM, 
Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
 "recv data bad payload length");
 }
 
@@ -950,7 +950,7 @@ Http2ConnectionState::rcv_continuation_frame(const 
Http2Frame )
 
 // Check Content-Length & payload length when END_STREAM flag is true
 if (stream->recv_end_stream && !stream->payload_length_is_valid()) {
-  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, 
Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM, 
Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
 "recv data bad payload length");
 }
 



[trafficserver] branch asf-master-0809-4 created (now 8880f3c93)

2022-08-08 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a change to branch asf-master-0809-4
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


  at 8880f3c93 Correct error class of HTTP/2 malformed requests

This branch includes the following new commits:

 new 467fa7db1 Add content length mismatch check on handling HEADERS frame 
and CONTINUATION frame
 new 8880f3c93 Correct error class of HTTP/2 malformed requests

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.




[trafficserver] 01/01: Restrict unknown scheme of HTTP/2 request

2022-08-08 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch asf-master-0809-2
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 2424565f96fe861e52f31e241ced87c73c5fe165
Author: Masaori Koshiba 
AuthorDate: Tue Mar 29 14:37:16 2022 +0900

Restrict unknown scheme of HTTP/2 request

Strictly following RFC 3986 Section 3.1

```
scheme  = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
```
---
 proxy/hdrs/URL.cc | 42 +--
 proxy/hdrs/URL.h  |  2 ++
 proxy/hdrs/unit_tests/test_URL.cc | 21 
 proxy/http2/HTTP2.cc  | 11 +-
 4 files changed, 64 insertions(+), 12 deletions(-)

diff --git a/proxy/hdrs/URL.cc b/proxy/hdrs/URL.cc
index 5614a9b9c..2896cdfb9 100644
--- a/proxy/hdrs/URL.cc
+++ b/proxy/hdrs/URL.cc
@@ -114,6 +114,36 @@ validate_host_name(std::string_view addr)
   return std::all_of(addr.begin(), addr.end(), _host_char);
 }
 
+/**
+   Checks if the (un-well-known) scheme is valid
+
+   RFC 3986 Section 3.1
+   These are the valid characters in a scheme:
+ scheme  = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
+   return an error if there is another character in the scheme
+*/
+bool
+validate_scheme(std::string_view scheme)
+{
+  if (scheme.empty()) {
+return false;
+  }
+
+  if (!ParseRules::is_alpha(scheme[0])) {
+return false;
+  }
+
+  for (size_t i = 0; i < scheme.size(); ++i) {
+const char  = scheme[i];
+
+if (!(ParseRules::is_alnum(c) != 0 || c == '+' || c == '-' || c == '.')) {
+  return false;
+}
+  }
+
+  return true;
+}
+
 /*-
   -*/
 
@@ -1133,19 +1163,9 @@ url_parse_scheme(HdrHeap *heap, URLImpl *url, const char 
**start, const char *en
 
 if (!(scheme_wks_idx > 0 && hdrtoken_wks_to_token_type(scheme_wks) == 
HDRTOKEN_TYPE_SCHEME)) {
   // Unknown scheme, validate the scheme
-
-  // RFC 3986 Section 3.1
-  // These are the valid characters in a scheme:
-  //   scheme  = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
-  // return an error if there is another character in the scheme
-  if (!ParseRules::is_alpha(*scheme_start)) {
+  if (!validate_scheme({scheme_start, static_cast(scheme_end - 
scheme_start)})) {
 return PARSE_RESULT_ERROR;
   }
-  for (cur = scheme_start + 1; cur < scheme_end; ++cur) {
-if (!(ParseRules::is_alnum(*cur) != 0 || *cur == '+' || *cur == 
'-' || *cur == '.')) {
-  return PARSE_RESULT_ERROR;
-}
-  }
 }
 url->set_scheme(heap, scheme_start, scheme_wks_idx, scheme_end - 
scheme_start, copy_strings_p);
   }
diff --git a/proxy/hdrs/URL.h b/proxy/hdrs/URL.h
index ac9d4a0d9..c9a1c75f5 100644
--- a/proxy/hdrs/URL.h
+++ b/proxy/hdrs/URL.h
@@ -185,6 +185,8 @@ extern int URL_LEN_MMST;
 
 /* Public */
 bool validate_host_name(std::string_view addr);
+bool validate_scheme(std::string_view scheme);
+
 void url_init();
 
 URLImpl *url_create(HdrHeap *heap);
diff --git a/proxy/hdrs/unit_tests/test_URL.cc 
b/proxy/hdrs/unit_tests/test_URL.cc
index a39f7c01b..115aeee5d 100644
--- a/proxy/hdrs/unit_tests/test_URL.cc
+++ b/proxy/hdrs/unit_tests/test_URL.cc
@@ -53,6 +53,27 @@ TEST_CASE("ValidateURL", "[proxy][validurl]")
   }
 }
 
+TEST_CASE("Validate Scheme", "[proxy][validscheme]")
+{
+  static const struct {
+std::string_view text;
+bool valid;
+  } scheme_test_cases[] = {{"http", true},  {"https", true},  
{"example", true},{"example.", true},
+   {"example++", true}, {"example--.", true}, 
{"++example", false}, {"--example", false},
+   {".example", false}, {"example://", false}};
+
+  for (auto i : scheme_test_cases) {
+// it's pretty hard to debug with
+// CHECK(validate_scheme(i.text) == i.valid);
+
+std::string_view text = i.text;
+if (validate_scheme(text) != i.valid) {
+  std::printf("Validation of scheme: \"%s\", expected %s, but not\n", 
text.data(), (i.valid ? "true" : "false"));
+  CHECK(false);
+}
+  }
+}
+
 namespace UrlImpl
 {
 bool url_is_strictly_compliant(const char *start, const char *end);
diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc
index f1360ddc6..df31bc932 100644
--- a/proxy/http2/HTTP2.cc
+++ b/proxy/http2/HTTP2.cc
@@ -433,8 +433,17 @@ http2_convert_header_from_2_to_1_1(HTTPHdr *headers)
 if (MIMEField *field = headers->field_find(HTTP2_VA

[trafficserver] 01/02: Add content length mismatch check on handling HEADERS frame and CONTINUATION frame

2022-08-08 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch asf-master-0809-4
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 467fa7db16a375f5fb2470884bd11e78f927ed09
Author: Masaori Koshiba 
AuthorDate: Wed Apr 20 09:34:31 2022 +0900

Add content length mismatch check on handling HEADERS frame and 
CONTINUATION frame
---
 proxy/http2/Http2ConnectionState.cc | 12 
 1 file changed, 12 insertions(+)

diff --git a/proxy/http2/Http2ConnectionState.cc 
b/proxy/http2/Http2ConnectionState.cc
index 4f60d58d1..e37025d70 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -384,6 +384,12 @@ Http2ConnectionState::rcv_headers_frame(const Http2Frame 
)
   }
 }
 
+// Check Content-Length & payload length when END_STREAM flag is true
+if (stream->recv_end_stream && !stream->payload_length_is_valid()) {
+  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, 
Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+"recv data bad payload length");
+}
+
 // Set up the State Machine
 if (!empty_request) {
   SCOPED_MUTEX_LOCK(stream_lock, stream->mutex, this_ethread());
@@ -942,6 +948,12 @@ Http2ConnectionState::rcv_continuation_frame(const 
Http2Frame )
   }
 }
 
+// Check Content-Length & payload length when END_STREAM flag is true
+if (stream->recv_end_stream && !stream->payload_length_is_valid()) {
+  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, 
Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+"recv data bad payload length");
+}
+
 // Set up the State Machine
 SCOPED_MUTEX_LOCK(stream_lock, stream->mutex, this_ethread());
 stream->mark_milestone(Http2StreamMilestone::START_TXN);



[trafficserver] branch asf-master-0809-2 created (now 2424565f9)

2022-08-08 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a change to branch asf-master-0809-2
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


  at 2424565f9 Restrict unknown scheme of HTTP/2 request

This branch includes the following new commits:

 new 2424565f9 Restrict unknown scheme of HTTP/2 request

The 1 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.




[trafficserver] branch master updated: Ignore POST request case from a check for background fill (#9013)

2022-08-08 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 1f3e9 Ignore POST request case from a check for background fill 
(#9013)
1f3e9 is described below

commit 1f3e931e26b5ad483a8bc80b3ae7edc0b568
Author: Masaori Koshiba 
AuthorDate: Tue Aug 9 10:30:20 2022 +0900

Ignore POST request case from a check for background fill (#9013)
---
 proxy/http/HttpTunnel.h | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/proxy/http/HttpTunnel.h b/proxy/http/HttpTunnel.h
index e5e2e58a5..0bd1be845 100644
--- a/proxy/http/HttpTunnel.h
+++ b/proxy/http/HttpTunnel.h
@@ -546,12 +546,14 @@ HttpTunnel::has_consumer_besides_client() const
   continue;
 }
 
-if (consumer.vc_type == HT_HTTP_CLIENT) {
-  res = false;
+switch (consumer.vc_type) {
+case HT_HTTP_CLIENT:
   continue;
-} else {
-  res = true;
-  break;
+case HT_HTTP_SERVER:
+  // ignore uploading data to servers
+  continue;
+default:
+  return true;
 }
   }
 



[trafficserver] 01/01: Fail fast on HTTP/2 header validation

2022-08-08 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch asf-master-0809-1
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit def83057745b9802785eb76d9926178e1a863269
Author: Masakazu Kitajo 
AuthorDate: Fri Jan 28 14:18:58 2022 +0900

Fail fast on HTTP/2 header validation
---
 proxy/hdrs/MIME.h  | 12 ++--
 proxy/http2/HTTP2.cc   | 13 -
 proxy/http2/Http2Stream.cc |  6 +-
 3 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/proxy/hdrs/MIME.h b/proxy/hdrs/MIME.h
index dc418fb56..ba9501d82 100644
--- a/proxy/hdrs/MIME.h
+++ b/proxy/hdrs/MIME.h
@@ -170,7 +170,7 @@ struct MIMEField {
   int value_get_comma_list(StrList *list) const;
 
   void name_set(HdrHeap *heap, MIMEHdrImpl *mh, const char *name, int length);
-  bool name_is_valid() const;
+  bool name_is_valid(uint32_t invalid_char_bits = is_control_BIT) const;
 
   void value_set(HdrHeap *heap, MIMEHdrImpl *mh, const char *value, int 
length);
   void value_set_int(HdrHeap *heap, MIMEHdrImpl *mh, int32_t value);
@@ -182,7 +182,7 @@ struct MIMEField {
   // Other separators (e.g. ';' in Set-cookie/Cookie) are also possible
   void value_append(HdrHeap *heap, MIMEHdrImpl *mh, const char *value, int 
length, bool prepend_comma = false,
 const char separator = ',');
-  bool value_is_valid() const;
+  bool value_is_valid(uint32_t invalid_char_bits = is_control_BIT) const;
   int has_dups() const;
 };
 
@@ -972,13 +972,13 @@ MIMEField::name_set(HdrHeap *heap, MIMEHdrImpl *mh, const 
char *name, int length
   -*/
 
 inline bool
-MIMEField::name_is_valid() const
+MIMEField::name_is_valid(uint32_t invalid_char_bits) const
 {
   const char *name;
   int length;
 
   for (name = name_get(); length > 0; length--) {
-if (ParseRules::is_control(name[length - 1])) {
+if (ParseRules::is_type(name[length - 1], invalid_char_bits)) {
   return false;
 }
   }
@@ -1081,13 +1081,13 @@ MIMEField::value_append(HdrHeap *heap, MIMEHdrImpl *mh, 
const char *value, int l
   -*/
 
 inline bool
-MIMEField::value_is_valid() const
+MIMEField::value_is_valid(uint32_t invalid_char_bits) const
 {
   const char *value;
   int length;
 
   for (value = value_get(); length > 0; length--) {
-if (ParseRules::is_control(value[length - 1])) {
+if (ParseRules::is_type(value[length - 1], invalid_char_bits)) {
   return false;
 }
   }
diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc
index f1360ddc6..73cc4022e 100644
--- a/proxy/http2/HTTP2.cc
+++ b/proxy/http2/HTTP2.cc
@@ -430,7 +430,8 @@ http2_convert_header_from_2_to_1_1(HTTPHdr *headers)
 
   if (http_hdr_type_get(headers->m_http) == HTTP_TYPE_REQUEST) {
 // :scheme
-if (MIMEField *field = headers->field_find(HTTP2_VALUE_SCHEME, 
HTTP2_LEN_SCHEME); field != nullptr && field->value_is_valid()) {
+if (MIMEField *field = headers->field_find(HTTP2_VALUE_SCHEME, 
HTTP2_LEN_SCHEME);
+field != nullptr && field->value_is_valid(is_control_BIT | is_ws_BIT)) 
{
   int scheme_len;
   const char *scheme = field->value_get(_len);
 
@@ -444,7 +445,7 @@ http2_convert_header_from_2_to_1_1(HTTPHdr *headers)
 
 // :authority
 if (MIMEField *field = headers->field_find(HTTP2_VALUE_AUTHORITY, 
HTTP2_LEN_AUTHORITY);
-field != nullptr && field->value_is_valid()) {
+field != nullptr && field->value_is_valid(is_control_BIT | is_ws_BIT)) 
{
   int authority_len;
   const char *authority = field->value_get(_len);
 
@@ -456,7 +457,8 @@ http2_convert_header_from_2_to_1_1(HTTPHdr *headers)
 }
 
 // :path
-if (MIMEField *field = headers->field_find(HTTP2_VALUE_PATH, 
HTTP2_LEN_PATH); field != nullptr && field->value_is_valid()) {
+if (MIMEField *field = headers->field_find(HTTP2_VALUE_PATH, 
HTTP2_LEN_PATH);
+field != nullptr && field->value_is_valid(is_control_BIT | is_ws_BIT)) 
{
   int path_len;
   const char *path = field->value_get(_len);
 
@@ -474,7 +476,8 @@ http2_convert_header_from_2_to_1_1(HTTPHdr *headers)
 }
 
 // :method
-if (MIMEField *field = headers->field_find(HTTP2_VALUE_METHOD, 
HTTP2_LEN_METHOD); field != nullptr && field->value_is_valid()) {
+if (MIMEField *field = headers->field_find(HTTP2_VALUE_METHOD, 
HTTP2_LEN_METHOD);
+field != nullptr && field->value_is_valid(is_control_BIT | is_ws_BIT)) 
{
   int method_len;
   const char *method = field->value_get(_len);
 
@@ -503,7 +506,7 @@ http2_convert_header_from_2_to_1_1(HTTPHdr *headers)
 
   // Check validity of all names and values
   for (auto  : *headers) {
-if (!mf.name_is_valid() || !mf.value_is_valid()) {
+if (!mf.name

[trafficserver] branch asf-master-0809-1 created (now def830577)

2022-08-08 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a change to branch asf-master-0809-1
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


  at def830577 Fail fast on HTTP/2 header validation

This branch includes the following new commits:

 new def830577 Fail fast on HTTP/2 header validation

The 1 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.




[trafficserver] branch asf-master-0809-5 created (now 25acf9733)

2022-08-08 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a change to branch asf-master-0809-5
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


  at 25acf9733 Ignore POST request case from a check for background fill

This branch includes the following new commits:

 new 25acf9733 Ignore POST request case from a check for background fill

The 1 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.




[trafficserver] 01/01: Ignore POST request case from a check for background fill

2022-08-08 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch asf-master-0809-5
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 25acf973308da10bd6fbaa18456742fa98879269
Author: Masaori Koshiba 
AuthorDate: Wed Apr 20 15:15:33 2022 +0900

Ignore POST request case from a check for background fill
---
 proxy/http/HttpTunnel.h | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/proxy/http/HttpTunnel.h b/proxy/http/HttpTunnel.h
index e5e2e58a5..0bd1be845 100644
--- a/proxy/http/HttpTunnel.h
+++ b/proxy/http/HttpTunnel.h
@@ -546,12 +546,14 @@ HttpTunnel::has_consumer_besides_client() const
   continue;
 }
 
-if (consumer.vc_type == HT_HTTP_CLIENT) {
-  res = false;
+switch (consumer.vc_type) {
+case HT_HTTP_CLIENT:
   continue;
-} else {
-  res = true;
-  break;
+case HT_HTTP_SERVER:
+  // ignore uploading data to servers
+  continue;
+default:
+  return true;
 }
   }
 



[trafficserver] 01/01: Add control char check in MIME Parser

2022-08-08 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch asf-master-0809-3
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 4e4738123a49257c9ac912beab8e10dd8f0f9479
Author: Masaori Koshiba 
AuthorDate: Mon Apr 4 10:54:25 2022 +0900

Add control char check in MIME Parser
---
 include/tscore/ParseRules.h| 14 ++-
 proxy/hdrs/MIME.cc | 15 +++
 proxy/hdrs/unit_tests/test_Hdrs.cc | 48 ++
 .../gold/invalid_character_in_te_value.gold| 23 +++
 .../headers/good_request_after_bad.test.py |  2 +-
 tests/gold_tests/logging/gold/field-json-test.gold |  5 ++-
 tests/gold_tests/logging/log-field-json.test.py|  5 +++
 7 files changed, 107 insertions(+), 5 deletions(-)

diff --git a/include/tscore/ParseRules.h b/include/tscore/ParseRules.h
index 4ce4ed3d2..92bd687da 100644
--- a/include/tscore/ParseRules.h
+++ b/include/tscore/ParseRules.h
@@ -128,7 +128,7 @@ public:
   static CTypeResult is_empty(char c);// wslfcr,#
   static CTypeResult is_alnum(char c);// 0-9,A-Z,a-z
   static CTypeResult is_space(char c);// ' ' HT,VT,NP,CR,LF
-  static CTypeResult is_control(char c);  // 0-31 127
+  static CTypeResult is_control(char c);  // 0x00-0x08, 0x0a-0x1f, 0x7f
   static CTypeResult is_mime_sep(char c); // ()<>,;\"/[]?{} \t
   static CTypeResult is_http_field_name(char c);  // not : or mime_sep except 
for @
   static CTypeResult is_http_field_value(char c); // not CR, LF, comma, or "
@@ -667,14 +667,24 @@ ParseRules::is_space(char c)
 #endif
 }
 
+/**
+   Return true if @c is a control char except HTAB(0x09) and SP(0x20).
+   If you need to check @c is HTAB or SP, use `ParseRules::is_ws`.
+ */
 inline CTypeResult
 ParseRules::is_control(char c)
 {
 #ifndef COMPILE_PARSE_RULES
   return (parseRulesCType[(unsigned char)c] & is_control_BIT);
 #else
-  if (((unsigned char)c) < 32 || ((unsigned char)c) == 127)
+  if (c == CHAR_HT || c == CHAR_SP) {
+return false;
+  }
+
+  if (((unsigned char)c) < 0x20 || c == 0x7f) {
 return true;
+  }
+
   return false;
 #endif
 }
diff --git a/proxy/hdrs/MIME.cc b/proxy/hdrs/MIME.cc
index 1a2dc05db..902fd62c4 100644
--- a/proxy/hdrs/MIME.cc
+++ b/proxy/hdrs/MIME.cc
@@ -2621,6 +2621,21 @@ mime_parser_parse(MIMEParser *parser, HdrHeap *heap, 
MIMEHdrImpl *mh, const char
 
 int field_name_wks_idx = hdrtoken_tokenize(field_name.data(), 
field_name.size());
 
+if (field_name_wks_idx < 0) {
+  for (auto i : field_name) {
+if (ParseRules::is_control(i)) {
+  return PARSE_RESULT_ERROR;
+}
+  }
+}
+
+// RFC 9110 Section 5.5. Field Values
+for (char i : field_value) {
+  if (ParseRules::is_control(i)) {
+return PARSE_RESULT_ERROR;
+  }
+}
+
 ///
 // build and insert the new field object //
 ///
diff --git a/proxy/hdrs/unit_tests/test_Hdrs.cc 
b/proxy/hdrs/unit_tests/test_Hdrs.cc
index 40448aea5..7d9c39eef 100644
--- a/proxy/hdrs/unit_tests/test_Hdrs.cc
+++ b/proxy/hdrs/unit_tests/test_Hdrs.cc
@@ -531,6 +531,54 @@ TEST_CASE("HdrTest", "[proxy][hdrtest]")
   mime_init();
   http_init();
 
+  SECTION("Field Char Check")
+  {
+static struct {
+  std::string_view line;
+  ParseResult expected;
+} test_cases[] = {
+  
+  // Field Name
+  {"Content-Length: 10\r\n", PARSE_RESULT_CONT},
+  {"Content-Length\x0b: 10\r\n", PARSE_RESULT_ERROR},
+  
+  // Field Value
+  // SP
+  {"Content-Length: 10\r\n", PARSE_RESULT_CONT},
+  // HTAB
+  {"Foo: ab\td/cd\r\n", PARSE_RESULT_CONT},
+  // VCHAR
+  {"Foo: ab\x21/cd\r\n", PARSE_RESULT_CONT},
+  {"Foo: ab\x7e/cd\r\n", PARSE_RESULT_CONT},
+  // DEL
+  {"Foo: ab\x7f/cd\r\n", PARSE_RESULT_ERROR},
+  // obs-text
+  {"Foo: ab\x80/cd\r\n", PARSE_RESULT_CONT},
+  {"Foo: ab\xff/cd\r\n", PARSE_RESULT_CONT},
+  // control char
+  {"Content-Length: 10\x0b\r\n", PARSE_RESULT_ERROR},
+  {"Content-Length:\x0b 10\r\n", PARSE_RESULT_ERROR},
+  {"Foo: ab\x1d/cd\r\n", PARSE_RESULT_ERROR},
+};
+
+MIMEHdr hdr;
+MIMEParser parser;
+mime_parser_init();
+
+for (const auto  : test_cases) {
+  mime_parser_clear();
+
+  const char *start = t.line.data();
+  const char *end   = start + t.line.size();
+
+  int r = hdr.parse(, , end, false, false, false);
+  if (r != t.expected) {
+std::printf("Expected %s is %s, but not", t.line.data(), t.expected == 
PARSE_RESULT_ERROR ? "invalid" : "valid");
+  

[trafficserver] branch asf-master-0809-3 created (now 4e4738123)

2022-08-08 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a change to branch asf-master-0809-3
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


  at 4e4738123 Add control char check in MIME Parser

This branch includes the following new commits:

 new 4e4738123 Add control char check in MIME Parser

The 1 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.




[trafficserver] branch master updated (b5f2023f6 -> 6ec45d5f0)

2023-01-25 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from b5f2023f6 Added http connect Autest with proxy verifier (#9315)
 add 6ec45d5f0 s3_auth: Fix assertion failure of TSActionCancel (#9329)

No new revisions were added by this update.

Summary of changes:
 plugins/s3_auth/s3_auth.cc | 13 +
 1 file changed, 13 insertions(+)



[trafficserver] branch master updated (6ec45d5f0 -> b7b25f71c)

2023-01-25 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from 6ec45d5f0 s3_auth: Fix assertion failure of TSActionCancel (#9329)
 add b7b25f71c Add param to forward headers from the auth server to the 
origin (#9271)

No new revisions were added by this update.

Summary of changes:
 doc/admin-guide/plugins/authproxy.en.rst   | 12 +--
 plugins/authproxy/Makefile.inc |  4 +++
 plugins/authproxy/authproxy.cc | 39 ++
 .../tests/authproxy_test.cc}   | 28 +++-
 plugins/authproxy/utils.cc | 18 ++
 plugins/authproxy/utils.h  |  9 +
 6 files changed, 98 insertions(+), 12 deletions(-)
 copy plugins/{experimental/rate_limit/utilities.h => 
authproxy/tests/authproxy_test.cc} (50%)



[trafficserver] branch master updated: s3_auth: Schedule reloading config event on TASK thread (#9328)

2023-01-25 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 ab5077d57 s3_auth: Schedule reloading config event on TASK thread 
(#9328)
ab5077d57 is described below

commit ab5077d576b006de471a0d1a3f12ccf04df67a7a
Author: Masaori Koshiba 
AuthorDate: Wed Jan 25 17:03:23 2023 +0900

s3_auth: Schedule reloading config event on TASK thread (#9328)
---
 plugins/s3_auth/s3_auth.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/s3_auth/s3_auth.cc b/plugins/s3_auth/s3_auth.cc
index 352b44ce0..20984c049 100644
--- a/plugins/s3_auth/s3_auth.cc
+++ b/plugins/s3_auth/s3_auth.cc
@@ -488,7 +488,7 @@ public:
 if (_conf_rld_act != nullptr && !TSActionDone(_conf_rld_act)) {
   TSActionCancel(_conf_rld_act);
 }
-_conf_rld_act = TSContScheduleOnPool(_conf_rld, delay * 1000, 
TS_THREAD_POOL_NET);
+_conf_rld_act = TSContScheduleOnPool(_conf_rld, delay * 1000, 
TS_THREAD_POOL_TASK);
   }
 
   ts::shared_mutex reload_mutex;



[trafficserver] branch master updated: Cleanup: Remove unused functions of cache (#9166)

2022-10-31 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 3e4eb4eb4 Cleanup: Remove unused functions of cache (#9166)
3e4eb4eb4 is described below

commit 3e4eb4eb4b1272dd7b2cd584d64b347bbb4336ef
Author: Masaori Koshiba 
AuthorDate: Tue Nov 1 09:13:31 2022 +0900

Cleanup: Remove unused functions of cache (#9166)
---
 iocore/cache/Cache.cc | 27 ---
 iocore/cache/I_Cache.h|  1 -
 iocore/cache/P_CacheDir.h |  1 -
 iocore/cache/P_CacheVol.h | 12 
 4 files changed, 41 deletions(-)

diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index 652984ab6..dd1751b41 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -1073,15 +1073,6 @@ CacheProcessor::dir_check(bool afix)
   return 0;
 }
 
-int
-CacheProcessor::db_check(bool afix)
-{
-  for (int i = 0; i < gnvol; i++) {
-gvol[i]->db_check(afix);
-  }
-  return 0;
-}
-
 Action *
 CacheProcessor::lookup(Continuation *cont, const CacheKey *key, CacheFragType 
frag_type, const char *hostname, int host_len)
 {
@@ -1135,24 +1126,6 @@ CacheProcessor::IsCacheReady(CacheFragType type)
   return static_cast(cache_ready & (1 << type));
 }
 
-int
-Vol::db_check(bool /* fix ATS_UNUSED */)
-{
-  char tt[256];
-  printf("Data for [%s]\n", hash_text.get());
-  printf("Length:  %" PRIu64 "\n", static_cast(len));
-  printf("Write Position:  %" PRIu64 "\n", 
static_cast(header->write_pos - skip));
-  printf("Phase:   %d\n", static_cast(!!header->phase));
-  ink_ctime_r(>create_time, tt);
-  tt[strlen(tt) - 1] = 0;
-  printf("Create Time: %s\n", tt);
-  printf("Sync Serial: %u\n", static_cast(header->sync_serial));
-  printf("Write Serial:%u\n", static_cast(header->write_serial));
-  printf("\n");
-
-  return 0;
-}
-
 static void
 vol_init_data_internal(Vol *d)
 {
diff --git a/iocore/cache/I_Cache.h b/iocore/cache/I_Cache.h
index 103d22ddc..5cdb1f604 100644
--- a/iocore/cache/I_Cache.h
+++ b/iocore/cache/I_Cache.h
@@ -72,7 +72,6 @@ struct CacheProcessor : public Processor {
   void stop();
 
   int dir_check(bool fix);
-  int db_check(bool fix);
 
   Action *lookup(Continuation *cont, const CacheKey *key, CacheFragType 
frag_type = CACHE_FRAG_TYPE_NONE,
  const char *hostname = nullptr, int host_len = 0);
diff --git a/iocore/cache/P_CacheDir.h b/iocore/cache/P_CacheDir.h
index 70e6bfded..b83e6111a 100644
--- a/iocore/cache/P_CacheDir.h
+++ b/iocore/cache/P_CacheDir.h
@@ -274,7 +274,6 @@ struct CacheSync : public Continuation {
 // Global Functions
 
 void vol_init_dir(Vol *d);
-int dir_token_probe(const CacheKey *, Vol *, Dir *);
 int dir_probe(const CacheKey *, Vol *, Dir *, Dir **);
 int dir_insert(const CacheKey *key, Vol *d, Dir *to_part);
 int dir_overwrite(const CacheKey *key, Vol *d, Dir *to_part, Dir *overwrite, 
bool must_overwrite = true);
diff --git a/iocore/cache/P_CacheVol.h b/iocore/cache/P_CacheVol.h
index 24d9d4313..cf91c2aa9 100644
--- a/iocore/cache/P_CacheVol.h
+++ b/iocore/cache/P_CacheVol.h
@@ -204,21 +204,10 @@ struct Vol : public Continuation {
   int dir_init_done(int event, void *data);
 
   int dir_check(bool fix);
-  int db_check(bool fix);
 
   bool evac_bucket_valid(off_t bucket) const;
 
   int is_io_in_progress() const;
-  int
-  increment_generation()
-  {
-// this is stored in the offset field of the directory (!=0)
-ink_assert(mutex->thread_holding == this_ethread());
-header->generation++;
-if (!header->generation)
-  header->generation++;
-return header->generation;
-  }
   void set_io_not_in_progress();
 
   int aggWriteDone(int event, Event *e);
@@ -317,7 +306,6 @@ struct Doc {
   uint32_t data_len() const;
   uint32_t prefix_len() const;
   int single_fragment() const;
-  int no_data_in_fragment();
   char *hdr();
   char *data();
 };



[trafficserver] branch master updated (c32399c1b -> 48bf028f4)

2022-11-07 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from c32399c1b TSan: Fix data race of g_num_records (#9170)
 add 48bf028f4 Add ThreadSanitizer suppressions file to ignore data race of 
freelist (#9171)

No new revisions were added by this update.

Summary of changes:
 configs/body_factory/Makefile.am => .tsan_suppressions | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)
 copy configs/body_factory/Makefile.am => .tsan_suppressions (75%)



[trafficserver] branch master updated (48bf028f4 -> 800d807c8)

2022-11-07 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from 48bf028f4 Add ThreadSanitizer suppressions file to ignore data race of 
freelist (#9171)
 add 800d807c8 TSan: Fix data race of hostdb_current_timestamp (#9172)

No new revisions were added by this update.

Summary of changes:
 iocore/hostdb/HostDB.cc   | 4 ++--
 iocore/hostdb/I_HostDBProcessor.h | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)



[trafficserver] branch master updated (a5f647a20 -> cf269a378)

2022-11-07 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from a5f647a20 update autest version (#9180)
 add cf269a378 TSan: Fix data race of RecMutex::thread_holding (#9169)

No new revisions were added by this update.

Summary of changes:
 include/records/I_RecMutex.h | 4 +++-
 src/records/RecMutex.cc  | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)



[trafficserver] branch master updated (cf269a378 -> c32399c1b)

2022-11-07 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from cf269a378 TSan: Fix data race of RecMutex::thread_holding (#9169)
 add c32399c1b TSan: Fix data race of g_num_records (#9170)

No new revisions were added by this update.

Summary of changes:
 src/records/P_RecCore.cc | 4 
 src/records/RecUtils.cc  | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)



[trafficserver] branch master updated (1a6120296 -> 9746d4e56)

2023-03-07 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from 1a6120296 use plugin msg to reload config (#9323)
 add 9746d4e56 Cleanup: More const-crrectness of cache read (#9502)

No new revisions were added by this update.

Summary of changes:
 iocore/cache/Cache.cc | 4 ++--
 iocore/cache/CacheDir.cc  | 2 +-
 iocore/cache/P_CacheDir.h | 2 +-
 iocore/cache/P_CacheVol.h | 8 
 4 files changed, 8 insertions(+), 8 deletions(-)



[trafficserver] branch master updated (f75fecb140 -> 45fdee4c97)

2023-04-24 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from f75fecb140 Replace obsolete Debug() macro with Dbg() in SocksProxy.cc. 
(#9613)
 add 45fdee4c97 Cleanup: Get rid of dead code from Cache (#9621)

No new revisions were added by this update.

Summary of changes:
 iocore/cache/CacheDir.cc  |  1 -
 iocore/cache/P_CacheDir.h | 22 --
 2 files changed, 23 deletions(-)



[trafficserver] branch master updated: Cleanup: Rename d with vol (#9619)

2023-04-19 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 28e883dbec Cleanup: Rename d with vol (#9619)
28e883dbec is described below

commit 28e883dbec265fea554389f602c85f8d075d884e
Author: Masaori Koshiba 
AuthorDate: Thu Apr 20 09:50:26 2023 +0900

Cleanup: Rename d with vol (#9619)
---
 iocore/cache/Cache.cc  |  62 +++---
 iocore/cache/CacheDir.cc   | 448 -
 iocore/cache/CacheVol.cc   |  26 +--
 iocore/cache/P_CacheDir.h  |  30 +--
 iocore/cache/P_CacheInternal.h |  20 +-
 iocore/cache/P_CacheVol.h  |   4 +-
 6 files changed, 293 insertions(+), 297 deletions(-)

diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index c8e5b7c6b9..a52fc39606 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -1128,63 +1128,63 @@ CacheProcessor::IsCacheReady(CacheFragType type)
 }
 
 static void
-vol_init_data_internal(Vol *d)
+vol_init_data_internal(Vol *vol)
 {
   // step1: calculate the number of entries.
-  off_t total_entries = (d->len - (d->start - d->skip)) / 
cache_config_min_average_object_size;
+  off_t total_entries = (vol->len - (vol->start - vol->skip)) / 
cache_config_min_average_object_size;
   // step2: calculate the number of buckets
   off_t total_buckets = total_entries / DIR_DEPTH;
   // step3: calculate the number of segments, no segment has more than 16384 
buckets
-  d->segments = (total_buckets + (((1 << 16) - 1) / DIR_DEPTH)) / ((1 << 16) / 
DIR_DEPTH);
+  vol->segments = (total_buckets + (((1 << 16) - 1) / DIR_DEPTH)) / ((1 << 16) 
/ DIR_DEPTH);
   // step4: divide total_buckets into segments on average.
-  d->buckets = (total_buckets + d->segments - 1) / d->segments;
+  vol->buckets = (total_buckets + vol->segments - 1) / vol->segments;
   // step5: set the start pointer.
-  d->start = d->skip + 2 * d->dirlen();
+  vol->start = vol->skip + 2 * vol->dirlen();
 }
 
 static void
-vol_init_data(Vol *d)
+vol_init_data(Vol *vol)
 {
   // iteratively calculate start + buckets
-  vol_init_data_internal(d);
-  vol_init_data_internal(d);
-  vol_init_data_internal(d);
+  vol_init_data_internal(vol);
+  vol_init_data_internal(vol);
+  vol_init_data_internal(vol);
 }
 
 void
-vol_init_dir(Vol *d)
+vol_init_dir(Vol *vol)
 {
   int b, s, l;
 
-  for (s = 0; s < d->segments; s++) {
-d->header->freelist[s] = 0;
-Dir *seg   = d->dir_segment(s);
+  for (s = 0; s < vol->segments; s++) {
+vol->header->freelist[s] = 0;
+Dir *seg = vol->dir_segment(s);
 for (l = 1; l < DIR_DEPTH; l++) {
-  for (b = 0; b < d->buckets; b++) {
+  for (b = 0; b < vol->buckets; b++) {
 Dir *bucket = dir_bucket(b, seg);
-dir_free_entry(dir_bucket_row(bucket, l), s, d);
+dir_free_entry(dir_bucket_row(bucket, l), s, vol);
   }
 }
   }
 }
 
 void
-vol_clear_init(Vol *d)
-{
-  size_t dir_len = d->dirlen();
-  memset(d->raw_dir, 0, dir_len);
-  vol_init_dir(d);
-  d->header->magic  = VOL_MAGIC;
-  d->header->version._major = CACHE_DB_MAJOR_VERSION;
-  d->header->version._minor = CACHE_DB_MINOR_VERSION;
-  d->scan_pos = d->header->agg_pos = d->header->write_pos = d->start;
-  d->header->last_write_pos   = 
d->header->write_pos;
-  d->header->phase= 0;
-  d->header->cycle= 0;
-  d->header->create_time  = time(nullptr);
-  d->header->dirty= 0;
-  d->sector_size = d->header->sector_size = d->disk->hw_sector_size;
-  *d->footer  = *d->header;
+vol_clear_init(Vol *vol)
+{
+  size_t dir_len = vol->dirlen();
+  memset(vol->raw_dir, 0, dir_len);
+  vol_init_dir(vol);
+  vol->header->magic  = VOL_MAGIC;
+  vol->header->version._major = CACHE_DB_MAJOR_VERSION;
+  vol->header->version._minor = CACHE_DB_MINOR_VERSION;
+  vol->scan_pos = vol->header->agg_pos = vol->header->write_pos = vol->start;
+  vol->header->last_write_pos   = 
vol->header->write_pos;
+  vol->header->phase= 0;
+  vol->header->cycle= 0;
+  vol->header->create_time  = 
time(nullptr);
+  vol->header->dirty= 0;
+  vol->sector_size = vol->header->sector_size = vol->disk->hw_sector_siz

[trafficserver] branch master updated: Add a hyphen between PACKAGE_VERSION and BUILD_NUMBER (#9577)

2023-04-03 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 dcb0c8e2c Add a hyphen between PACKAGE_VERSION and BUILD_NUMBER (#9577)
dcb0c8e2c is described below

commit dcb0c8e2c65f4fd84efe73983cbb2509e5e0d9ff
Author: Masaori Koshiba 
AuthorDate: Tue Apr 4 07:09:40 2023 +0900

Add a hyphen between PACKAGE_VERSION and BUILD_NUMBER (#9577)
---
 src/traffic_server/traffic_server.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/traffic_server/traffic_server.cc 
b/src/traffic_server/traffic_server.cc
index 14e249998..d14947505 100644
--- a/src/traffic_server/traffic_server.cc
+++ b/src/traffic_server/traffic_server.cc
@@ -1748,7 +1748,7 @@ main(int /* argc ATS_UNUSED */, const char **argv)
   // Before accessing file system initialize Layout engine
   Layout::create();
   // Let's be clear on what exactly is starting up.
-  printf("Traffic Server " PACKAGE_VERSION BUILD_NUMBER " " __DATE__ " " 
__TIME__ " " BUILD_MACHINE "\n");
+  printf("Traffic Server " PACKAGE_VERSION "-" BUILD_NUMBER " " __DATE__ " " 
__TIME__ " " BUILD_MACHINE "\n");
   chdir_root(); // change directory to the install root of traffic server.
 
   std::sort(argument_descriptions, argument_descriptions + 
countof(argument_descriptions),



[trafficserver] branch master updated: coverity 1497413: Use of 32-bit time_t (#9556)

2023-03-27 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 822172a33 coverity 1497413: Use of 32-bit time_t (#9556)
822172a33 is described below

commit 822172a339bc7fcbcabb6a9ebb2df4433b3bf8bc
Author: Masaori Koshiba 
AuthorDate: Tue Mar 28 08:06:27 2023 +0900

coverity 1497413: Use of 32-bit time_t (#9556)

This also fixes 1497354 and 1497378.
---
 iocore/cache/CacheWrite.cc | 8 
 iocore/cache/P_CacheInternal.h | 2 +-
 iocore/cache/P_CacheVol.h  | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/iocore/cache/CacheWrite.cc b/iocore/cache/CacheWrite.cc
index 5e32aed8a..8ea41251b 100644
--- a/iocore/cache/CacheWrite.cc
+++ b/iocore/cache/CacheWrite.cc
@@ -680,7 +680,7 @@ Vol::evacuateDocReadDone(int event, Event *e)
   if (!b) {
 goto Ldone;
   }
-  if ((b->f.pinned && !b->readers) && doc->pinned < 
static_cast(Thread::get_hrtime() / HRTIME_SECOND)) {
+  if ((b->f.pinned && !b->readers) && doc->pinned < 
static_cast(Thread::get_hrtime() / HRTIME_SECOND)) {
 goto Ldone;
   }
 
@@ -817,7 +817,7 @@ agg_copy(char *p, CacheVC *vc)
 doc->checksum= DOC_NO_CHECKSUM;
 if (vc->pin_in_cache) {
   dir_set_pinned(>dir, 1);
-  doc->pinned = static_cast(Thread::get_hrtime() / 
HRTIME_SECOND) + vc->pin_in_cache;
+  doc->pinned = static_cast(Thread::get_hrtime() / HRTIME_SECOND) 
+ vc->pin_in_cache;
 } else {
   dir_set_pinned(>dir, 0);
   doc->pinned = 0;
@@ -1720,7 +1720,7 @@ Cache::open_write(Continuation *cont, const CacheKey 
*key, CacheFragType frag_ty
   c->f.overwrite  = (options & CACHE_WRITE_OPT_OVERWRITE) != 0;
   c->f.close_complete = (options & CACHE_WRITE_OPT_CLOSE_COMPLETE) != 0;
   c->f.sync   = (options & CACHE_WRITE_OPT_SYNC) == 
CACHE_WRITE_OPT_SYNC;
-  c->pin_in_cache = static_cast(apin_in_cache);
+  c->pin_in_cache = apin_in_cache;
 
   if ((res = c->vol->open_write_lock(c, false, 1)) > 0) {
 // document currently being written, abort
@@ -1820,7 +1820,7 @@ Cache::open_write(Continuation *cont, const CacheKey 
*key, CacheHTTPInfo *info,
 c->base_stat = cache_write_active_stat;
   }
   CACHE_INCREMENT_DYN_STAT(c->base_stat + CACHE_STAT_ACTIVE);
-  c->pin_in_cache = static_cast(apin_in_cache);
+  c->pin_in_cache = apin_in_cache;
 
   {
 CACHE_TRY_LOCK(lock, c->vol->mutex, cont->mutex->thread_holding);
diff --git a/iocore/cache/P_CacheInternal.h b/iocore/cache/P_CacheInternal.h
index 91f499369..fd6b28679 100644
--- a/iocore/cache/P_CacheInternal.h
+++ b/iocore/cache/P_CacheInternal.h
@@ -465,7 +465,7 @@ struct CacheVC : public CacheVConnection {
   Event *trigger;
   CacheKey *read_key;
   ContinuationHandler save_handler;
-  uint32_t pin_in_cache;
+  time_t pin_in_cache;
   ink_hrtime start_time;
   int base_stat;
   int recursive;
diff --git a/iocore/cache/P_CacheVol.h b/iocore/cache/P_CacheVol.h
index 544b1d86f..be066923d 100644
--- a/iocore/cache/P_CacheVol.h
+++ b/iocore/cache/P_CacheVol.h
@@ -298,8 +298,8 @@ struct Doc {
   uint32_t unused   : 8; ///< Unused, forced to zero.
   uint32_t sync_serial;
   uint32_t write_serial;
-  uint32_t pinned; // pinned until
   uint32_t checksum;
+  time_t pinned; // pinned until
 #if TS_ENABLE_FIPS == 1
   CryptoHash key; ///< Key for this doc.
 #endif



[trafficserver] branch master updated: Issue 9274: read-while-writer readers can't find fragment inserted (#9303)

2023-02-06 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 92800eb089 Issue 9274: read-while-writer readers can't find fragment 
inserted (#9303)
92800eb089 is described below

commit 92800eb0890e4926f7bec82565d8331e30d106d8
Author: Brett Granger <68439042+bdgran...@users.noreply.github.com>
AuthorDate: Mon Feb 6 19:38:51 2023 -0500

Issue 9274: read-while-writer readers can't find fragment inserted (#9303)

* Issue 9274: read-while-writer readers can't find fragment inserted
When last_collision is set, dir_probe starts at the bucket head
and skips all collisions until last_collision is reached, then
continues the probe from that point. dir_insert always inserts
new entries immediately after the bucket head. So unless last_collision
is the bucket head, any new entries inserted with last_collision
set will be inserted before last_collision and will never be found
by rww readers.

Modify dir_insert to always insert new entries at the tail of the
list. This will entail walking the entire list once on each insert.
However, the lists should be entirely in memory and quite short,
so this should not present too much performance hit.

* fix regression test failure
add a loop counter to break out of infinite loop in corrupt_bucket
test. Worst case is that every directory entry could be added to
the same bucket (won't happen in real usage, but does happen in
the test), so need to set the counter to break out after maximum
number of entries in a segment.

* Fix formatting

-

Co-authored-by: Brett Granger 
---
 iocore/cache/CacheDir.cc | 31 +++
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git a/iocore/cache/CacheDir.cc b/iocore/cache/CacheDir.cc
index 1038c3e0a2..6baf3be842 100644
--- a/iocore/cache/CacheDir.cc
+++ b/iocore/cache/CacheDir.cc
@@ -640,8 +640,21 @@ Lagain:
 goto Lagain;
   }
 Llink:
-  dir_set_next(e, dir_next(b));
-  dir_set_next(b, dir_to_offset(e, seg));
+  // dir_probe searches from head to tail of list and resumes from 
last_collision.
+  // Need to insert at the tail of the list so that no entries can be inserted
+  // before last_collision. This means walking the entire list on each insert,
+  // but at least the lists are completely in memory and should be quite short
+  Dir *prev, *last;
+
+  l= 0;
+  last = b;
+  do {
+prev = last;
+last = next_dir(last, seg);
+  } while (last && (++l <= d->buckets * DIR_DEPTH));
+
+  dir_set_next(e, 0);
+  dir_set_next(prev, dir_to_offset(e, seg));
 Lfill:
   dir_assign_data(e, to_part);
   dir_set_tag(e, key->slice32(2));
@@ -717,8 +730,18 @@ Lagain:
   }
 Llink:
   CACHE_INC_DIR_USED(d->mutex);
-  dir_set_next(e, dir_next(b));
-  dir_set_next(b, dir_to_offset(e, seg));
+  // as with dir_insert above, need to insert new entries at the tail of the 
linked list
+  Dir *prev, *last;
+
+  l= 0;
+  last = b;
+  do {
+prev = last;
+last = next_dir(last, seg);
+  } while (last && (++l <= d->buckets * DIR_DEPTH));
+
+  dir_set_next(e, 0);
+  dir_set_next(prev, dir_to_offset(e, seg));
 Lfill:
   dir_assign_data(e, dir);
   dir_set_tag(e, t);



[trafficserver] branch master updated (22c57c4f98 -> 60541bac9a)

2023-02-13 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from 22c57c4f98 This removes the support for Solaris (#9402)
 add 60541bac9a Fix missing semi-colon (#9393)

No new revisions were added by this update.

Summary of changes:
 include/tscore/ink_memory.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



[trafficserver] branch master updated (60541bac9a -> 72e6602331)

2023-02-13 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from 60541bac9a Fix missing semi-colon (#9393)
 add 72e6602331 TSan: Make Thread::cur_time thread local (#9184)

No new revisions were added by this update.

Summary of changes:
 iocore/eventsystem/I_Thread.h | 6 +++---
 iocore/eventsystem/Thread.cc  | 2 +-
 proxy/logging/Log.cc  | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)



[trafficserver] branch master updated (2cb4202a9b -> b462f086fc)

2023-07-17 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from 2cb4202a9b cmake: -Wall -Wextra (#10050)
 add b462f086fc Do not set @SECLEVEL with borginssl (#9989)

No new revisions were added by this update.

Summary of changes:
 tests/gold_tests/tls/tls_client_versions.test.py | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)



[trafficserver] branch master updated (b462f086fc -> 8c71a4cc4e)

2023-07-17 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from b462f086fc Do not set @SECLEVEL with borginssl (#9989)
 add 8c71a4cc4e LSan: Fix leaks of Cache Unit Test (#10038)

No new revisions were added by this update.

Summary of changes:
 iocore/cache/test/test_Alternate_L_to_S_remove_L.cc | 1 +
 iocore/cache/test/test_Alternate_L_to_S_remove_S.cc | 1 +
 iocore/cache/test/test_Alternate_S_to_L_remove_L.cc | 1 +
 iocore/cache/test/test_Alternate_S_to_L_remove_S.cc | 1 +
 4 files changed, 4 insertions(+)



[trafficserver] branch master updated: LSan: Fix memory leak of test_HostFile (#10064)

2023-07-20 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 837b5ea977 LSan: Fix memory leak of test_HostFile (#10064)
837b5ea977 is described below

commit 837b5ea9772a168b7956c25a042dbb7df722cab5
Author: Masaori Koshiba 
AuthorDate: Fri Jul 21 07:37:38 2023 +0900

LSan: Fix memory leak of test_HostFile (#10064)
---
 iocore/hostdb/test_HostFile.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/iocore/hostdb/test_HostFile.cc b/iocore/hostdb/test_HostFile.cc
index a28cba8399..1f8cfe7215 100644
--- a/iocore/hostdb/test_HostFile.cc
+++ b/iocore/hostdb/test_HostFile.cc
@@ -175,4 +175,5 @@ HostDBRecord::alloc(swoc::TextView query_name, unsigned int 
rr_count, size_t srv
 void
 HostDBRecord::free()
 {
+  delete this;
 }



[trafficserver] branch master updated: Add BRAVO Reader-Writer Lock (#9394)

2023-05-22 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 c331c7205c Add BRAVO Reader-Writer Lock (#9394)
c331c7205c is described below

commit c331c7205cf1b0f4a4955211ccbec50d36fb063e
Author: Masaori Koshiba 
AuthorDate: Tue May 23 07:52:57 2023 +0900

Add BRAVO Reader-Writer Lock (#9394)

* Add BRAVO Reader-Writer Lock

* Add DenseThreadId

Signed-off-by: Walt Karas 
---
 .gitignore  |   1 +
 NOTICE  |   5 +
 include/tscpp/util/Bravo.h  | 377 
 include/tscpp/util/DenseThreadId.h  | 116 
 src/tscore/Makefile.am  |   7 +-
 src/tscore/unit_tests/benchmark_shared_mutex.cc | 134 +
 src/tscore/unit_tests/test_Bravo.cc | 229 ++
 src/tscpp/util/Makefile.am  |   4 +-
 8 files changed, 871 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index 30a42adcc6..426124c8ef 100644
--- a/.gitignore
+++ b/.gitignore
@@ -86,6 +86,7 @@ src/tscore/ink_autoconf.h
 src/tscore/ink_autoconf.h.in
 include/tscore/ink_config.h
 include/ts/apidefs.h
+src/tscore/benchmark_shared_mutex
 src/tscore/CompileParseRules
 src/tscore/CompileParseRules.dSYM
 src/tscore/ParseRulesCType
diff --git a/NOTICE b/NOTICE
index 949f852011..50552702ca 100644
--- a/NOTICE
+++ b/NOTICE
@@ -96,3 +96,8 @@ https://github.com/jbeder/yaml-cpp
 
 fastlz: an ANSI C/C90 implementation of Lempel-Ziv 77 algorithm (LZ77) of 
lossless data compression.
 https://github.com/ariya/FastLZ
+
+~~
+
+include/tscpp/util/Bravo.h is C++ version of puzpuzpuz/xsync's RBMutex
+Copyright (c) 2021 Andrey Pechkurov (MIT License)
diff --git a/include/tscpp/util/Bravo.h b/include/tscpp/util/Bravo.h
new file mode 100644
index 00..a9155d3492
--- /dev/null
+++ b/include/tscpp/util/Bravo.h
@@ -0,0 +1,377 @@
+/** @file
+
+  Implementation of BRAVO - Biased Locking for Reader-Writer Locks
+
+  Dave Dice and Alex Kogan. 2019. BRAVO: Biased Locking for Reader-Writer 
Locks.
+  In Proceedings of the 2019 USENIX Annual Technical Conference (ATC). USENIX 
Association, Renton, WA, 315–328.
+
+  https://www.usenix.org/conference/atc19/presentation/dice
+
+  > Section 3.
+  >   BRAVO acts as an accelerator layer, as readers can always fall back to 
the traditional underlying lock to gain read access.
+  >   ...
+  >   Write performance and the scalability of read-vs-write and 
write-vs-write behavior depends solely on the underlying lock.
+
+  This code is C++ version of puzpuzpuz/xsync's RBMutex
+  https://github.com/puzpuzpuz/xsync/blob/main/rbmutex.go
+  Copyright (c) 2021 Andrey Pechkurov
+
+  @section license License
+
+  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.
+ */
+
+#pragma once
+
+#include "DenseThreadId.h"
+
+#include "tscore/Diags.h"
+#include "tscore/ink_assert.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+namespace ts::bravo
+{
+using time_point = std::chrono::time_point;
+
+#ifdef __cpp_lib_hardware_interference_size
+using std::hardware_constructive_interference_size;
+#else
+// 64 bytes on x86-64 │ L1_CACHE_BYTES │ L1_CACHE_SHIFT │ __cacheline_aligned 
│ ...
+constexpr std::size_t hardware_constructive_interference_size = 64;
+#endif
+
+/**
+   ts::bravo::Token
+
+   Token for readers.
+   0 is special value that represents inital/invalid value.
+ */
+using Token = size_t;
+
+/**
+   ts::bravo::shared_lock
+ */
+template  class shared_lock
+{
+public:
+  using mutex_type = Mutex;
+
+  shared_lock() noexcept = default;
+  shared_lock(Mutex ) : _mutex() { lock(); }
+  shared_lock(Mutex , std::try_to_lock_t) : _mutex() { try_lock(); }
+  shared_lock(Mutex , std::defer_lock_t) noexcept : _mutex() {}
+
+  ~shared_lock()
+  {
+if (_owns) {
+  _mutex->unlock_shared(_token);
+}
+  };
+
+  
+  // Not Copyable
+  //
+  shared_lock(shared_lock const &)= delete;
+  

[trafficserver] branch master updated: Cleanup: Fix format of doc corruption message (#9725)

2023-05-22 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 2e50a2c146 Cleanup: Fix format of doc corruption message (#9725)
2e50a2c146 is described below

commit 2e50a2c146d46f254ae338f31388f72d8f6d6de7
Author: Masaori Koshiba 
AuthorDate: Tue May 23 07:51:25 2023 +0900

Cleanup: Fix format of doc corruption message (#9725)
---
 iocore/cache/CacheRead.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/iocore/cache/CacheRead.cc b/iocore/cache/CacheRead.cc
index 967d1ae7ef..315dc246ec 100644
--- a/iocore/cache/CacheRead.cc
+++ b/iocore/cache/CacheRead.cc
@@ -908,7 +908,7 @@ CacheVC::openReadStartEarliest(int /* event ATS_UNUSED */, 
Event * /* e ATS_UNUS
   if (doc->magic == DOC_CORRUPT) {
 Warning("Earliest: Doc checksum does not match for %s", 
key.toHexStr(tmpstring));
   } else {
-Warning("Earliest : Doc magic does not match for %s", 
key.toHexStr(tmpstring));
+Warning("Earliest: Doc magic does not match for %s", 
key.toHexStr(tmpstring));
   }
   // remove the dir entry
   dir_delete(, vol, );
@@ -,7 +,7 @@ CacheVC::openReadStartHead(int event, Event *e)
   if (doc->magic == DOC_CORRUPT) {
 Warning("Head: Doc checksum does not match for %s", 
key.toHexStr(tmpstring));
   } else {
-Warning("Head : Doc magic does not match for %s", 
key.toHexStr(tmpstring));
+Warning("Head: Doc magic does not match for %s", 
key.toHexStr(tmpstring));
   }
   // remove the dir entry
   dir_delete(, vol, );



[trafficserver] branch master updated (003e9ce2b9 -> b2fed05f74)

2023-07-31 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from 003e9ce2b9 Use dynamic dispatch for EventIO (#10035)
 add b2fed05f74 LSan: Suppress memory leak report of 
RegressionTest_UDPNet_echo (#10072)

No new revisions were added by this update.

Summary of changes:
 ci/asan_leak_suppression/regression.txt | 1 +
 iocore/net/Makefile.am  | 1 +
 2 files changed, 2 insertions(+)



[trafficserver] branch master updated: Cleanup: Collect micro-benchmark programs (#9998)

2023-07-24 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 72cb897b46 Cleanup: Collect micro-benchmark programs (#9998)
72cb897b46 is described below

commit 72cb897b469eece1e956b90e5433182dc99e5f96
Author: Masaori Koshiba 
AuthorDate: Tue Jul 25 08:23:47 2023 +0900

Cleanup: Collect micro-benchmark programs (#9998)
---
 .gitignore |  7 +-
 configure.ac   |  1 +
 iocore/eventsystem/Makefile.am |  8 +--
 src/tscore/Makefile.am | 11 +---
 tools/Makefile.am  |  2 +
 tools/benchmark/Makefile.am| 75 ++
 .../benchmark/benchmark_FreeList.cc|  0
 .../benchmark}/benchmark_ProxyAllocator.cc |  0
 .../benchmark/benchmark_SharedMutex.cc |  0
 9 files changed, 84 insertions(+), 20 deletions(-)

diff --git a/.gitignore b/.gitignore
index cd8a5e475a..a4983d434b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -87,13 +87,11 @@ src/tscore/ink_autoconf.h
 src/tscore/ink_autoconf.h.in
 include/tscore/ink_config.h
 include/ts/apidefs.h
-src/tscore/benchmark_shared_mutex
 src/tscore/CompileParseRules
 src/tscore/CompileParseRules.dSYM
 src/tscore/ParseRulesCType
 src/tscore/ParseRulesCTypeToLower
 src/tscore/ParseRulesCTypeToUpper
-src/tscore/freelist_benchmark
 src/tscore/mkdfa
 src/tscore/test_atomic
 src/tscore/test_freelist
@@ -114,7 +112,6 @@ iocore/aio/test_AIO
 iocore/eventsystem/test_IOBuffer
 iocore/eventsystem/test_EventSystem
 iocore/eventsystem/test_MIOBufferWriter
-iocore/eventsystem/benchmark_ProxyAllocator
 
 iocore/hostdb/test_RefCountCache
 iocore/hostdb/test_HostFile
@@ -164,6 +161,10 @@ plugins/esi/vars_test
 
 plugins/experimental/uri_signing/test_uri_signing
 
+tools/benchmark/benchmark_FreeList
+tools/benchmark/benchmark_ProxyAllocator
+tools/benchmark/benchmark_SharedMutex
+
 mgmt/rpc/overridable_txn_vars.cc
 mgmt/rpc/IPCSocketClient.cc
 mgmt/rpc/test_jsonrpc
diff --git a/configure.ac b/configure.ac
index 3dc8c3d18d..0eb8249053 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2403,6 +2403,7 @@ AC_CONFIG_FILES([
   tools/Makefile
   tools/trafficserver.pc
   tools/tsxs
+  tools/benchmark/Makefile
   tests/Makefile
 ])
 
diff --git a/iocore/eventsystem/Makefile.am b/iocore/eventsystem/Makefile.am
index b49cb0091d..9701c2cdf9 100644
--- a/iocore/eventsystem/Makefile.am
+++ b/iocore/eventsystem/Makefile.am
@@ -76,8 +76,7 @@ libinkevent_a_SOURCES = \
 
 check_PROGRAMS = test_IOBuffer \
test_EventSystem \
-   test_MIOBufferWriter \
-   benchmark_ProxyAllocator
+   test_MIOBufferWriter
 
 test_LD_FLAGS = \
@AM_LDFLAGS@ \
@@ -115,11 +114,6 @@ test_MIOBufferWriter_SOURCES = 
unit_tests/test_MIOBufferWriter.cc
 test_MIOBufferWriter_CPPFLAGS = $(test_CPP_FLAGS)
 test_MIOBufferWriter_LDFLAGS = $(test_LD_FLAGS)
 
-benchmark_ProxyAllocator_SOURCES = unit_tests/benchmark_ProxyAllocator.cc
-benchmark_ProxyAllocator_CPPFLAGS = $(test_CPP_FLAGS)
-benchmark_ProxyAllocator_LDFLAGS = $(test_LD_FLAGS)
-benchmark_ProxyAllocator_LDADD = $(test_LD_ADD)
-
 include $(top_srcdir)/mk/tidy.mk
 
 clang-tidy-local: $(DIST_SOURCES)
diff --git a/src/tscore/Makefile.am b/src/tscore/Makefile.am
index b97c022729..2012d49918 100644
--- a/src/tscore/Makefile.am
+++ b/src/tscore/Makefile.am
@@ -18,7 +18,7 @@
 
 include $(top_srcdir)/mk/tidy.mk
 
-noinst_PROGRAMS = CompileParseRules freelist_benchmark benchmark_shared_mutex
+noinst_PROGRAMS = CompileParseRules
 check_PROGRAMS = test_geometry test_X509HostnameValidator test_tscore
 
 if EXPENSIVE_TESTS
@@ -190,15 +190,6 @@ test_tscore_SOURCES += \
unit_tests/test_HKDF.cc
 endif
 
-freelist_benchmark_CXXFLAGS = -Wno-array-bounds $(AM_CXXFLAGS) 
-I$(abs_top_srcdir)/lib/catch2
-freelist_benchmark_LDADD = libtscore.a @HWLOC_LIBS@ @LIBPCRE@ @LIBCAP@
-freelist_benchmark_SOURCES = unit_tests/freelist_benchmark.cc
-
-benchmark_shared_mutex_CXXFLAGS = -Wno-array-bounds $(AM_CXXFLAGS) 
-I$(abs_top_srcdir)/lib/catch2
-benchmark_shared_mutex_LDADD = libtscore.a @LIBPCRE@ @LIBCAP@
-
-benchmark_shared_mutex_SOURCES = unit_tests/benchmark_shared_mutex.cc
-
 CompileParseRules_SOURCES = CompileParseRules.cc
 
 CompileParseRules$(BUILD_EXEEXT): $(CompileParseRules_OBJECTS)
diff --git a/tools/Makefile.am b/tools/Makefile.am
index c092f23776..3592e938f1 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -17,6 +17,8 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
+SUBDIRS = benchmark
+
 bin_SCRIPTS = tsxs tspush
 
 pkgconfigdir = $(libdir)/pkgconfig
diff --git a/tools/benchmark/Makefile.am b/tools/benchmark/Makefile.am
new file mode 100644
index 00..93417a0fff
--- /dev/null

[trafficserver] branch master updated: ASan: Fix alloc-dealloc-mismatch of test_HostFile (#10084)

2023-07-24 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 99c4d32b1b ASan: Fix alloc-dealloc-mismatch of test_HostFile (#10084)
99c4d32b1b is described below

commit 99c4d32b1bbaf34da50cda85e53455a25266bdb7
Author: Masaori Koshiba 
AuthorDate: Tue Jul 25 10:46:45 2023 +0900

ASan: Fix alloc-dealloc-mismatch of test_HostFile (#10084)
---
 iocore/hostdb/test_HostFile.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/iocore/hostdb/test_HostFile.cc b/iocore/hostdb/test_HostFile.cc
index 1f8cfe7215..68d645af14 100644
--- a/iocore/hostdb/test_HostFile.cc
+++ b/iocore/hostdb/test_HostFile.cc
@@ -175,5 +175,5 @@ HostDBRecord::alloc(swoc::TextView query_name, unsigned int 
rr_count, size_t srv
 void
 HostDBRecord::free()
 {
-  delete this;
+  std::free(this);
 }



[trafficserver] branch master updated: Strictly follow Content-Length header ABNF rule (#10144)

2023-08-06 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 f9aa1e0adb Strictly follow Content-Length header ABNF rule (#10144)
f9aa1e0adb is described below

commit f9aa1e0adb7d23cb9d9dd4fb421b80a24654ae85
Author: Masaori Koshiba 
AuthorDate: Mon Aug 7 11:52:34 2023 +0900

Strictly follow Content-Length header ABNF rule (#10144)

- Replace content-length value type from const char * to std::string_view
---
 proxy/hdrs/HTTP.cc | 26 ++
 proxy/hdrs/unit_tests/test_Hdrs.cc |  5 -
 2 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/proxy/hdrs/HTTP.cc b/proxy/hdrs/HTTP.cc
index 319745420e..56a71c36f2 100644
--- a/proxy/hdrs/HTTP.cc
+++ b/proxy/hdrs/HTTP.cc
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "HTTP.h"
 #include "HdrToken.h"
 #include "tscore/Diags.h"
@@ -1261,26 +1262,27 @@ validate_hdr_content_length(HdrHeap *heap, HTTPHdrImpl 
*hh)
 // recipient MUST treat it as an unrecoverable error.  If this is a
 // request message, the server MUST respond with a 400 (Bad Request)
 // status code and then close the connection
-int content_length_len = 0;
-const char *content_length_val = 
content_length_field->value_get(_length_len);
+std::string_view value = content_length_field->value_get();
 
-// RFC 7230 section 3.3.2
+// RFC 9110 section 8.6.
 // Content-Length = 1*DIGIT
 //
+if (value.empty()) {
+  Debug("http", "Content-Length headers don't match the ABNF, returning 
parse error");
+  return PARSE_RESULT_ERROR;
+}
+
 // If the content-length value contains a non-numeric value, the header is 
invalid
-for (int i = 0; i < content_length_len; i++) {
-  if (!isdigit(content_length_val[i])) {
-Debug("http", "Content-Length value contains non-digit, returning 
parse error");
-return PARSE_RESULT_ERROR;
-  }
+if (std::find_if(value.cbegin(), value.cend(), 
[](std::string_view::value_type c) { return !std::isdigit(c); }) !=
+value.cend()) {
+  Debug("http", "Content-Length value contains non-digit, returning parse 
error");
+  return PARSE_RESULT_ERROR;
 }
 
 while (content_length_field->has_dups()) {
-  int content_length_len_2 = 0;
-  const char *content_length_val_2 = 
content_length_field->m_next_dup->value_get(_length_len_2);
+  std::string_view value_dup = 
content_length_field->m_next_dup->value_get();
 
-  if ((content_length_len != content_length_len_2) ||
-  (memcmp(content_length_val, content_length_val_2, 
content_length_len) != 0)) {
+  if ((value.length() != value_dup.length()) || value.compare(value_dup) 
!= 0) {
 // Values are different, parse error
 Debug("http", "Content-Length headers don't match, returning parse 
error");
 return PARSE_RESULT_ERROR;
diff --git a/proxy/hdrs/unit_tests/test_Hdrs.cc 
b/proxy/hdrs/unit_tests/test_Hdrs.cc
index ca79badc52..4f70c2d063 100644
--- a/proxy/hdrs/unit_tests/test_Hdrs.cc
+++ b/proxy/hdrs/unit_tests/test_Hdrs.cc
@@ -46,7 +46,7 @@ TEST_CASE("HdrTestHttpParse", "[proxy][hdrtest]")
 int expected_result;
 int expected_bytes_consumed;
   };
-  static const std::array tests = {
+  static const std::array tests = {
 {
  {"GET /index.html HTTP/1.0\r\n", PARSE_RESULT_DONE, 26},
  {"GET /index.html HTTP/1.0\r\n\r\n***BODY", PARSE_RESULT_DONE, 28},
@@ -68,6 +68,9 @@ TEST_CASE("HdrTestHttpParse", "[proxy][hdrtest]")
  {"GET /index.html HTTP/1.0\r\nUser-Agent: foobar\r\n", PARSE_RESULT_DONE, 
46},
  {"GET /index.html HTTP/1.0\r\n", PARSE_RESULT_DONE, 26},
  {"GET /index.html hTTP/1.0\r\n", PARSE_RESULT_ERROR, 26},
+ {"POST /index.html HTTP/1.0\r\nContent-Length: 0\r\n\r\n", 
PARSE_RESULT_DONE, 48},
+ {"POST /index.html HTTP/1.0\r\nContent-Length: \r\n\r\n", 
PARSE_RESULT_ERROR, 47},
+ {"POST /index.html HTTP/1.0\r\nContent-Length:\r\n\r\n", 
PARSE_RESULT_ERROR, 46},
  {"CONNECT foo.example HTTP/1.1\r\n", PARSE_RESULT_DONE, 30},
  {"GET foo.example HTTP/1.1\r\n", PARSE_RESULT_ERROR, 26},
  {"", PARSE_RESULT_ERROR, 0},



[trafficserver] branch master updated (948f80b7b -> bb0e352ed)

2023-05-11 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from 948f80b7b Fixes crashes around OCSP with FetchSM (#9672)
 add bb0e352ed Fix event queue corruption on PreWarmManager::reconfigure 
(#9692)

No new revisions were added by this update.

Summary of changes:
 proxy/http/PreWarmManager.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



[trafficserver] branch master updated (d809de58c -> 644658e09)

2023-05-15 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from d809de58c build_h3_tools.sh: Remove an unneeded dir check (#9710)
 add 644658e09 Check the calling thread of Ethread::schedule_local (#9691)

No new revisions were added by this update.

Summary of changes:
 iocore/eventsystem/P_UnixEThread.h | 4 
 1 file changed, 4 insertions(+)



[trafficserver] branch master updated (675df0eeab -> d7ac95010b)

2023-05-07 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from 675df0eeab Added Zhengxi to the asf contributors (#9685)
 add d7ac95010b Doc: Add example of --enable-lto build option with LLVM 
(#9654)

No new revisions were added by this update.

Summary of changes:
 doc/admin-guide/installation/index.en.rst | 5 +
 1 file changed, 5 insertions(+)



[trafficserver] branch master updated (79d32f7f0 -> a4ae0d16f)

2023-05-11 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from 79d32f7f0 Changes for C++20 (#9701)
 add a4ae0d16f Reload hosting.config on TASK thread (#9699)

No new revisions were added by this update.

Summary of changes:
 iocore/cache/CacheHosting.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



[trafficserver] branch master updated (e02e31a56a -> e373fcdf65)

2023-08-14 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from e02e31a56a libswoc: Update to 1.5.4 (#10155)
 add e373fcdf65 Fix conf_remap plugin build on macOS (#10177)

No new revisions were added by this update.

Summary of changes:
 mk/plugins.mk | 1 +
 1 file changed, 1 insertion(+)



(trafficserver) branch master updated: Cleanup: CacheProcessor::start_internal (#10998)

2024-01-22 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 ab9350b508 Cleanup: CacheProcessor::start_internal (#10998)
ab9350b508 is described below

commit ab9350b5086dd79c0b0d246a5ea2a3a56380e465
Author: Masaori Koshiba 
AuthorDate: Tue Jan 23 08:54:51 2024 +0900

Cleanup: CacheProcessor::start_internal (#10998)
---
 src/iocore/cache/Cache.cc | 38 --
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/src/iocore/cache/Cache.cc b/src/iocore/cache/Cache.cc
index e82a1b45df..225b1e6237 100644
--- a/src/iocore/cache/Cache.cc
+++ b/src/iocore/cache/Cache.cc
@@ -320,8 +320,8 @@ CacheProcessor::start_internal(int flags)
   memset(fds, 0, sizeof(int) * gndisks);
   int *sector_sizes = static_cast(alloca(sizeof(int) * gndisks));
   memset(sector_sizes, 0, sizeof(int) * gndisks);
-  Span **sds = static_cast(alloca(sizeof(Span *) * gndisks));
-  memset(sds, 0, sizeof(Span *) * gndisks);
+  Span **spans = static_cast(alloca(sizeof(Span *) * gndisks));
+  memset(spans, 0, sizeof(Span *) * gndisks);
 
   gndisks = 0;
   ink_aio_set_err_callback(new AIO_failure_handler());
@@ -332,14 +332,14 @@ CacheProcessor::start_internal(int flags)
create CacheDisk objects for each span in the configuration file and store 
in gdisks
*/
   for (unsigned i = 0; i < theCacheStore.n_spans; i++) {
-Span *sd = theCacheStore.spans[i];
-int opts = DEFAULT_CACHE_OPTIONS;
+Span *span = theCacheStore.spans[i];
+int opts   = DEFAULT_CACHE_OPTIONS;
 
 if (!paths[gndisks]) {
   paths[gndisks] = static_cast(alloca(PATH_NAME_MAX));
 }
-ink_strlcpy(paths[gndisks], sd->pathname, PATH_NAME_MAX);
-if (!sd->file_pathname) {
+ink_strlcpy(paths[gndisks], span->pathname, PATH_NAME_MAX);
+if (!span->file_pathname) {
   ink_strlcat(paths[gndisks], "/cache.db", PATH_NAME_MAX);
   opts |= O_CREAT;
 }
@@ -369,7 +369,7 @@ CacheProcessor::start_internal(int flags)
 #else
 int fd = open(paths[gndisks], opts, 0644);
 #endif
-int64_t blocks = sd->blocks;
+int64_t blocks = span->blocks;
 
 if (fd < 0 && (opts & O_CREAT)) { // Try without O_DIRECT if this is a 
file on filesystem, e.g. tmpfs.
 #ifdef AIO_FAULT_INJECTION
@@ -381,7 +381,7 @@ CacheProcessor::start_internal(int flags)
 
 if (fd >= 0) {
   bool diskok = true;
-  if (!sd->file_pathname) {
+  if (!span->file_pathname) {
 if (!check) {
   if (ftruncate(fd, blocks * STORE_BLOCK_SIZE) < 0) {
 Warning("unable to truncate cache file '%s' to %" PRId64 " 
blocks", paths[gndisks], blocks);
@@ -400,15 +400,15 @@ CacheProcessor::start_internal(int flags)
 }
   }
   if (diskok) {
-int sector_size = sd->hw_sector_size;
+int sector_size = span->hw_sector_size;
 
-gdisks[gndisks] = new CacheDisk();
+CacheDisk *cache_disk = new CacheDisk();
 if (check) {
-  gdisks[gndisks]->read_only_p = true;
+  cache_disk->read_only_p = true;
 }
-gdisks[gndisks]->forced_volume_num = sd->forced_volume_num;
-if (sd->hash_base_string) {
-  gdisks[gndisks]->hash_base_string = ats_strdup(sd->hash_base_string);
+cache_disk->forced_volume_num = span->forced_volume_num;
+if (span->hash_base_string) {
+  cache_disk->hash_base_string = ats_strdup(span->hash_base_string);
 }
 
 if (sector_size < cache_config_force_sector_size) {
@@ -418,13 +418,15 @@ CacheProcessor::start_internal(int flags)
 // It's actually common that the hardware I/O size is larger than the 
store block size as
 // storage systems increasingly want larger I/Os. For example, on 
macOS, the filesystem
 // block size is always reported as 1MB.
-if (sd->hw_sector_size <= 0 || sector_size > STORE_BLOCK_SIZE) {
+if (span->hw_sector_size <= 0 || sector_size > STORE_BLOCK_SIZE) {
   Note("resetting hardware sector size from %d to %d", sector_size, 
STORE_BLOCK_SIZE);
   sector_size = STORE_BLOCK_SIZE;
 }
+
+gdisks[gndisks]   = cache_disk;
 sector_sizes[gndisks] = sector_size;
 fds[gndisks]  = fd;
-sds[gndisks]  = sd;
+spans[gndisks]= span;
 fd= -1;
 gndisks++;
   }
@@ -470,8 +472,8 @@ CacheProcessor::start_internal(int flags)
 
   // If we got here, we have enough disks to proceed
   for (int j = 0; j < gndisks; j++) {
-Span *sd = sds[j];
-ink_release_assert(sds[j] != nullptr); // Defeat clang-analyzer
+Span *sd = spans[j];
+ink_release_

(trafficserver) branch master updated (f007799886 -> cfc13f6b5e)

2023-12-17 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from f007799886 Update cmake for cleaner install with static vs shared 
(#10938)
 add cfc13f6b5e cmake: Add tsutil/Assert.h to public headers (#10935)

No new revisions were added by this update.

Summary of changes:
 src/tsutil/CMakeLists.txt | 1 +
 1 file changed, 1 insertion(+)



(trafficserver) branch master updated: Cleanup: Rename gvol to gstripes (#10953)

2023-12-21 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 cc34a3ba59 Cleanup: Rename gvol to gstripes (#10953)
cc34a3ba59 is described below

commit cc34a3ba599b0275b7af191232d46a59ca99caea
Author: Masaori Koshiba 
AuthorDate: Fri Dec 22 08:34:48 2023 +0900

Cleanup: Rename gvol to gstripes (#10953)
---
 src/iocore/cache/Cache.cc| 116 +--
 src/iocore/cache/CacheDir.cc |  18 ++---
 src/iocore/cache/P_CacheDir.h|  10 +--
 src/iocore/cache/P_CacheVol.h|   4 +-
 src/iocore/cache/Stripe.cc   |   6 +-
 src/iocore/cache/unit_tests/test_CacheDir.cc |   4 +-
 src/iocore/cache/unit_tests/test_CacheVol.cc |   8 +-
 7 files changed, 83 insertions(+), 83 deletions(-)

diff --git a/src/iocore/cache/Cache.cc b/src/iocore/cache/Cache.cc
index d61ecec748..7d14385e3d 100644
--- a/src/iocore/cache/Cache.cc
+++ b/src/iocore/cache/Cache.cc
@@ -87,8 +87,8 @@ bool CacheProcessor::check   = false;
 int CacheProcessor::start_internal_flags = 0;
 int CacheProcessor::auto_clear_flag  = 0;
 CacheProcessor cacheProcessor;
-Stripe **gvol  = nullptr;
-std::atomic gnvol = 0;
+Stripe **gstripes  = nullptr;
+std::atomic gnstripes = 0;
 ClassAllocator cacheVConnectionAllocator("cacheVConnection");
 ClassAllocator 
cacheEvacuateDocVConnectionAllocator("cacheEvacuateDocVC");
 ClassAllocator evacuationBlockAllocator("evacuationBlock");
@@ -193,13 +193,13 @@ register_cache_stats(CacheStatsBlock *rsb, const 
std::string prefix)
 
 // ToDo: This gets called as part of librecords collection continuation, 
probably change this later.
 inline int64_t
-cache_bytes_used(int vol_ix)
+cache_bytes_used(int index)
 {
-  if (!DISK_BAD(gvol[vol_ix]->disk)) {
-if (!gvol[vol_ix]->header->cycle) {
-  return gvol[vol_ix]->header->write_pos - gvol[vol_ix]->start;
+  if (!DISK_BAD(gstripes[index]->disk)) {
+if (!gstripes[index]->header->cycle) {
+  return gstripes[index]->header->write_pos - gstripes[index]->start;
 } else {
-  return gvol[vol_ix]->len - gvol[vol_ix]->dirlen() - EVACUATION_SIZE;
+  return gstripes[index]->len - gstripes[index]->dirlen() - 
EVACUATION_SIZE;
 }
   }
 
@@ -214,14 +214,14 @@ CachePeriodicMetricsUpdate()
   // Make sure the bytes_used per volume is always reset to zero, this can 
update the
   // volume metric more than once (once per disk). This happens once every sync
   // period (5s), and nothing else modifies these metrics.
-  for (int vol_ix = 0; vol_ix < gnvol; ++vol_ix) {
-Metrics::Gauge::store(gvol[vol_ix]->cache_vol->vol_rsb.bytes_used, 0);
+  for (int i = 0; i < gnstripes; ++i) {
+Metrics::Gauge::store(gstripes[i]->cache_vol->vol_rsb.bytes_used, 0);
   }
 
   if (cacheProcessor.initialized == CACHE_INITIALIZED) {
-for (int vol_ix = 0; vol_ix < gnvol; ++vol_ix) {
-  Stripe *v= gvol[vol_ix];
-  int64_t used = cache_bytes_used(vol_ix);
+for (int i = 0; i < gnstripes; ++i) {
+  Stripe *v= gstripes[i];
+  int64_t used = cache_bytes_used(i);
 
   Metrics::Gauge::increment(v->cache_vol->vol_rsb.bytes_used, used); // 
This assumes they start at zero
   total_sum += used;
@@ -526,7 +526,7 @@ CacheProcessor::diskInitialized()
 
   if (res == -1) {
 /* problems initializing the volume.config. Punt */
-gnvol = 0;
+gnstripes = 0;
 cacheInitialized();
 return;
   } else {
@@ -539,9 +539,9 @@ CacheProcessor::diskInitialized()
 }
   }
 
-  gvol = static_cast(ats_malloc(gnvol * sizeof(Stripe *)));
-  memset(gvol, 0, gnvol * sizeof(Stripe *));
-  gnvol = 0;
+  gstripes = static_cast(ats_malloc(gnstripes * sizeof(Stripe *)));
+  memset(gstripes, 0, gnstripes * sizeof(Stripe *));
+  gnstripes = 0;
   for (i = 0; i < gndisks; i++) {
 CacheDisk *d = gdisks[i];
 if (dbg_ctl_cache_hosting.on()) {
@@ -612,12 +612,12 @@ CacheProcessor::cacheInitialized()
   }
 
   // Update stripe version data.
-  if (gnvol) { // start with whatever the first stripe is.
-cacheProcessor.min_stripe_version = cacheProcessor.max_stripe_version = 
gvol[0]->header->version;
+  if (gnstripes) { // start with whatever the first stripe is.
+cacheProcessor.min_stripe_version = cacheProcessor.max_stripe_version = 
gstripes[0]->header->version;
   }
   // scan the rest of the stripes.
-  for (i = 1; i < gnvol; i++) {
-Stripe *v = gvol[i];
+  for (i = 1; i < gnstripes; i++) {
+Stripe *v = gstripes[i];
 if (v->header->version < cacheProcessor.min_stripe_version) {
   cacheProcessor.min_stripe_version = v->header->version;
 }
@@ -628,48 +628,48 @@ CacheProce

(trafficserver) branch master updated: Cleanup: Span and Store (#10952)

2024-01-09 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 6979e4c9f6 Cleanup: Span and Store (#10952)
6979e4c9f6 is described below

commit 6979e4c9f6cc1d417798ce90e24bbd9d67e1525c
Author: Masaori Koshiba 
AuthorDate: Tue Jan 9 17:01:05 2024 +0900

Cleanup: Span and Store (#10952)
---
 include/iocore/cache/Store.h | 74 +++-
 src/iocore/cache/Cache.cc| 18 +--
 src/iocore/cache/Store.cc| 72 ++
 3 files changed, 51 insertions(+), 113 deletions(-)

diff --git a/include/iocore/cache/Store.h b/include/iocore/cache/Store.h
index 15bc3ba302..0b0a762ca8 100644
--- a/include/iocore/cache/Store.h
+++ b/include/iocore/cache/Store.h
@@ -79,29 +79,14 @@ struct Span {
   unsigned hw_sector_size = DEFAULT_HW_SECTOR_SIZE;
   unsigned alignment  = 0;
   span_diskid_t disk_id;
-  int forced_volume_num = -1; ///< Force span in to specific volume.
-private:
-  bool is_mmapable_internal = false;
-
-public:
-  bool file_pathname = false; // the pathname is a file
+  int forced_volume_num = -1;///< Force span in to specific volume.
+  bool file_pathname= false; // the pathname is a file
   // v- used as a magic location for copy constructor.
   // we memcpy everything before this member and do explicit assignment for 
the rest.
   ats_scoped_str pathname;
   ats_scoped_str hash_base_string; ///< Used to seed the stripe assignment 
hash.
-  SLINK(Span, link);
-
-  bool
-  is_mmapable() const
-  {
-return is_mmapable_internal;
-  }
 
-  void
-  set_mmapable(bool s)
-  {
-is_mmapable_internal = s;
-  }
+  SLINK(Span, link);
 
   int64_t
   size() const
@@ -109,39 +94,6 @@ public:
 return blocks * STORE_BLOCK_SIZE;
   }
 
-  int64_t
-  total_blocks() const
-  {
-if (link.next) {
-  return blocks + link.next->total_blocks();
-} else {
-  return blocks;
-}
-  }
-
-  Span *
-  nth(unsigned i)
-  {
-Span *x = this;
-while (x && i--) {
-  x = x->link.next;
-}
-return x;
-  }
-
-  unsigned
-  paths() const
-  {
-int i = 0;
-for (const Span *x = this; x; i++, x = x->link.next) {
-  ;
-}
-
-return i;
-  }
-
-  /// Duplicate this span and all chained spans.
-  Span *dup();
   int64_t
   end() const
   {
@@ -189,25 +141,23 @@ struct Store {
   void
   extend(unsigned i)
   {
-if (i > n_disks) {
-  disk = (Span **)ats_realloc(disk, i * sizeof(Span *));
-  for (unsigned j = n_disks; j < i; j++) {
-disk[j] = nullptr;
+if (i > n_spans) {
+  spans = static_cast(ats_realloc(spans, i * sizeof(Span *)));
+  for (unsigned j = n_spans; j < i; j++) {
+spans[j] = nullptr;
   }
-  n_disks = i;
+  n_spans = i;
 }
   }
 
   void delete_all();
 
-  Store();
+  Store(){};
   ~Store();
 
-  // The number of disks/paths defined in storage.config
-  unsigned n_disks_in_config = 0;
-  // The number of disks/paths we could actually read and parse.
-  unsigned n_disks = 0;
-  Span **disk  = nullptr;
+  unsigned n_spans_in_config = 0; ///< The number of disks/paths defined in 
storage.config
+  unsigned n_spans   = 0; ///< The number of disks/paths we could 
actually read and parse
+  Span **spans   = nullptr;
 
   Result read_config();
 
diff --git a/src/iocore/cache/Cache.cc b/src/iocore/cache/Cache.cc
index 7d14385e3d..622cb42a03 100644
--- a/src/iocore/cache/Cache.cc
+++ b/src/iocore/cache/Cache.cc
@@ -302,7 +302,7 @@ CacheProcessor::start_internal(int flags)
   start_done   = 0;
 
   /* Read the config file and create the data structures corresponding to the 
file. */
-  gndisks = theCacheStore.n_disks;
+  gndisks = theCacheStore.n_spans;
   gdisks  = static_cast(ats_malloc(gndisks * sizeof(CacheDisk 
*)));
 
   // Temporaries to carry values between loops
@@ -323,8 +323,8 @@ CacheProcessor::start_internal(int flags)
   /*
create CacheDisk objects for each span in the configuration file and store 
in gdisks
*/
-  for (unsigned i = 0; i < theCacheStore.n_disks; i++) {
-Span *sd = theCacheStore.disk[i];
+  for (unsigned i = 0; i < theCacheStore.n_spans; i++) {
+Span *sd = theCacheStore.spans[i];
 int opts = DEFAULT_CACHE_OPTIONS;
 
 if (!paths[gndisks]) {
@@ -440,15 +440,15 @@ CacheProcessor::start_internal(int flags)
   Warning("unable to open cache disk(s): Cache Disabled\n");
   return -1; // pointless, AFAICT this is ignored.
 }
-  } else if (this->waitForCache() == 3 && static_cast(gndisks) < 
theCacheStore.n_disks_in_config) {
+  } else if (this->waitForCache() == 3 && static_cast(gndisks) < 
theCacheStore.n_spans_in_config) {
 CacheProcessor::initialized = CACHE_INI

(trafficserver) branch master updated: Fix cache.volume_N.stripes metric issue by cleaning up CacheProcessor::cacheInitialized (#10923)

2024-01-18 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 ebe9978bdb Fix cache.volume_N.stripes metric issue by cleaning up 
CacheProcessor::cacheInitialized (#10923)
ebe9978bdb is described below

commit ebe9978bdb8febbbf4b38bc425d12098aa5c0a87
Author: Masaori Koshiba 
AuthorDate: Fri Jan 19 09:08:39 2024 +0900

Fix cache.volume_N.stripes metric issue by cleaning up 
CacheProcessor::cacheInitialized (#10923)

* Fix cache.volume_N.stripes metric issue by cleaning up 
CacheProcessor::cacheInitialized

* Add AuTest
---
 src/iocore/cache/Cache.cc  | 173 ++---
 .../cache/gold/storage_metrics_0_stdout.gold   |   7 +
 .../cache/gold/storage_metrics_1_stdout.gold   |  13 ++
 tests/gold_tests/cache/storage-metrics.test.py |  83 ++
 4 files changed, 181 insertions(+), 95 deletions(-)

diff --git a/src/iocore/cache/Cache.cc b/src/iocore/cache/Cache.cc
index d05f76f5a5..e82a1b45df 100644
--- a/src/iocore/cache/Cache.cc
+++ b/src/iocore/cache/Cache.cc
@@ -593,9 +593,13 @@ CacheProcessor::diskInitialized()
 void
 CacheProcessor::cacheInitialized()
 {
-  int i;
+  if (theCache == nullptr) {
+Dbg(dbg_ctl_cache_init, "theCache is nullptr");
+return;
+  }
 
-  if (theCache && (theCache->ready == CACHE_INITIALIZING)) {
+  if (theCache->ready == CACHE_INITIALIZING) {
+Dbg(dbg_ctl_cache_init, "theCache is initializing");
 return;
   }
 
@@ -603,29 +607,19 @@ CacheProcessor::cacheInitialized()
   int cache_init_ok = 0;
   /* allocate ram size in proportion to the disk space the
  volume occupies */
-  int64_t total_size = 0; // count in HTTP & MIXT
-  uint64_t total_cache_bytes = 0; // bytes that can used in total_size
-  uint64_t total_direntries  = 0; // all the direntries in the cache
-  uint64_t used_direntries   = 0; //   and used
-  uint64_t vol_total_cache_bytes = 0;
-  uint64_t vol_total_direntries  = 0;
-  uint64_t vol_used_direntries   = 0;
-  Stripe *stripe;
-
-  if (theCache) {
-total_size += theCache->cache_size;
-Dbg(dbg_ctl_cache_init, "CacheProcessor::cacheInitialized - theCache, 
total_size = %" PRId64 " = %" PRId64 " MB", total_size,
-total_size / ((1024 * 1024) / STORE_BLOCK_SIZE));
-if (theCache->ready == CACHE_INIT_FAILED) {
-  Dbg(dbg_ctl_cache_init, "CacheProcessor::cacheInitialized - failed to 
initialize the cache "
-  "for http: cache disabled");
-  Warning("failed to initialize the cache for http: cache disabled\n");
-} else {
-  caches_ready = caches_ready | (1 << 
CACHE_FRAG_TYPE_HTTP);
-  caches_ready = caches_ready | (1 << 
CACHE_FRAG_TYPE_NONE);
-  caches[CACHE_FRAG_TYPE_HTTP] = theCache;
-  caches[CACHE_FRAG_TYPE_NONE] = theCache;
-}
+  int64_t total_size = 0; // count in HTTP & MIXT
+
+  total_size += theCache->cache_size;
+  Dbg(dbg_ctl_cache_init, "theCache, total_size = %" PRId64 " = %" PRId64 " 
MB", total_size,
+  total_size / ((1024 * 1024) / STORE_BLOCK_SIZE));
+  if (theCache->ready == CACHE_INIT_FAILED) {
+Dbg(dbg_ctl_cache_init, "failed to initialize the cache for http: cache 
disabled");
+Warning("failed to initialize the cache for http: cache disabled\n");
+  } else {
+caches_ready = caches_ready | (1 << CACHE_FRAG_TYPE_HTTP);
+caches_ready = caches_ready | (1 << CACHE_FRAG_TYPE_NONE);
+caches[CACHE_FRAG_TYPE_HTTP] = theCache;
+caches[CACHE_FRAG_TYPE_NONE] = theCache;
   }
 
   // Update stripe version data.
@@ -633,7 +627,7 @@ CacheProcessor::cacheInitialized()
 cacheProcessor.min_stripe_version = cacheProcessor.max_stripe_version = 
gstripes[0]->header->version;
   }
   // scan the rest of the stripes.
-  for (i = 1; i < gnstripes; i++) {
+  for (int i = 1; i < gnstripes; i++) {
 Stripe *v = gstripes[i];
 if (v->header->version < cacheProcessor.min_stripe_version) {
   cacheProcessor.min_stripe_version = v->header->version;
@@ -647,11 +641,9 @@ CacheProcessor::cacheInitialized()
 Dbg(dbg_ctl_cache_init, "CacheProcessor::cacheInitialized - 
caches_ready=0x%0X, gnvol=%d", (unsigned int)caches_ready,
 gnstripes.load());
 
-int64_t ram_cache_bytes = 0;
-
 if (gnstripes) {
   // new ram_caches, with algorithm from the config
-  for (i = 0; i < gnstripes; i++) {
+  for (int i = 0; i < gnstripes; i++) {
 switch (cache_config_ram_cache_algorithm) {
 default:
 case RAM_CACHE_ALGORITHM_CLF

(trafficserver) branch master updated (5387ef7bab -> 127071ed39)

2023-11-29 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from 5387ef7bab ja3_fingerprint: autest and README update. (#10871)
 add 127071ed39 Rename CacheVC::vol to stripe (#10737)

No new revisions were added by this update.

Summary of changes:
 include/iocore/cache/CacheVC.h |  14 +--
 src/iocore/cache/Cache.cc  |   4 +-
 src/iocore/cache/CacheDir.cc   |   8 +-
 src/iocore/cache/CacheEvacuateDocVC.cc |  30 ++---
 src/iocore/cache/CacheRead.cc  | 134 ++--
 src/iocore/cache/CacheVC.cc| 136 ++---
 src/iocore/cache/CacheVol.cc   |   4 +-
 src/iocore/cache/CacheWrite.cc | 104 
 src/iocore/cache/P_CacheInternal.h |  12 +-
 .../unit_tests/test_Alternate_L_to_S_remove_L.cc   |   6 +-
 .../unit_tests/test_Alternate_L_to_S_remove_S.cc   |   6 +-
 .../unit_tests/test_Alternate_S_to_L_remove_L.cc   |   6 +-
 .../unit_tests/test_Alternate_S_to_L_remove_S.cc   |   6 +-
 13 files changed, 235 insertions(+), 235 deletions(-)



(trafficserver) branch master updated (1997db31ba -> 551aa61bda)

2023-11-27 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from 1997db31ba update _read_vio.cont/_write_vio.cont when application is 
changed to QPACK (#10851)
 add 551aa61bda Rename vol to stripe (local vars & args) (#10847)

No new revisions were added by this update.

Summary of changes:
 src/iocore/cache/Cache.cc| 187 ++---
 src/iocore/cache/CacheDir.cc | 397 ++-
 src/iocore/cache/CacheDisk.cc|  64 ++---
 src/iocore/cache/CacheHosting.cc |   8 +-
 src/iocore/cache/CacheRead.cc|  24 +-
 src/iocore/cache/CacheTest.cc|  28 +-
 src/iocore/cache/CacheVC.cc  |  32 +--
 src/iocore/cache/CacheWrite.cc   |  62 ++---
 src/iocore/cache/P_CacheDir.h|  36 +--
 src/iocore/cache/P_CacheDisk.h   |  28 +-
 src/iocore/cache/P_CacheHosting.h|   4 +-
 src/iocore/cache/P_CacheInternal.h   |  32 +--
 src/iocore/cache/P_CacheVol.h|  26 +-
 src/iocore/cache/P_RamCache.h|   2 +-
 src/iocore/cache/RamCacheCLFUS.cc|  44 +--
 src/iocore/cache/RamCacheLRU.cc  |  16 +-
 src/iocore/cache/unit_tests/test_CacheDir.cc |  58 ++--
 src/iocore/cache/unit_tests/test_CacheVol.cc |  10 +-
 src/traffic_cache_tool/CacheDefs.cc  |   8 +-
 19 files changed, 535 insertions(+), 531 deletions(-)



(trafficserver) branch master updated: Fix stripe metrics in the exclusive span case (#11023)

2024-01-31 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 597e2e87ce Fix stripe metrics in the exclusive span case (#11023)
597e2e87ce is described below

commit 597e2e87ce256231e633619b82bae104ddfdd6c4
Author: Masaori Koshiba 
AuthorDate: Thu Feb 1 09:07:06 2024 +0900

Fix stripe metrics in the exclusive span case (#11023)
---
 src/iocore/cache/Cache.cc |  5 +
 .../cache/gold/storage_metrics_2_stdout.gold  |  7 +++
 tests/gold_tests/cache/storage-metrics.test.py| 19 ---
 3 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/src/iocore/cache/Cache.cc b/src/iocore/cache/Cache.cc
index 5811a0577f..3e0beecbde 100644
--- a/src/iocore/cache/Cache.cc
+++ b/src/iocore/cache/Cache.cc
@@ -1492,7 +1492,6 @@ cplist_reconfigure()
   int volume_number;
   off_t size_in_blocks;
   ConfigVol *config_vol;
-  int assignedVol = 0; // Number of assigned volumes
 
   gnstripes = 0;
   if (config_volumes.num_volumes == 0) {
@@ -1550,8 +1549,6 @@ cplist_reconfigure()
   // in such a way forced volumes will not impact volume percentage 
calculations.
   if (-1 == gdisks[i]->forced_volume_num) {
 tot_space_in_blks += (gdisks[i]->num_usable_blocks / blocks_per_vol) * 
blocks_per_vol;
-  } else {
-++assignedVol;
   }
 }
 
@@ -1721,7 +1718,7 @@ cplist_reconfigure()
 }
   }
 
-  Metrics::Gauge::store(cache_rsb.stripes, gnstripes + assignedVol);
+  Metrics::Gauge::store(cache_rsb.stripes, gnstripes);
 
   return 0;
 }
diff --git a/tests/gold_tests/cache/gold/storage_metrics_2_stdout.gold 
b/tests/gold_tests/cache/gold/storage_metrics_2_stdout.gold
new file mode 100644
index 00..2d018dada8
--- /dev/null
+++ b/tests/gold_tests/cache/gold/storage_metrics_2_stdout.gold
@@ -0,0 +1,7 @@
+``
+proxy.process.cache.stripes 1
+``
+proxy.process.cache.span.online 1
+``
+proxy.process.cache.volume_1.stripes 1
+``
diff --git a/tests/gold_tests/cache/storage-metrics.test.py 
b/tests/gold_tests/cache/storage-metrics.test.py
index 87c5451d35..27a293f379 100644
--- a/tests/gold_tests/cache/storage-metrics.test.py
+++ b/tests/gold_tests/cache/storage-metrics.test.py
@@ -32,8 +32,7 @@ storage 256M
 "volume": '''
 # empty
 '''
-},
-{
+}, {
 "case": 1,
 "description": "four equally devided volumes",
 "storage": '''
@@ -46,7 +45,19 @@ volume=2 scheme=http size=25%
 volume=3 scheme=http size=25%
 volume=4 scheme=http size=25%
 '''
-},
+}, {
+"case": 2,
+"description": "exclusive span",
+"storage": '''
+storage 256M volume=1
+''',
+"volume": '''
+volume=1 scheme=http size=262144
+''',
+"hosting": '''
+hostname=* volume=1
+'''
+}
 ]
 
 
@@ -65,6 +76,8 @@ class StorageMetricsTest:
 ts = Test.MakeATSProcess(f"ts_{i}")
 ts.Disk.storage_config.AddLine(config["storage"])
 ts.Disk.volume_config.AddLine(config["volume"])
+if "hosting" in config:
+ts.Disk.hosting_config.AddLine(config["hosting"])
 ts.Disk.records_config.update({
 'proxy.config.diags.debug.enabled': 1,
 'proxy.config.diags.debug.tags': 'cache',



(trafficserver) branch master updated: CMake: use --git-common-dir to find the git dir (#11015)

2024-01-29 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 f180ea2b6f CMake: use --git-common-dir to find the git dir (#11015)
f180ea2b6f is described below

commit f180ea2b6f25f6922c881b60d70cef68db1acac5
Author: Masaori Koshiba 
AuthorDate: Tue Jan 30 10:01:34 2024 +0900

CMake: use --git-common-dir to find the git dir (#11015)
---
 CMakeLists.txt| 4 +++-
 tools/autopep8.sh | 6 --
 tools/clang-format.sh | 7 +--
 tools/cmake-format.sh | 6 --
 tools/yapf.sh | 6 --
 5 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a790c65377..3049bbada3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -649,11 +649,13 @@ if(ENABLE_BENCHMARKS)
   add_subdirectory(tools/benchmark)
 endif()
 
+set(GIT_COMMON_DIR git rev-parse --git-common-dir)
+
 add_custom_target(
   clang-format-install
   COMMAND ${CMAKE_SOURCE_DIR}/tools/clang-format.sh --install
   WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
-  BYPRODUCTS ${CMAKE_SOURCE_DIR}/.git/fmt/.clang-format-installed
+  BYPRODUCTS ${GIT_COMMON_DIR}/fmt/.clang-format-installed
   COMMENT "Installing clang-format"
   VERBATIM
 )
diff --git a/tools/autopep8.sh b/tools/autopep8.sh
index 46ad7879a1..614ec93718 100755
--- a/tools/autopep8.sh
+++ b/tools/autopep8.sh
@@ -39,7 +39,8 @@ function main() {
 pip install -q virtualenv
   fi
 
-  AUTOPEP8_VENV=${AUTOPEP8_VENV:-$(cd $(dirname $0) && git rev-parse 
--show-toplevel)/.git/fmt/autopep8_${AUTOPEP8_VERSION}_venv}
+  GIT_COMMON_DIR=$(cd $(dirname $0) && git rev-parse --path-format=absolute 
--git-common-dir)
+  
AUTOPEP8_VENV=${AUTOPEP8_VENV:-${GIT_COMMON_DIR}/fmt/autopep8_${AUTOPEP8_VERSION}_venv}
   if [ ! -e ${AUTOPEP8_VENV} ]
   then
 virtualenv ${AUTOPEP8_VENV}
@@ -101,5 +102,6 @@ function main() {
 if [[ "$(basename -- "$0")" == 'autopep8.sh' ]]; then
   main "$@"
 else
-  AUTOPEP8_VENV=${AUTOPEP8_VENV:-$(git rev-parse 
--show-toplevel)/.git/fmt/autopep8_${AUTOPEP8_VERSION}_venv}
+  GIT_COMMON_DIR=$(git rev-parse --path-format=absolute --git-common-dir)
+  
AUTOPEP8_VENV=${AUTOPEP8_VENV:-${GIT_COMMON_DIR}/fmt/autopep8_${AUTOPEP8_VERSION}_venv}
 fi
diff --git a/tools/clang-format.sh b/tools/clang-format.sh
index 86bb698af4..866c1fde46 100755
--- a/tools/clang-format.sh
+++ b/tools/clang-format.sh
@@ -23,7 +23,9 @@ PKGDATE="20230928"
 
 function main() {
   set -e # exit on error
-  ROOT=${ROOT:-$(cd $(dirname $0) && git rev-parse 
--show-toplevel)/.git/fmt/${PKGDATE}}
+
+  GIT_COMMON_DIR=$(cd $(dirname $0) && git rev-parse --path-format=absolute 
--git-common-dir)
+  ROOT=${ROOT:-${GIT_COMMON_DIR}/fmt/${PKGDATE}}
   # The presence of this file indicates clang-format was successfully 
installed.
   INSTALLED_SENTINEL=${ROOT}/.clang-format-installed
 
@@ -117,5 +119,6 @@ EOF
 if [[ "$(basename -- "$0")" == 'clang-format.sh' ]]; then
   main "$@"
 else
-  ROOT=${ROOT:-$(git rev-parse --show-toplevel)/.git/fmt/${PKGDATE}}
+  GIT_COMMON_DIR=$(git rev-parse --path-format=absolute --git-common-dir)
+  ROOT=${ROOT:-${GIT_COMMON_DIR}/fmt/${PKGDATE}}
 fi
diff --git a/tools/cmake-format.sh b/tools/cmake-format.sh
index c662d9aa4d..2b8ee00ba4 100755
--- a/tools/cmake-format.sh
+++ b/tools/cmake-format.sh
@@ -33,7 +33,8 @@ function main() {
 pip install -q virtualenv
   fi
 
-  CMAKE_FORMAT_VENV=${CMAKE_FORMAT_VENV:-$(cd $(dirname $0) && git rev-parse 
--show-toplevel)/.git/fmt/cmake_format_${CMAKE_FORMAT_VERSION}_venv}
+  GIT_COMMON_DIR=$(cd $(dirname $0) && git rev-parse --path-format=absolute 
--git-common-dir)
+  
CMAKE_FORMAT_VENV=${CMAKE_FORMAT_VENV:-${GIT_COMMON_DIR}/fmt/cmake_format_${CMAKE_FORMAT_VERSION}_venv}
   if [ ! -e ${CMAKE_FORMAT_VENV} ]
   then
 virtualenv ${CMAKE_FORMAT_VENV}
@@ -85,5 +86,6 @@ function main() {
 if [[ "$(basename -- "$0")" == 'cmake-format.sh' ]]; then
   main "$@"
 else
-  CMAKE_FORMAT_VENV=${CMAKE_FORMAT_VENV:-$(git rev-parse 
--show-toplevel)/.git/fmt/cmake_format_${CMAKE_FORMAT_VERSION}_venv}
+  GIT_COMMON_DIR=$(git rev-parse --path-format=absolute --git-common-dir)
+  
CMAKE_FORMAT_VENV=${CMAKE_FORMAT_VENV:-${GIT_COMMON_DIR}/fmt/cmake_format_${CMAKE_FORMAT_VERSION}_venv}
 fi
diff --git a/tools/yapf.sh b/tools/yapf.sh
index 7a429eba4a..2a163c3fc8 100755
--- a/tools/yapf.sh
+++ b/tools/yapf.sh
@@ -47,7 +47,8 @@ _END_
   fi
 
   REPO_ROOT=$(cd $(dirname $0) && git rev-parse --show-toplevel)
-  YAPF_VENV=${YAPF_VENV:-${REPO_ROOT}/.git/fmt/yapf_${YAPF_VERSION}_venv}
+  GIT_COMMON_DIR=$(cd $(dirname $0) && git rev-parse --path-format=absolute 
--git-common-dir)
+  YAPF_VENV=${YAPF_VENV:-${GIT_COMMON_DIR}/fmt/yapf_${YAPF_VERSION}_ven

(trafficserver) branch master updated: Cleanup: Rename key_to_vol (#11018)

2024-01-30 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 9d93106ef9 Cleanup: Rename key_to_vol (#11018)
9d93106ef9 is described below

commit 9d93106ef93371284fa13772c7dd37cbf1c8fd7a
Author: Masaori Koshiba 
AuthorDate: Tue Jan 30 22:08:10 2024 +0900

Cleanup: Rename key_to_vol (#11018)
---
 doc/developer-guide/cache-architecture/architecture.en.rst| 2 +-
 .../cache-architecture/cache-initialization.en.rst| 2 +-
 doc/developer-guide/cache-architecture/data-structures.en.rst | 2 +-
 src/iocore/cache/Cache.cc | 8 
 src/iocore/cache/CacheRead.cc | 4 ++--
 src/iocore/cache/CacheTest.cc | 2 +-
 src/iocore/cache/CacheWrite.cc| 4 ++--
 src/iocore/cache/P_CacheInternal.h| 2 +-
 8 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/doc/developer-guide/cache-architecture/architecture.en.rst 
b/doc/developer-guide/cache-architecture/architecture.en.rst
index 476ff58341..67d0b7c85d 100644
--- a/doc/developer-guide/cache-architecture/architecture.en.rst
+++ b/doc/developer-guide/cache-architecture/architecture.en.rst
@@ -779,7 +779,7 @@ The basic steps to a cache lookup are:
 #. The cache stripe is determined (based on the cache key).
 
The :term:`cache key` is used as a hash key in to an array of 
:cpp:class:`Stripe` instances by
-   :func:`Cache::key_to_vol`. The construction and arrangement of this array 
is the essence of how
+   :func:`Cache::key_to_stripe`. The construction and arrangement of this 
array is the essence of how
volumes are assigned.
 
 #. The cache stripe directory :ref:`is probed ` using 
the
diff --git a/doc/developer-guide/cache-architecture/cache-initialization.en.rst 
b/doc/developer-guide/cache-architecture/cache-initialization.en.rst
index ea26ed47d4..f475853c0e 100644
--- a/doc/developer-guide/cache-architecture/cache-initialization.en.rst
+++ b/doc/developer-guide/cache-architecture/cache-initialization.en.rst
@@ -146,7 +146,7 @@ changed to purple and green respectively. If the blue 
stripe were added back tho
 only those would revert to blue. This is because for each stripe the node 
sequence as generated by
 the pseudo random number generator depends only the properties of the stripes.
 
-At runtime stripe selection is done by :func:`Cache::key_to_vol` which selects 
the
+At runtime stripe selection is done by :func:`Cache::key_to_stripe` which 
selects the
 :class:`CacheHostRecord` instance then picks the stripe assignment slot in the 
array which
 determines the stripe for the object.
 
diff --git a/doc/developer-guide/cache-architecture/data-structures.en.rst 
b/doc/developer-guide/cache-architecture/data-structures.en.rst
index e3c3fc00fa..c52f64296c 100644
--- a/doc/developer-guide/cache-architecture/data-structures.en.rst
+++ b/doc/developer-guide/cache-architecture/data-structures.en.rst
@@ -462,7 +462,7 @@ Data Structures
   A generic class:`CacheHostRecord` that contains all cache volumes that 
are not explicitly
   assigned in :file:`hosting.config`.
 
-   .. function:: Stripe * key_to_vol(const char * key, const char * host, int 
host_len)
+   .. function:: Stripe * key_to_stripe(CryptoHash * key, const char * host, 
int host_len)
 
   Compute the stripe (:code:`Stripe *`) for a cache :arg:`key` and 
:arg:`host`. The :arg:`host` is
   used to find the appropriate :class:`CacheHostRecord` instance. From 
there the stripe
diff --git a/src/iocore/cache/Cache.cc b/src/iocore/cache/Cache.cc
index 225b1e6237..5811a0577f 100644
--- a/src/iocore/cache/Cache.cc
+++ b/src/iocore/cache/Cache.cc
@@ -1225,7 +1225,7 @@ Cache::lookup(Continuation *cont, const CacheKey *key, 
CacheFragType type, const
 return ACTION_RESULT_DONE;
   }
 
-  Stripe *stripe = key_to_vol(key, hostname, host_len);
+  Stripe *stripe = key_to_stripe(key, hostname, host_len);
   CacheVC *c = new_CacheVC(cont);
   SET_CONTINUATION_HANDLER(c, ::openReadStartHead);
   c->vio.op  = VIO::READ;
@@ -1262,7 +1262,7 @@ Cache::remove(Continuation *cont, const CacheKey *key, 
CacheFragType type, const
 
   CACHE_TRY_LOCK(lock, cont->mutex, this_ethread());
   ink_assert(lock.is_locked());
-  Stripe *stripe = key_to_vol(key, hostname, host_len);
+  Stripe *stripe = key_to_stripe(key, hostname, host_len);
   // coverity[var_decl]
   Dir result;
   dir_clear(); // initialized here, set result empty so we can 
recognize missed lock
@@ -1808,9 +1808,9 @@ rebuild_host_table(Cache *cache)
   }
 }
 
-// if generic_host_rec.vols == nullptr, what do we do???
+// if generic_host_rec.stripes == nullptr, what do we do???
 Stripe *
-Cache::key_to_vol(const CacheKey *key, cons

(trafficserver) branch 9.2.x updated (75328aa8f4 -> 18596922a7)

2024-01-31 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from 75328aa8f4 header_freq: Fix msg lock issues (#10988)
 add 18596922a7 Ensure connection retry attempts can reach the config 
specified value (#11021)

No new revisions were added by this update.

Summary of changes:
 proxy/http/HttpTransact.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



(trafficserver) branch master updated: cmake: Fix CMAKE_INSTALL_CACHEDIR STRING value (#10765)

2023-11-12 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 d7c063e6cd cmake: Fix CMAKE_INSTALL_CACHEDIR STRING value (#10765)
d7c063e6cd is described below

commit d7c063e6cd0d4118a215d72f82e3baec265a1c92
Author: Hiroaki Nakamura 
AuthorDate: Mon Nov 13 09:17:46 2023 +0900

cmake: Fix CMAKE_INSTALL_CACHEDIR STRING value (#10765)
---
 cmake/layout.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmake/layout.cmake b/cmake/layout.cmake
index 8883f1740c..5f34c1249b 100644
--- a/cmake/layout.cmake
+++ b/cmake/layout.cmake
@@ -65,6 +65,6 @@ set(CMAKE_INSTALL_LOGDIR
 )
 set(CMAKE_INSTALL_CACHEDIR
   "${CMAKE_INSTALL_LOCALSTATEDIR}/trafficserver"
-CACHE STRING "logdir"
+CACHE STRING "cachedir"
 )
 include(GNUInstallDirs)



(trafficserver) branch master updated: Cleanup: Remove deprecated MUTEX_TAKE_LOCK_FOR (#11095)

2024-02-26 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 02e0824b72 Cleanup: Remove deprecated MUTEX_TAKE_LOCK_FOR (#11095)
02e0824b72 is described below

commit 02e0824b72791dcbdfead9c516a5bccc8cef0ce1
Author: Masaori Koshiba 
AuthorDate: Tue Feb 27 07:59:24 2024 +0900

Cleanup: Remove deprecated MUTEX_TAKE_LOCK_FOR (#11095)
---
 include/iocore/eventsystem/Lock.h | 6 ++
 src/iocore/eventsystem/UnixEThread.cc | 8 +---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/iocore/eventsystem/Lock.h 
b/include/iocore/eventsystem/Lock.h
index d0a92bff2c..30aa18c668 100644
--- a/include/iocore/eventsystem/Lock.h
+++ b/include/iocore/eventsystem/Lock.h
@@ -111,11 +111,9 @@
 #endif
 
 #ifdef DEBUG
-#define MUTEX_TAKE_LOCK(_m, _t) Mutex_lock(MakeSourceLocation(), (char 
*)nullptr, _m, _t)
-#define MUTEX_TAKE_LOCK_FOR(_m, _t, _c) Mutex_lock(MakeSourceLocation(), 
nullptr, _m, _t)
+#define MUTEX_TAKE_LOCK(_m, _t) Mutex_lock(MakeSourceLocation(), (char 
*)nullptr, _m, _t)
 #else
-#define MUTEX_TAKE_LOCK(_m, _t) Mutex_lock(_m, _t)
-#define MUTEX_TAKE_LOCK_FOR(_m, _t, _c) Mutex_lock(_m, _t)
+#define MUTEX_TAKE_LOCK(_m, _t) Mutex_lock(_m, _t)
 #endif // DEBUG
 
 #define MUTEX_UNTAKE_LOCK(_m, _t) Mutex_unlock(_m, _t)
diff --git a/src/iocore/eventsystem/UnixEThread.cc 
b/src/iocore/eventsystem/UnixEThread.cc
index 8b9b92ae47..1539423a95 100644
--- a/src/iocore/eventsystem/UnixEThread.cc
+++ b/src/iocore/eventsystem/UnixEThread.cc
@@ -32,6 +32,7 @@
 //
 /
 #include "P_EventSystem.h"
+#include "iocore/eventsystem/Lock.h"
 
 #if HAVE_EVENTFD
 #include 
@@ -328,9 +329,10 @@ EThread::execute()
   // Do the start event first.
   // coverity[lock]
   if (start_event) {
-MUTEX_TAKE_LOCK_FOR(start_event->mutex, this, start_event->continuation);
-start_event->continuation->handleEvent(EVENT_IMMEDIATE, start_event);
-MUTEX_UNTAKE_LOCK(start_event->mutex, this);
+{
+  SCOPED_MUTEX_LOCK(lock, start_event->mutex, this);
+  start_event->continuation->handleEvent(EVENT_IMMEDIATE, start_event);
+}
 free_event(start_event);
 start_event = nullptr;
   }



(trafficserver) branch master updated: rate_limit plugin: Decouple metrics and queue config (#11122)

2024-03-04 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 0d84ded118 rate_limit plugin: Decouple metrics and queue config 
(#11122)
0d84ded118 is described below

commit 0d84ded1181603e082141c7ba3b5d403e8e38025
Author: Masaori Koshiba 
AuthorDate: Tue Mar 5 13:27:24 2024 +0900

rate_limit plugin: Decouple metrics and queue config (#11122)
---
 plugins/experimental/rate_limit/limiter.h | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/plugins/experimental/rate_limit/limiter.h 
b/plugins/experimental/rate_limit/limiter.h
index 6f92f7e97c..73757450f4 100644
--- a/plugins/experimental/rate_limit/limiter.h
+++ b/plugins/experimental/rate_limit/limiter.h
@@ -95,16 +95,16 @@ public:
   if (queue["max_age"]) {
 _max_age = std::chrono::seconds(queue["max_age"].as());
   }
+}
 
-  const YAML::Node  = node["metrics"];
+const YAML::Node  = node["metrics"];
 
-  if (metrics) {
-std::string prefix = metrics["prefix"] ? 
metrics["prefix"].as() : RATE_LIMITER_METRIC_PREFIX;
-std::string tag= metrics["tag"] ? metrics["tag"].as() 
: name();
+if (metrics) {
+  std::string prefix = metrics["prefix"] ? 
metrics["prefix"].as() : RATE_LIMITER_METRIC_PREFIX;
+  std::string tag= metrics["tag"] ? metrics["tag"].as() : 
name();
 
-Dbg(dbg_ctl, "Metrics for selector rule: %s(%s, %s)", name().c_str(), 
prefix.c_str(), tag.c_str());
-initializeMetrics(RATE_LIMITER_TYPE_SNI, prefix, tag);
-  }
+  Dbg(dbg_ctl, "Metrics for selector rule: %s(%s, %s)", name().c_str(), 
prefix.c_str(), tag.c_str());
+  initializeMetrics(RATE_LIMITER_TYPE_SNI, prefix, tag);
 }
 
 return true;



(trafficserver) branch master updated: Fix validation regex for http.connect_ports (#11149)

2024-03-10 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 9012706b4d Fix validation regex for http.connect_ports (#11149)
9012706b4d is described below

commit 9012706b4d4566b03e2bc4f02fb2ff5c8a4048c1
Author: Masaori Koshiba 
AuthorDate: Mon Mar 11 08:27:28 2024 +0900

Fix validation regex for http.connect_ports (#11149)
---
 src/records/RecordsConfig.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/records/RecordsConfig.cc b/src/records/RecordsConfig.cc
index 7aedc3fe00..5e461fbc18 100644
--- a/src/records/RecordsConfig.cc
+++ b/src/records/RecordsConfig.cc
@@ -967,7 +967,7 @@ static const RecordElement RecordsConfig[] =
   //###
   //# CONNECT #
   //###
-  {RECT_CONFIG, "proxy.config.http.connect_ports", RECD_STRING, "443", 
RECU_DYNAMIC, RR_NULL, RECC_STR, "^(\\*|[[:digit:][:space:]]+)$", RECA_NULL}
+  {RECT_CONFIG, "proxy.config.http.connect_ports", RECD_STRING, "443", 
RECU_DYNAMIC, RR_NULL, RECC_STR, "^(\\*|[[:digit:][:space:]-]+)$", RECA_NULL}
   ,
   //##
   //# Various update periods #



(trafficserver) branch master updated: Add ENABLE_CLANG_TIDY option (#11077)

2024-03-17 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 0b813fdfb9 Add ENABLE_CLANG_TIDY option (#11077)
0b813fdfb9 is described below

commit 0b813fdfb90a0a0cceb3a7bfbe5861e8a339a80d
Author: Masaori Koshiba 
AuthorDate: Mon Mar 18 08:06:53 2024 +0900

Add ENABLE_CLANG_TIDY option (#11077)

* Add ENABLE_CLANG_TIDY option

* Include from top CMakeLists.txt

* Fix format

* Trim semi-colon at the end
---
 CMakeLists.txt|  1 +
 cmake/ClangTidy.cmake | 59 +++
 cmake/add_atsplugin.cmake |  1 +
 src/api/CMakeLists.txt|  2 ++
 src/cripts/CMakeLists.txt |  2 ++
 src/iocore/aio/CMakeLists.txt |  2 ++
 src/iocore/cache/CMakeLists.txt   |  2 ++
 src/iocore/dns/CMakeLists.txt |  2 ++
 src/iocore/eventsystem/CMakeLists.txt |  2 ++
 src/iocore/hostdb/CMakeLists.txt  |  2 ++
 src/iocore/io_uring/CMakeLists.txt|  2 ++
 src/iocore/net/CMakeLists.txt |  2 ++
 src/iocore/utils/CMakeLists.txt   |  2 ++
 src/mgmt/config/CMakeLists.txt|  2 ++
 src/mgmt/rpc/CMakeLists.txt   |  2 ++
 src/proxy/CMakeLists.txt  |  2 ++
 src/proxy/hdrs/CMakeLists.txt |  2 ++
 src/proxy/http/CMakeLists.txt |  2 ++
 src/proxy/http2/CMakeLists.txt|  2 ++
 src/proxy/http3/CMakeLists.txt|  2 ++
 src/proxy/logging/CMakeLists.txt  |  2 ++
 src/records/CMakeLists.txt|  2 ++
 src/shared/CMakeLists.txt |  2 ++
 src/traffic_cache_tool/CMakeLists.txt |  2 ++
 src/traffic_crashlog/CMakeLists.txt   |  2 ++
 src/traffic_ctl/CMakeLists.txt|  2 ++
 src/traffic_layout/CMakeLists.txt |  2 ++
 src/traffic_logcat/CMakeLists.txt |  2 ++
 src/traffic_logstats/CMakeLists.txt   |  2 ++
 src/traffic_server/CMakeLists.txt |  2 ++
 src/traffic_top/CMakeLists.txt|  2 ++
 src/traffic_via/CMakeLists.txt|  2 ++
 src/tscore/CMakeLists.txt |  2 ++
 src/tscpp/api/CMakeLists.txt  |  2 ++
 src/tsutil/CMakeLists.txt |  2 ++
 35 files changed, 125 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7bc10df048..1b2509604f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,6 +42,7 @@ list(APPEND CMAKE_MODULE_PATH 
"${CMAKE_CURRENT_SOURCE_DIR}/cmake")
 list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE -DATS_BUILD)
 
 include(layout)
+include(ClangTidy)
 
 if(CMAKE_BUILD_TYPE STREQUAL "Debug")
   add_compile_definitions(DEBUG _DEBUG)
diff --git a/cmake/ClangTidy.cmake b/cmake/ClangTidy.cmake
new file mode 100644
index 00..825f5d04f3
--- /dev/null
+++ b/cmake/ClangTidy.cmake
@@ -0,0 +1,59 @@
+###
+#
+#  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.
+#
+###
+
+# ClangTidy.cmake
+#
+# This adds a function to enable clang-tidy to the target. The .clang-tidy 
config file is refered in default.
+#
+# - e.g.
+# ```
+# "cacheVariables": {
+#   "ENABLE_CLANG_TIDY": true,
+#   "CLANG_TIDY_PATH": "/opt/homebrew/opt/llvm/bin/"
+#   "CLANG_TIDY_OPTS": "--fix;--warnings-as-errors=*"
+# }
+# ```
+
+if(ENABLE_CLANG_TIDY)
+  # Find clang-tidy program
+  find_program(
+CLANG_TIDY_EXE
+NAMES "clang-tidy"
+HINTS ${CLANG_TIDY_PATH}
+  )
+
+  # Add options if there
+  #
+  # CAVEAT: the option should not end with semi-colon. You'll see below error.
+  # ```
+  # error: unable to handle compilation, expected exactly one compiler job in 
'' [clang-diagnostic-error]
+  # ```
+  if(NOT "${CLANG_TIDY_OPTS}" STREQUAL "")
+string(REGEX REPLACE ";$" "$" CLANG_TIDY_OPTS_TRIMMED ${CLANG_TIDY_OPTS})
+string(APPEND CLANG_TIDY_EXE ";${CLANG_TIDY_OPTS_TRIMMED}")
+  endif()
+
+  message(STATUS "Enable clang-tidy - ${CLANG_TIDY_EXE}")
+endif()
+
+function(clang_tidy_check target)
+ 

(trafficserver) branch master updated: rate_limit: Set initialized flag of SieveLru when loading yaml is done (#11181)

2024-03-31 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 996291d167 rate_limit: Set initialized flag of SieveLru when loading 
yaml is done (#11181)
996291d167 is described below

commit 996291d16765a31903d083f68067798f56a7b69c
Author: Masaori Koshiba 
AuthorDate: Mon Apr 1 08:49:26 2024 +0900

rate_limit: Set initialized flag of SieveLru when loading yaml is done 
(#11181)
---
 plugins/experimental/rate_limit/ip_reputation.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/plugins/experimental/rate_limit/ip_reputation.cc 
b/plugins/experimental/rate_limit/ip_reputation.cc
index 29c03f0f20..099c3cf9c5 100644
--- a/plugins/experimental/rate_limit/ip_reputation.cc
+++ b/plugins/experimental/rate_limit/ip_reputation.cc
@@ -135,6 +135,8 @@ SieveLru::parseYaml(const YAML::Node )
   Dbg(dbg_ctl, "\twith perma-block rule: %s(%u, %u, %ld)", _name.c_str(), 
_permablock_limit, _permablock_threshold,
   static_cast(_permablock_max_age.count()));
 
+  _initialized = true;
+
   return true;
 }
 



(trafficserver) branch master updated: http2: Set proxy session active on create_stream (#11210)

2024-04-05 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 732006e23b http2: Set proxy session active on create_stream (#11210)
732006e23b is described below

commit 732006e23bd150dfabd950809c48a4891ccf3173
Author: Masaori Koshiba 
AuthorDate: Fri Apr 5 15:49:27 2024 +0900

http2: Set proxy session active on create_stream (#11210)
---
 src/proxy/http2/Http2ConnectionState.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/proxy/http2/Http2ConnectionState.cc 
b/src/proxy/http2/Http2ConnectionState.cc
index 1a0306ef5c..053599f10d 100644
--- a/src/proxy/http2/Http2ConnectionState.cc
+++ b/src/proxy/http2/Http2ConnectionState.cc
@@ -1786,6 +1786,7 @@ Http2ConnectionState::create_stream(Http2StreamId new_id, 
Http2Error )
 
   // Clear the session timeout.  Let the transaction timeouts reign
   session->get_proxy_session()->cancel_inactivity_timeout();
+  session->get_proxy_session()->set_session_active();
 
   return new_stream;
 }



(trafficserver) branch master updated: http2: close stream on sending RST_STREAM (#11209)

2024-04-05 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 b5dca0dc65 http2: close stream on sending RST_STREAM (#11209)
b5dca0dc65 is described below

commit b5dca0dc6567fdc47f79af94b1b1ce0b085e3804
Author: Masaori Koshiba 
AuthorDate: Fri Apr 5 15:52:32 2024 +0900

http2: close stream on sending RST_STREAM (#11209)
---
 src/proxy/http2/Http2ConnectionState.cc | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/proxy/http2/Http2ConnectionState.cc 
b/src/proxy/http2/Http2ConnectionState.cc
index 053599f10d..ca50283611 100644
--- a/src/proxy/http2/Http2ConnectionState.cc
+++ b/src/proxy/http2/Http2ConnectionState.cc
@@ -1437,6 +1437,12 @@ Http2ConnectionState::rcv_frame(const Http2Frame *frame)
   client_ip, session->get_connection_id(), stream_id, error.msg);
   }
   this->send_rst_stream_frame(stream_id, error.code);
+
+  // start closing stream on stream error
+  if (Http2Stream *stream = find_stream(stream_id); stream != nullptr) {
+ink_assert(stream->get_state() == 
Http2StreamState::HTTP2_STREAM_STATE_CLOSED);
+stream->initiating_close();
+  }
 }
   }
 }



(trafficserver) branch master updated: http2: change stream state to closed from open if END_STREAM is sent and received (#11188)

2024-03-28 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 d3ff8b2009 http2: change stream state to closed from open if 
END_STREAM is sent and received (#11188)
d3ff8b2009 is described below

commit d3ff8b20090ba6b172d11ef87e09ef586cf92113
Author: Masaori Koshiba 
AuthorDate: Fri Mar 29 09:17:34 2024 +0900

http2: change stream state to closed from open if END_STREAM is sent and 
received (#11188)
---
 src/proxy/http2/Http2Stream.cc | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/proxy/http2/Http2Stream.cc b/src/proxy/http2/Http2Stream.cc
index 0ee5cd36d9..8783ce0796 100644
--- a/src/proxy/http2/Http2Stream.cc
+++ b/src/proxy/http2/Http2Stream.cc
@@ -407,7 +407,11 @@ Http2Stream::change_state(uint8_t type, uint8_t flags)
   _state = Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE;
 }
   } else if (send_end_stream) {
-_state = Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL;
+if (receive_end_stream) {
+  _state = Http2StreamState::HTTP2_STREAM_STATE_CLOSED;
+} else {
+  _state = Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL;
+}
   } else {
 // Do not change state
   }



(trafficserver) branch master updated: AuTest: Make ja3_fingerprint test stable (#11230)

2024-04-11 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 b4c6b8bafa AuTest: Make ja3_fingerprint test stable (#11230)
b4c6b8bafa is described below

commit b4c6b8bafa272b727098cfc091070b9180ad7d51
Author: Masaori Koshiba 
AuthorDate: Fri Apr 12 08:12:40 2024 +0900

AuTest: Make ja3_fingerprint test stable (#11230)
---
 tests/gold_tests/pluginTest/ja3_fingerprint/modify-sent-client.gold | 2 --
 1 file changed, 2 deletions(-)

diff --git 
a/tests/gold_tests/pluginTest/ja3_fingerprint/modify-sent-client.gold 
b/tests/gold_tests/pluginTest/ja3_fingerprint/modify-sent-client.gold
index f50c2dea7c..4fe02c02a7 100644
--- a/tests/gold_tests/pluginTest/ja3_fingerprint/modify-sent-client.gold
+++ b/tests/gold_tests/pluginTest/ja3_fingerprint/modify-sent-client.gold
@@ -1,6 +1,4 @@
 + Incoming Request +
-``
-+ Incoming Request +
 -- State Machine Id``
 POST ``
 Host: ``



(trafficserver) branch master updated: Terminate H2 connection by COMPRESSION_ERROR (#11222)

2024-04-11 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 14d5b2ce40 Terminate H2 connection by COMPRESSION_ERROR (#11222)
14d5b2ce40 is described below

commit 14d5b2ce401446a13b2fef4ab8dbc7cf890acf25
Author: Masaori Koshiba 
AuthorDate: Fri Apr 12 08:16:09 2024 +0900

Terminate H2 connection by COMPRESSION_ERROR (#11222)
---
 src/proxy/http2/Http2ConnectionState.cc | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/proxy/http2/Http2ConnectionState.cc 
b/src/proxy/http2/Http2ConnectionState.cc
index 9bb38b097a..c15102e3c5 100644
--- a/src/proxy/http2/Http2ConnectionState.cc
+++ b/src/proxy/http2/Http2ConnectionState.cc
@@ -320,6 +320,13 @@ Http2ConnectionState::rcv_headers_frame(const Http2Frame 
)
   stream = this->create_stream(stream_id, error);
   new_stream = true;
   if (!stream) {
+// Terminate the connection with COMPRESSION_ERROR because we don't 
decompress the field block in this HEADERS frame.
+// TODO: try to decompress to keep HPACK Dynamic Table in sync.
+if (error.cls == Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM) {
+  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, 
Http2ErrorCode::HTTP2_ERROR_COMPRESSION_ERROR,
+error.msg);
+}
+
 return error;
   }
 }
@@ -377,7 +384,7 @@ Http2ConnectionState::rcv_headers_frame(const Http2Frame 
)
 }
 // Protocol error if the stream depends on itself
 if (stream_id == params.priority.stream_dependency) {
-  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM, 
Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, 
Http2ErrorCode::HTTP2_ERROR_COMPRESSION_ERROR,
 "recv headers self dependency");
 }
 



(trafficserver) branch master updated (69860ddfaa -> ceb60aeaf7)

2024-04-10 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from 69860ddfaa cleanup asan odr violations (#11237)
 add ceb60aeaf7 Cleanup: rename client_vc to txn (#11234)

No new revisions were added by this update.

Summary of changes:
 include/proxy/http/HttpSM.h |  2 +-
 src/proxy/http/HttpSM.cc| 22 +++---
 2 files changed, 12 insertions(+), 12 deletions(-)



(trafficserver) branch master updated (f6ad241eb4 -> e6c269aadd)

2024-04-18 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from f6ad241eb4 http2: Track scheduled events (#11262)
 add e6c269aadd Initialize HistoryEntry array (#11264)

No new revisions were added by this update.

Summary of changes:
 include/tscore/History.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



(trafficserver) branch master updated: Add nullptr guards in ActivityCop functions (#11266)

2024-04-22 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 1cea215472 Add nullptr guards in ActivityCop functions (#11266)
1cea215472 is described below

commit 1cea2154722f302dde35668e1766586a8d9c717e
Author: Masaori Koshiba 
AuthorDate: Tue Apr 23 07:20:52 2024 +0900

Add nullptr guards in ActivityCop functions (#11266)

* Add nullptr guards in ActivityCop functions

* Set nullptr after canceling event
---
 include/iocore/net/NetTimeout.h | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/iocore/net/NetTimeout.h b/include/iocore/net/NetTimeout.h
index b10570994b..8cef2a804a 100644
--- a/include/iocore/net/NetTimeout.h
+++ b/include/iocore/net/NetTimeout.h
@@ -219,14 +219,19 @@ template 
 inline void
 ActivityCop::start()
 {
-  _event = this_ethread()->schedule_every(this, HRTIME_SECONDS(_freq));
+  if (_event == nullptr) {
+_event = this_ethread()->schedule_every(this, HRTIME_SECONDS(_freq));
+  }
 }
 
 template 
 inline void
 ActivityCop::stop()
 {
-  _event->cancel();
+  if (_event != nullptr) {
+_event->cancel();
+_event = nullptr;
+  }
 }
 
 template 



(trafficserver) branch master updated (a356e443aa -> 2462b93782)

2024-04-15 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

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


from a356e443aa libswoc: version update to 1.5.12 (#11256)
 add 2462b93782 AuTest: Make ja3_fingerprint test more stable (#11254)

No new revisions were added by this update.

Summary of changes:
 .../gold_tests/pluginTest/ja3_fingerprint/modify-incoming-client.gold | 2 +-
 .../gold_tests/pluginTest/ja3_fingerprint/modify-incoming-proxy.gold  | 4 +---
 tests/gold_tests/pluginTest/ja3_fingerprint/modify-sent-client.gold   | 2 +-
 tests/gold_tests/pluginTest/ja3_fingerprint/modify-sent-proxy.gold| 4 +---
 4 files changed, 4 insertions(+), 8 deletions(-)



<    4   5   6   7   8   9   10   >