(trafficserver) branch master updated: Cleanup: Http2ConnectionState (#11235)

2024-04-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 6492243083 Cleanup: Http2ConnectionState (#11235)
6492243083 is described below

commit 6492243083d2f27eb8b16ddb8085035cf5c5b373
Author: Masaori Koshiba 
AuthorDate: Tue Apr 16 09:47:42 2024 +0900

Cleanup: Http2ConnectionState (#11235)

* Cleanup: Http2ConnectionState

* Fix http2_rst_stream AuTest
---
 src/proxy/http2/Http2ConnectionState.cc  | 26 +-
 tests/gold_tests/h2/http2_rst_stream.test.py | 10 --
 2 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/src/proxy/http2/Http2ConnectionState.cc 
b/src/proxy/http2/Http2ConnectionState.cc
index c15102e3c5..62edea507a 100644
--- a/src/proxy/http2/Http2ConnectionState.cc
+++ b/src/proxy/http2/Http2ConnectionState.cc
@@ -663,7 +663,7 @@ Http2ConnectionState::rcv_rst_stream_frame(const Http2Frame 
)
   }
 
   if (stream != nullptr) {
-Http2StreamDebug(this->session, stream_id, "Parsed RST_STREAM: Error Code: 
%u", rst_stream.error_code);
+Http2StreamDebug(this->session, stream_id, "Parsed RST_STREAM frame: Error 
Code: %u", rst_stream.error_code);
 stream->set_rx_error_code({ProxyErrorClass::TXN, 
static_cast(rst_stream.error_code)});
 stream->initiating_close();
   }
@@ -1433,7 +1433,7 @@ Http2ConnectionState::rcv_frame(const Http2Frame *frame)
   this->send_goaway_frame(this->latest_streamid_in, error.code);
   this->session->set_half_close_local_flag(true);
   if (fini_event == nullptr) {
-fini_event = this_ethread()->schedule_imm_local((Continuation *)this, 
HTTP2_SESSION_EVENT_FINI);
+fini_event = 
this_ethread()->schedule_imm_local(static_cast(this), 
HTTP2_SESSION_EVENT_FINI);
   }
 
   // The streams will be cleaned up by the HTTP2_SESSION_EVENT_FINI event
@@ -1510,7 +1510,8 @@ Http2ConnectionState::main_event_handler(int event, void 
*edata)
 // identifier set to 2^31-1 and a NO_ERROR code.
 send_goaway_frame(INT32_MAX, Http2ErrorCode::HTTP2_ERROR_NO_ERROR);
 // After allowing time for any in-flight stream creation (at least one 
round-trip time),
-shutdown_cont_event = this_ethread()->schedule_in((Continuation *)this, 
HRTIME_SECONDS(2), HTTP2_SESSION_EVENT_SHUTDOWN_CONT);
+shutdown_cont_event =
+  this_ethread()->schedule_in(static_cast(this), 
HRTIME_SECONDS(2), HTTP2_SESSION_EVENT_SHUTDOWN_CONT);
   } break;
 
   // Continue a graceful shutdown
@@ -2080,7 +2081,7 @@ 
Http2ConnectionState::schedule_stream_to_send_priority_frames(Http2Stream *strea
 _priority_scheduled = true;
 
 SET_HANDLER(::main_event_handler);
-this_ethread()->schedule_imm_local((Continuation *)this, 
HTTP2_SESSION_EVENT_PRIO);
+this_ethread()->schedule_imm_local(static_cast(this), 
HTTP2_SESSION_EVENT_PRIO);
   }
 }
 
@@ -2095,7 +2096,7 @@ 
Http2ConnectionState::schedule_stream_to_send_data_frames(Http2Stream *stream)
 _data_scheduled = true;
 
 SET_HANDLER(::main_event_handler);
-this_ethread()->schedule_in((Continuation *)this, HRTIME_MSECOND, 
HTTP2_SESSION_EVENT_DATA);
+this_ethread()->schedule_in(static_cast(this), 
HRTIME_MSECOND, HTTP2_SESSION_EVENT_DATA);
   }
 }
 
@@ -2107,14 +2108,14 @@ Http2ConnectionState::schedule_retransmit(ink_hrtime t)
 
   if (retransmit_event == nullptr) {
 SET_HANDLER(::main_event_handler);
-retransmit_event = this_ethread()->schedule_in((Continuation *)this, t, 
HTTP2_SESSION_EVENT_XMIT);
+retransmit_event = this_ethread()->schedule_in(static_cast(this), t, HTTP2_SESSION_EVENT_XMIT);
   }
 }
 
 void
 Http2ConnectionState::cancel_retransmit()
 {
-  Http2StreamDebug(session, 0, "Scheduling retransmitting data frames");
+  Http2StreamDebug(session, 0, "Canceling retransmitting data frames");
   SCOPED_MUTEX_LOCK(lock, this->mutex, this_ethread());
   if (retransmit_event != nullptr) {
 retransmit_event->cancel();
@@ -2164,7 +2165,7 @@ 
Http2ConnectionState::send_data_frames_depends_on_priority()
 break;
   }
 
-  this_ethread()->schedule_imm_local((Continuation *)this, 
HTTP2_SESSION_EVENT_PRIO);
+  this_ethread()->schedule_imm_local(static_cast(this), 
HTTP2_SESSION_EVENT_PRIO);
   return;
 }
 
@@ -2401,7 +2402,7 @@ Http2ConnectionState::send_headers_frame(Http2Stream 
*stream)
 this->send_goaway_frame(this->latest_streamid_in, 
Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR);
 this->session->set_half_close_local_flag(true);
 if (fini_event == nullptr) {
-  fini_event = this_ethread()->schedule_imm_local((Continuation *)this, 
HTTP2_SESSION_EVENT_FINI);
+  fini_event = this_ethread()->schedule_imm_local(static_cast(this), HTTP2_SESSION_EVENT_FINI);
 }
 
 return;
@@ -2539,7 +2540,7 @@ Http2ConnectionState::send_push_promise_frame(Http2Stream 
*stream, URL , con
 void
 

(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(-)



(trafficserver) branch master updated: libswoc: version update to 1.5.12 (#11256)

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

bneradt 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 a356e443aa libswoc: version update to 1.5.12 (#11256)
a356e443aa is described below

commit a356e443aae64b55cbd69bbe0e6a02ed912a6a6b
Author: Brian Neradt 
AuthorDate: Mon Apr 15 14:15:55 2024 -0500

libswoc: version update to 1.5.12 (#11256)

I cut a 1.5.12 trafficserver-libswoc release that brings the latter up
to the source code that ATS lib/swoc has. This updates the version of
our ATS libswoc to reference the trafficserver-libswoc release version.

Note that this is a version-only update. No production changes come with
this patch.
---
 lib/swoc/CMakeLists.txt  | 2 +-
 lib/swoc/include/swoc/swoc_version.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/swoc/CMakeLists.txt b/lib/swoc/CMakeLists.txt
index 53819ebaf3..a7ebe26400 100644
--- a/lib/swoc/CMakeLists.txt
+++ b/lib/swoc/CMakeLists.txt
@@ -1,7 +1,7 @@
 cmake_minimum_required(VERSION 3.11)
 
 project(Lib-SWOC CXX)
-set(LIBSWOC_VERSION "1.5.11")
+set(LIBSWOC_VERSION "1.5.12")
 set(CMAKE_CXX_STANDARD 17)
 cmake_policy(SET CMP0087 NEW)
 # override "lib64" to be "lib" unless the user explicitly sets it.
diff --git a/lib/swoc/include/swoc/swoc_version.h 
b/lib/swoc/include/swoc/swoc_version.h
index fd0c752eca..e346be1ebe 100644
--- a/lib/swoc/include/swoc/swoc_version.h
+++ b/lib/swoc/include/swoc/swoc_version.h
@@ -23,11 +23,11 @@
 #pragma once
 
 #if !defined(SWOC_VERSION_NS)
-#define SWOC_VERSION_NS _1_5_11
+#define SWOC_VERSION_NS _1_5_12
 #endif
 
 namespace swoc { inline namespace SWOC_VERSION_NS {
 static constexpr unsigned MAJOR_VERSION = 1;
 static constexpr unsigned MINOR_VERSION = 5;
-static constexpr unsigned POINT_VERSION = 11;
+static constexpr unsigned POINT_VERSION = 12;
 }} // namespace swoc::SWOC_VERSION_NS



(trafficserver) branch master updated (25eea46729 -> c01cc6203f)

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

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


from 25eea46729 CMakePresets: add opentelemetry_ROOT with CURL_ROOT (#11252)
 add c01cc6203f Findwamr.cmake: a find script for the WAMR library (#11251)

No new revisions were added by this update.

Summary of changes:
 cmake/{Findhwloc.cmake => Findwamr.cmake} | 32 +++
 1 file changed, 16 insertions(+), 16 deletions(-)
 copy cmake/{Findhwloc.cmake => Findwamr.cmake} (61%)



(trafficserver) branch master updated (45f00b5ee2 -> 25eea46729)

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

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


from 45f00b5ee2 libswoc: fix unresolved function type for 
transform_view_of. (#11255)
 add 25eea46729 CMakePresets: add opentelemetry_ROOT with CURL_ROOT (#11252)

No new revisions were added by this update.

Summary of changes:
 CMakePresets.json | 2 ++
 1 file changed, 2 insertions(+)



(trafficserver-libswoc) branch master updated: Update to 1.5.13

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

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


The following commit(s) were added to refs/heads/master by this push:
 new dc3cf7d  Update to 1.5.13
dc3cf7d is described below

commit dc3cf7d47458ec785ab0f7e8e75348a31e32d120
Author: Brian Neradt 
AuthorDate: Mon Apr 15 18:08:48 2024 +

Update to 1.5.13
---
 code/CMakeLists.txt  | 2 +-
 code/include/swoc/swoc_version.h | 4 ++--
 code/libswoc.part| 2 +-
 doc/Doxyfile | 2 +-
 doc/code/TextView.en.rst | 4 ++--
 doc/code/ip_networking.en.rst| 2 +-
 doc/conf.py  | 2 +-
 7 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt
index e8b8406..3e91a2d 100644
--- a/code/CMakeLists.txt
+++ b/code/CMakeLists.txt
@@ -1,7 +1,7 @@
 cmake_minimum_required(VERSION 3.11)
 
 project(Lib-SWOC CXX)
-set(LIBSWOC_VERSION "1.5.12")
+set(LIBSWOC_VERSION "1.5.13")
 set(CMAKE_CXX_STANDARD 17)
 cmake_policy(SET CMP0087 NEW)
 # override "lib64" to be "lib" unless the user explicitly sets it.
diff --git a/code/include/swoc/swoc_version.h b/code/include/swoc/swoc_version.h
index e346be1..f9ffbed 100644
--- a/code/include/swoc/swoc_version.h
+++ b/code/include/swoc/swoc_version.h
@@ -23,11 +23,11 @@
 #pragma once
 
 #if !defined(SWOC_VERSION_NS)
-#define SWOC_VERSION_NS _1_5_12
+#define SWOC_VERSION_NS _1_5_13
 #endif
 
 namespace swoc { inline namespace SWOC_VERSION_NS {
 static constexpr unsigned MAJOR_VERSION = 1;
 static constexpr unsigned MINOR_VERSION = 5;
-static constexpr unsigned POINT_VERSION = 12;
+static constexpr unsigned POINT_VERSION = 13;
 }} // namespace swoc::SWOC_VERSION_NS
diff --git a/code/libswoc.part b/code/libswoc.part
index 10c0aea..6dca03c 100644
--- a/code/libswoc.part
+++ b/code/libswoc.part
@@ -1,6 +1,6 @@
 Import("*")
 PartName("libswoc")
-PartVersion("1.5.12")
+PartVersion("1.5.13")
 
 src_files = [
 "src/ArenaWriter.cc",
diff --git a/doc/Doxyfile b/doc/Doxyfile
index 7a70d38..189de41 100644
--- a/doc/Doxyfile
+++ b/doc/Doxyfile
@@ -38,7 +38,7 @@ PROJECT_NAME   = "LibSWOC++"
 # could be handy for archiving the generated documentation or if some version
 # control system is used.
 
-PROJECT_NUMBER = "1.5.12"
+PROJECT_NUMBER = "1.5.13"
 
 # Using the PROJECT_BRIEF tag one can provide an optional one line description
 # for a project that appears at the top of each page and should give viewer a
diff --git a/doc/code/TextView.en.rst b/doc/code/TextView.en.rst
index 44e5c1d..962b7b1 100644
--- a/doc/code/TextView.en.rst
+++ b/doc/code/TextView.en.rst
@@ -366,7 +366,7 @@ for values that are boolean.
 
 .. sidebar:: Verification
 
-   `Test code for example 
`__.
+   `Test code for example 
`__.
 
 The basic list processing is the same as the previous example, extracting each 
comma separated
 element. The resulting element is treated as a "list" with ``=`` as the 
separator. Note if there is
@@ -418,7 +418,7 @@ do not, so a flag to strip quotes from the resulting 
elements is needed. The fin
 
 .. sidebar:: Verification
 
-   `Test code for example 
`__.
+   `Test code for example 
`__.
 
 This takes a :code:`TextView&` which is the source view which will be updated 
as tokens are removed
 (therefore the caller must do the empty view check). The other arguments are 
the separator character
diff --git a/doc/code/ip_networking.en.rst b/doc/code/ip_networking.en.rst
index e50611a..2627fd6 100644
--- a/doc/code/ip_networking.en.rst
+++ b/doc/code/ip_networking.en.rst
@@ -265,7 +265,7 @@ Blending Bitsets
 
Some details are omitted for brevity and because they aren't directly 
relevant. The full
implementation, which is run as a unit test to verify its correctness,
-   `is available here 
`__.
+   `is available here 
`__.
You can compile and step through the code to see how it works in more 
detail, or experiment
with changing some of the example data.
 
diff --git a/doc/conf.py b/doc/conf.py
index 1507e46..6047867 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -79,7 +79,7 @@ project = u'Solid Wall Of C++'
 copyright = u'{}, a...@apache.org'.format(date.today().year)
 
 # The full version, including alpha/beta/rc tags.
-release = "1.5.12"
+release = "1.5.13"
 # The short X.Y version.
 version = '.'.join(release.split('.', 2)[:2])
 



(trafficserver-libswoc) annotated tag 1.5.12 updated (676fc8d -> dd61f68)

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

bneradt pushed a change to annotated tag 1.5.12
in repository https://gitbox.apache.org/repos/asf/trafficserver-libswoc.git


*** WARNING: tag 1.5.12 was modified! ***

from 676fc8d  (commit)
  to dd61f68  (tag)
 tagging 676fc8d7d73c5b461f07670247375f0a052121a2 (commit)
 replaces 1.5.11
  by Brian Neradt
  on Mon Apr 15 18:00:43 2024 +

- Log -
Version 1.5.12 (04/15/2024, brian.neradt)

676fc8d fix unresolved function type for transform_view_of. (#11255)
93c97e4 Use GCC stardard pre-defined macros to determine endianess. (#11186)
7af411e Fix GCC 14.0.1 -std=c++20 build failures (#11189)
---


No new revisions were added by this update.

Summary of changes:



(trafficserver-libswoc) 03/03: libswoc: fix unresolved function type for transform_view_of. (#11255)

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

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

commit 676fc8d7d73c5b461f07670247375f0a052121a2
Author: Brian Neradt 
AuthorDate: Mon Apr 15 16:44:34 2024 +

libswoc: fix unresolved function type for transform_view_of. (#11255)

On some compilers this was showing an error as they  weren't able to
decude the right function/type.
---
 code/include/swoc/Lexicon.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/code/include/swoc/Lexicon.h b/code/include/swoc/Lexicon.h
index c574bc7..6bb0484 100644
--- a/code/include/swoc/Lexicon.h
+++ b/code/include/swoc/Lexicon.h
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "swoc/swoc_version.h"
 #include "swoc/IntrusiveHashMap.h"
@@ -567,7 +568,7 @@ Lexicon::Item::ValueLinkage::key_of(Item *item) {
 template 
 uint32_t
 Lexicon::Item::NameLinkage::hash_of(std::string_view s) {
-  return Hash32FNV1a().hash_immediate(transform_view_of(, s));
+  return Hash32FNV1a().hash_immediate(transform_view_of(&::toupper, s));
 }
 
 template 



(trafficserver-libswoc) 02/03: Use GCC stardard pre-defined macros to determine endianess. (#11186)

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

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

commit 93c97e4b1c08527052c202777052a7604e05ea36
Author: Brian Neradt 
AuthorDate: Mon Apr 15 16:43:59 2024 +

Use GCC stardard pre-defined macros to determine endianess. (#11186)
---
 code/include/swoc/swoc_ip_util.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/code/include/swoc/swoc_ip_util.h b/code/include/swoc/swoc_ip_util.h
index 78016bf..40d6074 100644
--- a/code/include/swoc/swoc_ip_util.h
+++ b/code/include/swoc/swoc_ip_util.h
@@ -65,7 +65,7 @@ inline bool is_private_network_order(in6_addr const& addr) {
   return (addr.s6_addr[0] & 0xFE) == 0xFC; // fc00::/7
 }
 
-#if BYTE_ORDER == LITTLE_ENDIAN
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
 
 inline bool is_loopback_network_order(in_addr_t addr) {
   return (addr & 0xFF) == 0x7F;



(trafficserver-libswoc) branch master updated (7df56ee -> 676fc8d)

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

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


from 7df56ee  Update to 1.5.12
 new 7af411e  Fix GCC 14.0.1 -std=c++20 build failures (#11189)
 new 93c97e4  Use GCC stardard pre-defined macros to determine endianess. 
(#11186)
 new 676fc8d  libswoc: fix unresolved function type for transform_view_of. 
(#11255)

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


Summary of changes:
 code/include/swoc/Lexicon.h  | 3 ++-
 code/include/swoc/TextView.h | 2 +-
 code/include/swoc/swoc_ip_util.h | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)



(trafficserver-libswoc) 01/03: Fix GCC 14.0.1 -std=c++20 build failures (#11189)

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

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

commit 7af411e3233ac2262565a28935d1fa382cfd53ab
Author: Brian Neradt 
AuthorDate: Mon Apr 15 16:41:28 2024 +

Fix GCC 14.0.1 -std=c++20 build failures (#11189)

* comparison of unsigned expression in ‘>= 0’ is always true

lib/swoc/include/swoc/TextView.h: In instantiation of ‘uintmax_t 
swoc::_1_5_11::svto_radix(TextView&) [with int RADIX = 16; uintmax_t = long 
unsigned int]’:
lib/swoc/include/swoc/TextView.h:1082:23:   required from ‘uintmax_t 
swoc::_1_5_11::svto_radix(TextView&&) [with int N = 16; uintmax_t = long 
unsigned int]’
lib/swoc/include/swoc/TextView.h:1065:27: error:  1082 |   return 
svto_radix(src);
lib/swoc/include/swoc/TextView.h:1065:27: error:   |  
~^
lib/swoc/src/bw_format.cc:928:28:   required from here
lib/swoc/include/swoc/TextView.h:1065:27: error:   928 | auto b = 
svto_radix<16>(span.clip_prefix(2).rebind());
lib/swoc/include/swoc/TextView.h:1065:27: error:   |  
~~^~
lib/swoc/include/swoc/TextView.h:1065:27: error: comparison of unsigned 
expression in ‘>= 0’ is always true [-Werror=type-limits]
 1065 |   while (src.size() && (0 <= (v = 
swoc::svtoi_convert[uint8_t(*src)])) && v < RADIX) {
  |
~~~^~~~
cc1plus: all warnings being treated as errors

Second warning:

src/tscore/HostLookup.cc: In member function ‘void 
CharIndex::Insert(std::string_view, HostBranch*)’:
src/tscore/HostLookup.cc:304:12: error: ‘any_of’ is not a member of ‘std’
  304 |   if (std::any_of(match_data.begin(), match_data.end(), [](unsigned 
char c) { return asciiToTable[c] == 255; })) {
  |^~
src/tscore/HostLookup.cc: In member function ‘HostBranch* 
CharIndex::Lookup(std::string_view)’:
src/tscore/HostLookup.cc:351:12: error: ‘any_of’ is not a member of ‘std’
  351 |   if (std::any_of(match_data.begin(), match_data.end(), [](unsigned 
char c) { return asciiToTable[c] == 255; })) {
  |^~

* ‘any_of’ is not a member of ‘std’

src/tscore/HostLookup.cc: In member function ‘void 
CharIndex::Insert(std::string_view, HostBranch*)’:
src/tscore/HostLookup.cc:304:12: error: ‘any_of’ is not a member of ‘std’
  304 |   if (std::any_of(match_data.begin(), match_data.end(), [](unsigned 
char c) { return asciiToTable[c] == 255; })) {
  |^~
src/tscore/HostLookup.cc: In member function ‘HostBranch* 
CharIndex::Lookup(std::string_view)’:
src/tscore/HostLookup.cc:351:12: error: ‘any_of’ is not a member of ‘std’
  351 |   if (std::any_of(match_data.begin(), match_data.end(), [](unsigned 
char c) { return asciiToTable[c] == 255; })) {
  |^~

* error: template-id not allowed for constructor in C++20

plugins/header_rewrite/matcher.h:71:23: error: template-id not allowed for 
constructor in C++20 [-Werror=template-id-cdtor]
   71 |   explicit Matchers(const MatcherOps op) : Matcher(op), _data() 
{}
  |   ^
plugins/header_rewrite/matcher.h:71:23: note: remove the ‘< >’

/home/bneradt/src/ts_asf_master_fix_std_20_build_failure/plugins/header_rewrite/matcher.h:222:38:
 error: template-id not allowed for constructor in C++20 
[-Werror=template-id-cdtor]
  222 |   explicit Matchers(const MatcherOps op) : 
Matcher(op) {}
  |  ^

/home/bneradt/src/ts_asf_master_fix_std_20_build_failure/plugins/header_rewrite/matcher.h:222:38:
 note: remove the ‘< >’
---
 code/include/swoc/TextView.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/code/include/swoc/TextView.h b/code/include/swoc/TextView.h
index 9e914c8..3fecf03 100644
--- a/code/include/swoc/TextView.h
+++ b/code/include/swoc/TextView.h
@@ -1062,7 +1062,7 @@ svto_radix(TextView ) {
   static constexpr auto OVERFLOW_LIMIT = MAX / RADIX;
   uintmax_t zret   = 0;
   uintmax_t v;
-  while (src.size() && (0 <= (v = swoc::svtoi_convert[uint8_t(*src)])) && v < 
RADIX) {
+  while (src.size() && ((v = swoc::svtoi_convert[uint8_t(*src)]) < RADIX)) {
 // Tweaked for performance - need to check range after @a RADIX multiply.
 ++src; // Update view iff the character is parsed.
 if (zret <= OVERFLOW_LIMIT && v <= (MAX - (zret *= RADIX)) ) {



(trafficserver) branch master updated: libswoc: fix unresolved function type for transform_view_of. (#11255)

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

dmeden 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 45f00b5ee2 libswoc: fix unresolved function type for 
transform_view_of. (#11255)
45f00b5ee2 is described below

commit 45f00b5ee22f56768ad86e7d10c0e87fdf26c19d
Author: Damian Meden 
AuthorDate: Mon Apr 15 18:04:26 2024 +0200

libswoc: fix unresolved function type for transform_view_of. (#11255)

On some compilers this was showing an error as they  weren't able to
decude the right function/type.
---
 lib/swoc/include/swoc/Lexicon.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/swoc/include/swoc/Lexicon.h b/lib/swoc/include/swoc/Lexicon.h
index c574bc7548..6bb048421a 100644
--- a/lib/swoc/include/swoc/Lexicon.h
+++ b/lib/swoc/include/swoc/Lexicon.h
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "swoc/swoc_version.h"
 #include "swoc/IntrusiveHashMap.h"
@@ -567,7 +568,7 @@ Lexicon::Item::ValueLinkage::key_of(Item *item) {
 template 
 uint32_t
 Lexicon::Item::NameLinkage::hash_of(std::string_view s) {
-  return Hash32FNV1a().hash_immediate(transform_view_of(, s));
+  return Hash32FNV1a().hash_immediate(transform_view_of(&::toupper, s));
 }
 
 template 



(trafficserver) branch 10.0.x updated (eaf34fd330 -> 4c8fd0c005)

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

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


from eaf34fd330 IP Allow: document when rules are applied (#11240)
 new d5a6d4333b Fixed asan leak issues with RegexContext (#11184)
 new 5c82874dc1 Allow Cripts to be used directly as @plugin (#11192)
 new 6c9143f51d Terminate H2 connection by COMPRESSION_ERROR (#11222)
 new 829a2617f8 AuTest: Make ja3_fingerprint test stable (#11230)
 new 163fbc55a7 header_rewrite: add debug to accompany parse_line errors 
(#11238)
 new cef3cbc62c Fix asan leak errors for cachevol test (#11239)
 new ffe023a579 HttpSM::tunnel_handler: Handle WRITE events (#11242)
 new b6df6de977 CID 1374999: plugin stale_response, delete pointer on early 
exit. (#11248)
 new dbcf2fe9da CID 1534744: txn_box: Move config object insetad of copy. 
(#11249)
 new ed2b5731a0 Avoid including pcre2.h in Regex.h. (#11246)
 new 4c8fd0c005 Fixes the HRW regexes after refactoring in #11152 (#11250)

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


Summary of changes:
 doc/admin-guide/files/records.yaml.en.rst  |  14 ++
 include/proxy/http/remap/PluginDso.h   |   2 +-
 include/proxy/http/remap/PluginFactory.h   |   2 +
 include/proxy/http/remap/RemapPluginInfo.h |   2 +-
 include/tsutil/Regex.h |  46 +++---
 .../experimental/stale_response/stale_response.cc  |   1 +
 .../txn_box/plugin/src/txn_box_remap.cc|   2 +-
 plugins/header_rewrite/header_rewrite.cc   |   7 +-
 plugins/header_rewrite/matcher.h   |   6 +-
 plugins/header_rewrite/value.cc|   1 +
 src/iocore/cache/unit_tests/test_CacheVol.cc   |   7 +-
 src/proxy/http/HttpSM.cc   |   6 +
 src/proxy/http/remap/PluginDso.cc  |  24 ++-
 src/proxy/http/remap/PluginFactory.cc  |  24 ++-
 src/proxy/http/remap/RemapPluginInfo.cc|   4 +-
 src/proxy/http/remap/UrlRewrite.cc |  19 +++
 src/proxy/http2/Http2ConnectionState.cc|   9 +-
 src/records/RecordsConfig.cc   |   2 +
 src/traffic_server/traffic_server.cc   |   2 +-
 src/tsutil/DbgCtl.cc   |  16 +-
 src/tsutil/Regex.cc| 163 ++---
 .../ja3_fingerprint/modify-sent-client.gold|   2 -
 tools/cripts/compiler.sh   |  97 
 23 files changed, 372 insertions(+), 86 deletions(-)
 create mode 100755 tools/cripts/compiler.sh



(trafficserver) 02/11: Allow Cripts to be used directly as @plugin (#11192)

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

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

commit 5c82874dc17df4add57090123495809a7ad9c647
Author: Leif Hedstrom 
AuthorDate: Thu Apr 11 10:07:13 2024 -0600

Allow Cripts to be used directly as @plugin (#11192)

* Allow for traffic_server to compile Cripts directly

This relies on an external script / application to do the
actual work. If not configured, no new behavior is introduced.

* Fixes from review

(cherry picked from commit defd0f2f5b8efcf366a4651f30a4ba9d266b1b99)
---
 doc/admin-guide/files/records.yaml.en.rst  | 14 +
 include/proxy/http/remap/PluginDso.h   |  2 +-
 include/proxy/http/remap/PluginFactory.h   |  2 +
 include/proxy/http/remap/RemapPluginInfo.h |  2 +-
 src/proxy/http/remap/PluginDso.cc  | 24 ++--
 src/proxy/http/remap/PluginFactory.cc  | 24 +++-
 src/proxy/http/remap/RemapPluginInfo.cc|  4 +-
 src/proxy/http/remap/UrlRewrite.cc | 19 ++
 src/records/RecordsConfig.cc   |  2 +
 src/traffic_server/traffic_server.cc   |  2 +-
 tools/cripts/compiler.sh   | 97 ++
 11 files changed, 182 insertions(+), 10 deletions(-)

diff --git a/doc/admin-guide/files/records.yaml.en.rst 
b/doc/admin-guide/files/records.yaml.en.rst
index a75647aba4..6b2172bb1b 100644
--- a/doc/admin-guide/files/records.yaml.en.rst
+++ b/doc/admin-guide/files/records.yaml.en.rst
@@ -4895,6 +4895,20 @@ Plug-in Configuration
Enables (``1``) or disables (``0``) the dynamic reload feature for remap
plugins (`remap.config`). Global plugins (`plugin.config`) do not have 
dynamic reload feature yet.
 
+.. ts:cv:: CONFIG proxy.config.plugin.compiler_path STRING ""
+
+   Specifies an optional compiler tool path for compiling plugins. This tool 
should
+   be an executable, which takes two arguments:
+
+   === ==
+   Arg Description
+   === ==
+   1   This is the path to the source file, which should be compiled
+   2   This is the path to the DSO file, which will be created and loaded
+   === ==
+
+   The script should exit with a status code of ``0`` if the compilation was 
successful.
+
 .. ts:cv:: CONFIG proxy.config.plugin.vc.default_buffer_index INT 8
:reloadable:
:overridable:
diff --git a/include/proxy/http/remap/PluginDso.h 
b/include/proxy/http/remap/PluginDso.h
index 41f18b943d..9c0d6e452d 100644
--- a/include/proxy/http/remap/PluginDso.h
+++ b/include/proxy/http/remap/PluginDso.h
@@ -66,7 +66,7 @@ public:
   virtual ~PluginDso();
 
   /* DSO Load, unload, get symbols from DSO */
-  virtual bool load(std::string );
+  virtual bool load(std::string , const fs::path );
   virtual bool unload(std::string );
   bool isLoaded();
   bool getSymbol(const char *symbol, void *, std::string ) const;
diff --git a/include/proxy/http/remap/PluginFactory.h 
b/include/proxy/http/remap/PluginFactory.h
index 5a63a13f41..1ebcadd81e 100644
--- a/include/proxy/http/remap/PluginFactory.h
+++ b/include/proxy/http/remap/PluginFactory.h
@@ -95,6 +95,7 @@ public:
   virtual ~PluginFactory();
 
   PluginFactory (const fs::path );
+  PluginFactory (const fs::path );
   PluginFactory (const fs::path );
 
   RemapPluginInst *getRemapPlugin(const fs::path , int argc, char 
**argv, std::string , bool dynamicReloadEnabled);
@@ -112,6 +113,7 @@ protected:
 
   std::vector _searchDirs; /** @brief ordered list of search paths 
where we look for plugins */
   fs::path _runtimeDir;  /** @brief the path where we would create 
a temporary copies of the plugins to load */
+  fs::path _compilerPath;/** @brief the compilation script to use 
for cripts and other non-DSO plugins */
 
   PluginInstList _instList;
 
diff --git a/include/proxy/http/remap/RemapPluginInfo.h 
b/include/proxy/http/remap/RemapPluginInfo.h
index dda7695ce6..73a91643f0 100644
--- a/include/proxy/http/remap/RemapPluginInfo.h
+++ b/include/proxy/http/remap/RemapPluginInfo.h
@@ -83,7 +83,7 @@ public:
   ~RemapPluginInfo();
 
   /* Overload to add / execute remap plugin specific tasks during the plugin 
loading */
-  bool load(std::string ) override;
+  bool load(std::string , const fs::path ) override;
 
   /* Used by the factory to invoke callbacks during plugin load, init and 
unload  */
   bool init(std::string ) override;
diff --git a/src/proxy/http/remap/PluginDso.cc 
b/src/proxy/http/remap/PluginDso.cc
index 9da092a790..4f59167164 100644
--- a/src/proxy/http/remap/PluginDso.cc
+++ b/src/proxy/http/remap/PluginDso.cc
@@ -38,6 +38,8 @@
 #define PluginError Error
 #endif
 
+#include 
+
 namespace
 {
 
@@ -69,7 +71,7 @@ PluginDso::~PluginDso()
 }
 
 bool

(trafficserver) 04/11: AuTest: Make ja3_fingerprint test stable (#11230)

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

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

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

AuTest: Make ja3_fingerprint test stable (#11230)

(cherry picked from commit b4c6b8bafa272b727098cfc091070b9180ad7d51)
---
 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) 03/11: Terminate H2 connection by COMPRESSION_ERROR (#11222)

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

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

commit 6c9143f51de90740e0ec1c7fe352e5c482b08614
Author: Masaori Koshiba 
AuthorDate: Fri Apr 12 08:16:09 2024 +0900

Terminate H2 connection by COMPRESSION_ERROR (#11222)

(cherry picked from commit 14d5b2ce401446a13b2fef4ab8dbc7cf890acf25)
---
 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) 08/11: CID 1374999: plugin stale_response, delete pointer on early exit. (#11248)

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

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

commit b6df6de977596bab788439f14861ffafff0daac0
Author: Damian Meden 
AuthorDate: Mon Apr 15 14:16:00 2024 +0200

CID 1374999: plugin stale_response, delete pointer on early exit. (#11248)

(cherry picked from commit 10e01239e9c6ef5b969de65b9256d55b83fb497f)
---
 plugins/experimental/stale_response/stale_response.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/plugins/experimental/stale_response/stale_response.cc 
b/plugins/experimental/stale_response/stale_response.cc
index a4c81649d4..bb1d1dfff6 100644
--- a/plugins/experimental/stale_response/stale_response.cc
+++ b/plugins/experimental/stale_response/stale_response.cc
@@ -1068,6 +1068,7 @@ TSPluginInit(int argc, const char *argv[])
   // proxy.config.http.insert_age_in_response
   if (TS_SUCCESS != TSUserArgIndexReserve(TS_USER_ARGS_TXN, PLUGIN_TAG, 
"reserve state info slot", &(plugin_config->txn_slot))) {
 TSError("stale_response [%s] failed to user argument data. Plugin 
registration failed.", PLUGIN_TAG);
+delete plugin_config;
 return;
   }
   TSCont main_contp = TSContCreate(global_request_header_hook, nullptr);



(trafficserver) 11/11: Fixes the HRW regexes after refactoring in #11152 (#11250)

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

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

commit 4c8fd0c0055214d29d7bfc927d95c1eddba42e02
Author: Leif Hedstrom 
AuthorDate: Fri Apr 12 16:16:14 2024 -0600

Fixes the HRW regexes after refactoring in #11152 (#11250)

(cherry picked from commit dfbea61df5cba3b63658c522d67e52080874691a)
---
 plugins/header_rewrite/matcher.h | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/plugins/header_rewrite/matcher.h b/plugins/header_rewrite/matcher.h
index fb56a29df6..f094ede33e 100644
--- a/plugins/header_rewrite/matcher.h
+++ b/plugins/header_rewrite/matcher.h
@@ -85,7 +85,7 @@ public:
   get() const
   {
 return _data;
-  };
+  }
 
   void
   set(const T , CondModifiers mods)
@@ -205,6 +205,10 @@ private:
   bool _nocase = false;
 };
 
+// Specializations for the strings, since they can be both strings and regexes
+template <> void Matchers::set(const std::string , 
CondModifiers mods);
+template <> bool Matchers::test_eq(const std::string ) const;
+
 // Specialized case matcher for the IP addresses matches.
 template <> class Matchers : public Matcher
 {



(trafficserver) 01/11: Fixed asan leak issues with RegexContext (#11184)

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

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

commit d5a6d4333b7644336a64d7e50cd6630e03916c05
Author: Bryan Call 
AuthorDate: Thu Apr 11 15:29:56 2024 -0700

Fixed asan leak issues with RegexContext (#11184)

(cherry picked from commit a39b8f112dc977e0f2d41daa3dc42d2fe5b7cd05)
---
 src/tsutil/DbgCtl.cc | 16 -
 src/tsutil/Regex.cc  | 66 +---
 2 files changed, 72 insertions(+), 10 deletions(-)

diff --git a/src/tsutil/DbgCtl.cc b/src/tsutil/DbgCtl.cc
index da17985893..18112318f2 100644
--- a/src/tsutil/DbgCtl.cc
+++ b/src/tsutil/DbgCtl.cc
@@ -150,7 +150,7 @@ DbgCtl::_new_reference(char const *tag)
   DebugInterface *p = DebugInterface::get_instance();
   debug_assert(tag != nullptr);
 
-  // DbgCtl instances may be declared as static objects in the destructors of 
objects not destoyed till program exit.
+  // DbgCtl instances may be declared as static objects in the destructors of 
objects not destroyed till program exit.
   // So, we must handle the case where the construction of such instances of 
DbgCtl overlaps with the destruction of
   // other instances of DbgCtl.  That is why it is important to make sure the 
reference count is non-zero before
   // constructing _RegistryAccessor.  The _RegistryAccessor constructor is 
thereby able to assume that, if it creates
@@ -158,6 +158,20 @@ DbgCtl::_new_reference(char const *tag)
 
   ++_RegistryAccessor::registry_reference_count;
 
+  // There is a mutex in the C/C++ runtime that both dlopen() and 
_cxa_thread_atexit() lock while running.
+  // Creating a _RegistryAccessor instance locks the registry mutex.  If the 
subsequent code in this function triggers
+  // the construction of a thread_local variable (with a non-trivial 
destructor), the following deadlock scenario is
+  // possible:
+  // 1.  Thread 1 calls a DbgCtl constructor, which locks the registry mutex, 
but then is suspended.
+  // 2.  Thread 2 calls dlopen() for a plugin, locking the runtime mutex.  It 
then executes the constructor for a
+  // statically allocated DbgCtl object, which blocks on locking the 
registry mutex.
+  // 3.  Thread 1 resumes, and calls member functions of the derived class of 
DebugInterface.  If this causes the
+  // the construction of a thread_local variable with a non-trivial 
destructor, _cxa_thread_atexit() will be called
+  // to set up a call of the variable's destructor at thread exit.  The 
call to _cxa_thread_atexit() will block on
+  // the runtime mutex (held by Thread 2).  So Thread 1 holds the registry 
mutex and is blocked waiting for the
+  // runtime mutex.  And Thread 2 holds the runtime mutex and is blocked 
waiting for the registry mutex.  Deadlock.
+  //
+  // This deadlock is avoided by having the thread_local variable register its 
destruction in a non-thread_local class.
   _RegistryAccessor ra;
 
   auto {ra.data()};
diff --git a/src/tsutil/Regex.cc b/src/tsutil/Regex.cc
index faea3b8546..37e4b4337b 100644
--- a/src/tsutil/Regex.cc
+++ b/src/tsutil/Regex.cc
@@ -25,6 +25,8 @@
 
 #include 
 #include 
+#include 
+#include 
 
 //
 namespace
@@ -41,7 +43,19 @@ my_free(void *ptr, void * /*caller*/)
 {
   free(ptr);
 }
-} // namespace
+
+class RegexContext; // defined below
+class RegexContextCleanup
+{
+public:
+  void push_back(RegexContext *ctx);
+  ~RegexContextCleanup();
+
+private:
+  std::vector _contexts;
+  std::mutex _mutex;
+};
+RegexContextCleanup regex_context_cleanup;
 
 //
 class RegexContext
@@ -50,13 +64,20 @@ public:
   static RegexContext *
   get_instance()
   {
-if (!_regex_context) {
+if (_shutdown == true) {
+  return nullptr;
+}
+
+if (_regex_context == nullptr) {
   _regex_context = new RegexContext();
+  regex_context_cleanup.push_back(_regex_context);
 }
 return _regex_context;
   }
   ~RegexContext()
   {
+_shutdown = true;
+
 if (_general_context != nullptr) {
   pcre2_general_context_free(_general_context);
 }
@@ -100,17 +121,28 @@ private:
   pcre2_match_context *_match_context = nullptr;
   pcre2_jit_stack *_jit_stack = nullptr;
   thread_local static RegexContext *_regex_context;
+  static bool _shutdown; // flag to indicate destructor was called, so no new 
instances can be created
 };
 
 thread_local RegexContext *RegexContext::_regex_context = nullptr;
+bool RegexContext::_shutdown= false;
 
 //
-namespace
+
+RegexContextCleanup::~RegexContextCleanup()
 {
-struct RegexContextCleanup {
-  ~RegexContextCleanup() { delete RegexContext::get_instance(); }
-};
-thread_local 

(trafficserver) 10/11: Avoid including pcre2.h in Regex.h. (#11246)

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

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

commit ed2b5731a0fce52046dbaf7d6216ee2991af496b
Author: Walt Karas 
AuthorDate: Mon Apr 15 10:58:32 2024 -0400

Avoid including pcre2.h in Regex.h. (#11246)

(cherry picked from commit 08506ef708b9bb05c6254be1a521f7d60f12e1cf)
---
 include/tsutil/Regex.h |  46 
 src/tsutil/Regex.cc| 115 +++--
 2 files changed, 93 insertions(+), 68 deletions(-)

diff --git a/include/tsutil/Regex.h b/include/tsutil/Regex.h
index c4ca8feb03..44e10d53b2 100644
--- a/include/tsutil/Regex.h
+++ b/include/tsutil/Regex.h
@@ -28,14 +28,14 @@
 #include 
 #include 
 
-#define PCRE2_CODE_UNIT_WIDTH 8
-#include 
-
 /// @brief Match flags for regular expression evaluation.
+///
+/// @internal These values are copied from pcre2.h, to avoid having to include 
it.  The values are checked (with
+/// static_assert) in Regex.cc against PCRE2 named constants, in case they 
change in future PCRE2 releases.
 enum REFlags {
-  RE_CASE_INSENSITIVE = PCRE2_CASELESS,  ///< Ignore case (default: case 
sensitive).
-  RE_UNANCHORED   = PCRE2_MULTILINE, ///< Unanchored (DFA defaults to 
anchored).
-  RE_ANCHORED = PCRE2_ANCHORED,  ///< Anchored (Regex defaults to 
unanchored).
+  RE_CASE_INSENSITIVE = 0x0008u, ///< Ignore case (default: case 
sensitive).
+  RE_UNANCHORED   = 0x0400u, ///< Unanchored (DFA defaults to 
anchored).
+  RE_ANCHORED = 0x8000u, ///< Anchored (Regex defaults to 
unanchored).
 };
 
 /// @brief Wrapper for PCRE2 match data.
@@ -63,19 +63,25 @@ public:
   size_t *get_ovector_pointer();
   int32_t size() const;
 
-protected:
-  pcre2_match_data *get_match_data();
-  void set_subject(std::string_view subject);
-  void set_size(int32_t size);
-
 private:
   constexpr static uint32_t DEFAULT_MATCHES = 10;
   static void *malloc(size_t size, void *caller);
-  pcre2_match_data *_match_data = nullptr;
   std::string_view _subject;
   char _buffer[24 + 96 + 16 * DEFAULT_MATCHES]; // 24 bytes for the general 
context, 96 bytes overhead, 16 bytes per match.
   size_t _buffer_bytes_used = 0;
   int32_t _size = 0;
+
+  /// @internal This effectively wraps a void* so that we can avoid requiring 
the pcre2.h include for the user of the Regex
+  /// API (see Regex.cc).
+  struct _MatchData;
+  class _MatchDataPtr
+  {
+friend struct _MatchData;
+
+  private:
+void *_ptr = nullptr;
+  };
+  _MatchDataPtr _match_data;
 };
 
 /// @brief Wrapper for PCRE2 regular expression.
@@ -135,11 +141,17 @@ public:
   int get_capture_count();
 
 private:
-  // @internal - Because the PCRE header is badly done, we can't forward 
declare the PCRE
-  // enough to use as pointers. For some reason the header defines in name 
only a struct and
-  // then aliases it to the standard name, rather than simply declare the 
latter in name only.
-  // The goal is completely wrap PCRE and not include that header in client 
code.
-  pcre2_code *_code = nullptr;
+  /// @internal This effectively wraps a void* so that we can avoid requiring 
the pcre2.h include for the user of the Regex
+  /// API (see Regex.cc).
+  struct _Code;
+  class _CodePtr
+  {
+friend struct _Code;
+
+  private:
+void *_ptr = nullptr;
+  };
+  _CodePtr _code;
 };
 
 /** Deterministic Finite state Automata container.
diff --git a/src/tsutil/Regex.cc b/src/tsutil/Regex.cc
index 37e4b4337b..fb2cddbb2e 100644
--- a/src/tsutil/Regex.cc
+++ b/src/tsutil/Regex.cc
@@ -23,11 +23,18 @@
 
 #include "tsutil/Regex.h"
 
+#define PCRE2_CODE_UNIT_WIDTH 8
+#include 
+
 #include 
 #include 
 #include 
 #include 
 
+static_assert(RE_CASE_INSENSITIVE == PCRE2_CASELESS, "Update 
RE_CASE_INSERSITIVE for current PCRE2 version.");
+static_assert(RE_UNANCHORED == PCRE2_MULTILINE, "Update RE_MULTILINE for 
current PCRE2 version.");
+static_assert(RE_ANCHORED == PCRE2_ANCHORED, "Update RE_ANCHORED for current 
PCRE2 version.");
+
 //
 namespace
 {
@@ -145,13 +152,27 @@ RegexContextCleanup::push_back(RegexContext *ctx)
 
 } // namespace
 
+//
+struct RegexMatches::_MatchData {
+  static pcre2_match_data *
+  get(_MatchDataPtr const )
+  {
+return static_cast(p._ptr);
+  }
+  static void
+  set(_MatchDataPtr , pcre2_match_data *ptr)
+  {
+p._ptr = ptr;
+  }
+};
+
 //
 RegexMatches::RegexMatches(uint32_t size)
 {
   pcre2_general_context *ctx = pcre2_general_context_create(
 ::malloc, [](void *, void *) -> void {}, static_cast(this));
 
-  _match_data = pcre2_match_data_create(size, ctx);
+  _MatchData::set(_match_data, pcre2_match_data_create(size, ctx));
 }
 
 

(trafficserver) 09/11: CID 1534744: txn_box: Move config object insetad of copy. (#11249)

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

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

commit dbcf2fe9dafc348a08f5cd3b0841ae7b4cfeca56
Author: Damian Meden 
AuthorDate: Mon Apr 15 10:04:02 2024 +0200

CID 1534744: txn_box: Move config object insetad of copy. (#11249)

(cherry picked from commit b83c795e52b3643e235861530a2c470ec0bc05d7)
---
 plugins/experimental/txn_box/plugin/src/txn_box_remap.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/experimental/txn_box/plugin/src/txn_box_remap.cc 
b/plugins/experimental/txn_box/plugin/src/txn_box_remap.cc
index f3747adf52..b866c5e6ab 100644
--- a/plugins/experimental/txn_box/plugin/src/txn_box_remap.cc
+++ b/plugins/experimental/txn_box/plugin/src/txn_box_remap.cc
@@ -112,7 +112,7 @@ TSRemapNewInstance(int argc, char *argv[], void **ih, char 
*errbuff, int errbuff
   }
 
   G._remap_ctx_storage_required += cfg->reserved_ctx_storage_size();
-  *ih= new RemapContext{cfg};
+  *ih= new RemapContext{std::move(cfg)};
   return TS_SUCCESS;
 }
 



(trafficserver) 06/11: Fix asan leak errors for cachevol test (#11239)

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

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

commit cef3cbc62c1d7302be4a0fb647480aac1c8f8e23
Author: Chris McFarlen 
AuthorDate: Fri Apr 12 14:54:22 2024 -0500

Fix asan leak errors for cachevol test (#11239)

* Fix asan leak errors for cachevol test

* uneeded

(cherry picked from commit 7cc8e3a0e84c54ae209003ea52d904f32df3b6e6)
---
 src/iocore/cache/unit_tests/test_CacheVol.cc | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/iocore/cache/unit_tests/test_CacheVol.cc 
b/src/iocore/cache/unit_tests/test_CacheVol.cc
index 3bed1afada..eafcbc3062 100644
--- a/src/iocore/cache/unit_tests/test_CacheVol.cc
+++ b/src/iocore/cache/unit_tests/test_CacheVol.cc
@@ -323,6 +323,10 @@ ClearCacheVolList(Queue *cpl, int len)
   int i= 0;
   CacheVol *cp = nullptr;
   while ((cp = cpl->dequeue())) {
+for (int d_no = 0; d_no < gndisks; d_no++) {
+  cp->disk_stripes[d_no]->disk->delete_volume(cp->vol_number);
+  cp->disk_stripes[d_no] = nullptr;
+}
 ats_free(cp->disk_stripes);
 ats_free(cp->stripes);
 delete (cp);
@@ -365,6 +369,8 @@ public:
   cache_init_success_callback(int event, void *e) override
   {
 // Test
+ClearCacheVolList(_list, cp_list_len);
+
 save_state();
 srand48(time(nullptr));
 
@@ -393,6 +399,5 @@ TEST_CASE("CacheVol")
 
   this_ethread()->schedule_imm(init);
   this_thread()->execute();
-
   return;
 }



(trafficserver) 07/11: HttpSM::tunnel_handler: Handle WRITE events (#11242)

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

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

commit ffe023a57921d3f0902e271f2860193bcc26d08f
Author: Brian Neradt 
AuthorDate: Thu Apr 11 20:01:06 2024 -0500

HttpSM::tunnel_handler: Handle WRITE events (#11242)

Multiple HttpSM handlers have logic to handle write events after an EOS
is sent. This applies that logic to the HttpSM::tunnel_handler as well,
avoiding an unneccesary assertion.

Fixes: #10681
(cherry picked from commit ed29bf7bed9e62f75bdc088a58a845a5b9689a2b)
---
 src/proxy/http/HttpSM.cc | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/proxy/http/HttpSM.cc b/src/proxy/http/HttpSM.cc
index d268d74db9..bc688d009f 100644
--- a/src/proxy/http/HttpSM.cc
+++ b/src/proxy/http/HttpSM.cc
@@ -2969,6 +2969,12 @@ HttpSM::tunnel_handler(int event, void *data)
 {
   STATE_ENTER(::tunnel_handler, event);
 
+  // If we had already received EOS, just go away. We would sometimes see
+  // a WRITE event appear after receiving EOS from the server connection
+  if ((event == VC_EVENT_WRITE_READY || event == VC_EVENT_WRITE_COMPLETE) && 
server_entry->eos) {
+return 0;
+  }
+
   ink_assert(event == HTTP_TUNNEL_EVENT_DONE || event == 
VC_EVENT_INACTIVITY_TIMEOUT);
   // The tunnel calls this when it is done
   terminate_sm = true;



(trafficserver) 05/11: header_rewrite: add debug to accompany parse_line errors (#11238)

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

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

commit 163fbc55a73fe8e612b7ace3cbae42e230a1a616
Author: Brian Olsen 
AuthorDate: Thu Apr 11 16:03:35 2024 -0600

header_rewrite: add debug to accompany parse_line errors (#11238)

(cherry picked from commit 1feaba123536c14a462a507d12fbd95f3a26f8e4)
---
 plugins/header_rewrite/header_rewrite.cc | 7 ++-
 plugins/header_rewrite/value.cc  | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/plugins/header_rewrite/header_rewrite.cc 
b/plugins/header_rewrite/header_rewrite.cc
index b6999b3b68..60a1f72f29 100644
--- a/plugins/header_rewrite/header_rewrite.cc
+++ b/plugins/header_rewrite/header_rewrite.cc
@@ -180,7 +180,12 @@ RulesConfig::parse_config(const std::string , 
TSHttpHookID default_hook)
 Parser p;
 
 // Tokenize and parse this line
-if (!p.parse_line(line) || p.empty()) {
+if (!p.parse_line(line)) {
+  Dbg(dbg_ctl, "Error parsing line '%s'", line.c_str());
+  continue;
+}
+
+if (p.empty()) {
   continue;
 }
 
diff --git a/plugins/header_rewrite/value.cc b/plugins/header_rewrite/value.cc
index 9256565a9d..d5d8f5727a 100644
--- a/plugins/header_rewrite/value.cc
+++ b/plugins/header_rewrite/value.cc
@@ -60,6 +60,7 @@ Value::set_value(const std::string )
 tcond_val->initialize(parser);
   } else {
 // TODO: should we produce error here?
+Dbg(dbg_ctl, "Error parsing value '%s'", _value.c_str());
   }
 }
   } else {



(trafficserver) branch master updated: Avoid including pcre2.h in Regex.h. (#11246)

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

wkaras 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 08506ef708 Avoid including pcre2.h in Regex.h. (#11246)
08506ef708 is described below

commit 08506ef708b9bb05c6254be1a521f7d60f12e1cf
Author: Walt Karas 
AuthorDate: Mon Apr 15 10:58:32 2024 -0400

Avoid including pcre2.h in Regex.h. (#11246)
---
 include/tsutil/Regex.h |  46 
 src/tsutil/Regex.cc| 115 +++--
 2 files changed, 93 insertions(+), 68 deletions(-)

diff --git a/include/tsutil/Regex.h b/include/tsutil/Regex.h
index c4ca8feb03..44e10d53b2 100644
--- a/include/tsutil/Regex.h
+++ b/include/tsutil/Regex.h
@@ -28,14 +28,14 @@
 #include 
 #include 
 
-#define PCRE2_CODE_UNIT_WIDTH 8
-#include 
-
 /// @brief Match flags for regular expression evaluation.
+///
+/// @internal These values are copied from pcre2.h, to avoid having to include 
it.  The values are checked (with
+/// static_assert) in Regex.cc against PCRE2 named constants, in case they 
change in future PCRE2 releases.
 enum REFlags {
-  RE_CASE_INSENSITIVE = PCRE2_CASELESS,  ///< Ignore case (default: case 
sensitive).
-  RE_UNANCHORED   = PCRE2_MULTILINE, ///< Unanchored (DFA defaults to 
anchored).
-  RE_ANCHORED = PCRE2_ANCHORED,  ///< Anchored (Regex defaults to 
unanchored).
+  RE_CASE_INSENSITIVE = 0x0008u, ///< Ignore case (default: case 
sensitive).
+  RE_UNANCHORED   = 0x0400u, ///< Unanchored (DFA defaults to 
anchored).
+  RE_ANCHORED = 0x8000u, ///< Anchored (Regex defaults to 
unanchored).
 };
 
 /// @brief Wrapper for PCRE2 match data.
@@ -63,19 +63,25 @@ public:
   size_t *get_ovector_pointer();
   int32_t size() const;
 
-protected:
-  pcre2_match_data *get_match_data();
-  void set_subject(std::string_view subject);
-  void set_size(int32_t size);
-
 private:
   constexpr static uint32_t DEFAULT_MATCHES = 10;
   static void *malloc(size_t size, void *caller);
-  pcre2_match_data *_match_data = nullptr;
   std::string_view _subject;
   char _buffer[24 + 96 + 16 * DEFAULT_MATCHES]; // 24 bytes for the general 
context, 96 bytes overhead, 16 bytes per match.
   size_t _buffer_bytes_used = 0;
   int32_t _size = 0;
+
+  /// @internal This effectively wraps a void* so that we can avoid requiring 
the pcre2.h include for the user of the Regex
+  /// API (see Regex.cc).
+  struct _MatchData;
+  class _MatchDataPtr
+  {
+friend struct _MatchData;
+
+  private:
+void *_ptr = nullptr;
+  };
+  _MatchDataPtr _match_data;
 };
 
 /// @brief Wrapper for PCRE2 regular expression.
@@ -135,11 +141,17 @@ public:
   int get_capture_count();
 
 private:
-  // @internal - Because the PCRE header is badly done, we can't forward 
declare the PCRE
-  // enough to use as pointers. For some reason the header defines in name 
only a struct and
-  // then aliases it to the standard name, rather than simply declare the 
latter in name only.
-  // The goal is completely wrap PCRE and not include that header in client 
code.
-  pcre2_code *_code = nullptr;
+  /// @internal This effectively wraps a void* so that we can avoid requiring 
the pcre2.h include for the user of the Regex
+  /// API (see Regex.cc).
+  struct _Code;
+  class _CodePtr
+  {
+friend struct _Code;
+
+  private:
+void *_ptr = nullptr;
+  };
+  _CodePtr _code;
 };
 
 /** Deterministic Finite state Automata container.
diff --git a/src/tsutil/Regex.cc b/src/tsutil/Regex.cc
index 37e4b4337b..fb2cddbb2e 100644
--- a/src/tsutil/Regex.cc
+++ b/src/tsutil/Regex.cc
@@ -23,11 +23,18 @@
 
 #include "tsutil/Regex.h"
 
+#define PCRE2_CODE_UNIT_WIDTH 8
+#include 
+
 #include 
 #include 
 #include 
 #include 
 
+static_assert(RE_CASE_INSENSITIVE == PCRE2_CASELESS, "Update 
RE_CASE_INSERSITIVE for current PCRE2 version.");
+static_assert(RE_UNANCHORED == PCRE2_MULTILINE, "Update RE_MULTILINE for 
current PCRE2 version.");
+static_assert(RE_ANCHORED == PCRE2_ANCHORED, "Update RE_ANCHORED for current 
PCRE2 version.");
+
 //
 namespace
 {
@@ -145,13 +152,27 @@ RegexContextCleanup::push_back(RegexContext *ctx)
 
 } // namespace
 
+//
+struct RegexMatches::_MatchData {
+  static pcre2_match_data *
+  get(_MatchDataPtr const )
+  {
+return static_cast(p._ptr);
+  }
+  static void
+  set(_MatchDataPtr , pcre2_match_data *ptr)
+  {
+p._ptr = ptr;
+  }
+};
+
 //
 RegexMatches::RegexMatches(uint32_t size)
 {
   pcre2_general_context *ctx = pcre2_general_context_create(
 ::malloc, [](void *, void *) -> void {}, static_cast(this));
 
-  _match_data = pcre2_match_data_create(size, ctx);
+  

(trafficserver) branch master updated: CID 1374999: plugin stale_response, delete pointer on early exit. (#11248)

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

dmeden 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 10e01239e9 CID 1374999: plugin stale_response, delete pointer on early 
exit. (#11248)
10e01239e9 is described below

commit 10e01239e9c6ef5b969de65b9256d55b83fb497f
Author: Damian Meden 
AuthorDate: Mon Apr 15 14:16:00 2024 +0200

CID 1374999: plugin stale_response, delete pointer on early exit. (#11248)
---
 plugins/experimental/stale_response/stale_response.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/plugins/experimental/stale_response/stale_response.cc 
b/plugins/experimental/stale_response/stale_response.cc
index a4c81649d4..bb1d1dfff6 100644
--- a/plugins/experimental/stale_response/stale_response.cc
+++ b/plugins/experimental/stale_response/stale_response.cc
@@ -1068,6 +1068,7 @@ TSPluginInit(int argc, const char *argv[])
   // proxy.config.http.insert_age_in_response
   if (TS_SUCCESS != TSUserArgIndexReserve(TS_USER_ARGS_TXN, PLUGIN_TAG, 
"reserve state info slot", &(plugin_config->txn_slot))) {
 TSError("stale_response [%s] failed to user argument data. Plugin 
registration failed.", PLUGIN_TAG);
+delete plugin_config;
 return;
   }
   TSCont main_contp = TSContCreate(global_request_header_hook, nullptr);



(trafficserver) branch master updated: CID 1534744: txn_box: Move config object insetad of copy. (#11249)

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

dmeden 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 b83c795e52 CID 1534744: txn_box: Move config object insetad of copy. 
(#11249)
b83c795e52 is described below

commit b83c795e52b3643e235861530a2c470ec0bc05d7
Author: Damian Meden 
AuthorDate: Mon Apr 15 10:04:02 2024 +0200

CID 1534744: txn_box: Move config object insetad of copy. (#11249)
---
 plugins/experimental/txn_box/plugin/src/txn_box_remap.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/experimental/txn_box/plugin/src/txn_box_remap.cc 
b/plugins/experimental/txn_box/plugin/src/txn_box_remap.cc
index f3747adf52..b866c5e6ab 100644
--- a/plugins/experimental/txn_box/plugin/src/txn_box_remap.cc
+++ b/plugins/experimental/txn_box/plugin/src/txn_box_remap.cc
@@ -112,7 +112,7 @@ TSRemapNewInstance(int argc, char *argv[], void **ih, char 
*errbuff, int errbuff
   }
 
   G._remap_ctx_storage_required += cfg->reserved_ctx_storage_size();
-  *ih= new RemapContext{cfg};
+  *ih= new RemapContext{std::move(cfg)};
   return TS_SUCCESS;
 }