You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by cm...@apache.org on 2025/03/22 12:19:32 UTC
(trafficserver) branch 10.1.x updated (42f2920bce -> 07f66ad001)
This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a change to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
from 42f2920bce Move defaulting install prefix before layout setup (#12085)
new a5c4dcfb3b Fix typo on header_rewrite documentation (#12109)
new 788a5a2744 Tools: records 2 yaml script. Make sure the script removes temporary (#12101)
new 0af6fd2d45 Slice plugin support UDS path (#12096)
new 07f66ad001 Error::Status can now take optional reason (#12098)
The 4 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/plugins/header_rewrite.en.rst | 2 +-
doc/developer-guide/cripts/cripts-misc.en.rst | 10 ++++++++--
include/cripts/Context.hpp | 2 +-
include/cripts/Error.hpp | 6 +++---
plugins/slice/slice.cc | 3 +++
src/api/InkAPI.cc | 4 ++--
src/cripts/Error.cc | 7 ++++++-
tools/records/convert2yaml.py | 12 ++++++++++--
8 files changed, 34 insertions(+), 12 deletions(-)
(trafficserver) 03/04: Slice plugin support UDS path (#12096)
Posted by cm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 0af6fd2d45d3a9ca542fd6e38c966b6ee6ff1f9f
Author: Serris Lew <se...@gmail.com>
AuthorDate: Tue Mar 18 11:37:54 2025 -0700
Slice plugin support UDS path (#12096)
Co-authored-by: Serris Lew <ls...@apple.com>
(cherry picked from commit 43b8323946016a2be73fbedfe5fc08b156bafa15)
---
plugins/slice/slice.cc | 3 +++
src/api/InkAPI.cc | 4 ++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/plugins/slice/slice.cc b/plugins/slice/slice.cc
index 515a0ed81d..9be1a8b729 100644
--- a/plugins/slice/slice.cc
+++ b/plugins/slice/slice.cc
@@ -31,6 +31,7 @@
#include <netinet/in.h>
#include <array>
#include <string_view>
+#include <sys/un.h>
namespace
{
@@ -111,6 +112,8 @@ read_request(TSHttpTxn txnp, Config *const config, TSCont read_resp_hdr_contp)
memcpy(&data->m_client_ip, ip, sizeof(sockaddr_in));
} else if (AF_INET6 == ip->sa_family) {
memcpy(&data->m_client_ip, ip, sizeof(sockaddr_in6));
+ } else if (AF_UNIX == ip->sa_family) {
+ memcpy(&data->m_client_ip, ip, sizeof(sockaddr_un));
} else {
return false;
}
diff --git a/src/api/InkAPI.cc b/src/api/InkAPI.cc
index f8318729a7..17da050fca 100644
--- a/src/api/InkAPI.cc
+++ b/src/api/InkAPI.cc
@@ -5596,8 +5596,8 @@ TSHttpConnectPlugin(TSHttpConnectOptions *options)
sdk_assert(options->connect_type == TS_CONNECT_PLUGIN);
sdk_assert(options->addr);
- sdk_assert(ats_is_ip(options->addr));
- sdk_assert(ats_ip_port_cast(options->addr));
+ sdk_assert(ats_is_unix(options->addr) || ats_is_ip(options->addr));
+ sdk_assert(ats_is_unix(options->addr) || ats_ip_port_cast(options->addr));
return reinterpret_cast<TSVConn>(PluginHttpConnectInternal(options));
}
(trafficserver) 04/04: Error::Status can now take optional reason (#12098)
Posted by cm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 07f66ad00141a96496ca0226c4ebda2e1ecc3112
Author: Leif Hedstrom <zw...@apache.org>
AuthorDate: Mon Mar 17 16:34:44 2025 -0600
Error::Status can now take optional reason (#12098)
(cherry picked from commit e91c07d13be7ae3c9d16ad36f7ff5019a3a497cd)
---
doc/developer-guide/cripts/cripts-misc.en.rst | 10 ++++++++--
include/cripts/Context.hpp | 2 +-
include/cripts/Error.hpp | 6 +++---
src/cripts/Error.cc | 7 ++++++-
4 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/doc/developer-guide/cripts/cripts-misc.en.rst b/doc/developer-guide/cripts/cripts-misc.en.rst
index a3e64f73c0..698be215a5 100644
--- a/doc/developer-guide/cripts/cripts-misc.en.rst
+++ b/doc/developer-guide/cripts/cripts-misc.en.rst
@@ -36,8 +36,8 @@ Errors
======
Often it's useful to be able to abort a client transaction prematurely, and
-return an error to the client. Cripts provid
-making this easy.
+return an error to the client. Cripts provides a simple way to do this, using
+the ``cripts::Error`` object.
.. note::
Explicitly forcing an HTTP error overrides any other response status that may have been set.
@@ -68,6 +68,12 @@ Example:
}
}
+The `Status` and `Reason` can optionally be set in one single call to the status setter:
+
+.. code-block:: cpp
+
+ cripts::Error::Status::Set(403, "Go Away");
+
.. _cripts-misc-transaction:
ATS transactions are generally hidden within Cripts, but for power users, the
diff --git a/include/cripts/Context.hpp b/include/cripts/Context.hpp
index 6e1520e283..e3592aefe2 100644
--- a/include/cripts/Context.hpp
+++ b/include/cripts/Context.hpp
@@ -102,7 +102,7 @@ private:
// This may be weird, but oh well for now.
#define Get() _get(context)
-#define Set(_value) _set(context, _value)
+#define Set(_value, ...) _set(context, _value __VA_OPT__(, ) __VA_ARGS__)
#define Update() _update(context)
#define RunRemap() _runRemap(context)
#define Activate() _activate(context->p_instance)
diff --git a/include/cripts/Error.hpp b/include/cripts/Error.hpp
index d1aefea9a4..da674abe60 100644
--- a/include/cripts/Error.hpp
+++ b/include/cripts/Error.hpp
@@ -71,12 +71,12 @@ public:
Status(const self_type &) = delete;
void operator=(const self_type &) = delete;
- static void _set(cripts::Context *context, TSHttpStatus status);
+ static void _set(cripts::Context *context, TSHttpStatus status, const cripts::string_view msg = {});
static void
- _set(cripts::Context *context, int status)
+ _set(cripts::Context *context, int status, const cripts::string_view msg = {})
{
- _set(context, static_cast<TSHttpStatus>(status));
+ _set(context, static_cast<TSHttpStatus>(status), msg);
}
static TSHttpStatus _get(cripts::Context *context);
diff --git a/src/cripts/Error.cc b/src/cripts/Error.cc
index b1076d6f82..606c05cbbd 100644
--- a/src/cripts/Error.cc
+++ b/src/cripts/Error.cc
@@ -44,12 +44,17 @@ Error::Reason::_set(cripts::Context *context, const cripts::string_view msg)
context->state.error._reason._setter(msg);
}
+// For convenience, an optional Reason message can also be specified with the status
void
-Error::Status::_set(cripts::Context *context, TSHttpStatus status)
+Error::Status::_set(cripts::Context *context, TSHttpStatus status, const cripts::string_view msg)
{
context->state.error.Fail();
context->state.error._status._setter(status);
+ if (msg.size() > 0) {
+ context->state.error._reason._setter(msg);
+ }
+
if (context->state.error.Redirected() || status == TS_HTTP_STATUS_MOVED_PERMANENTLY ||
status == TS_HTTP_STATUS_MOVED_TEMPORARILY || status == TS_HTTP_STATUS_TEMPORARY_REDIRECT ||
status == TS_HTTP_STATUS_PERMANENT_REDIRECT) {
(trafficserver) 02/04: Tools: records 2 yaml script. Make sure the script removes temporary (#12101)
Posted by cm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 788a5a27440e6cb2b82cb00056f43a81cad6e671
Author: Damian Meden <dm...@apache.org>
AuthorDate: Tue Mar 18 10:11:17 2025 +0100
Tools: records 2 yaml script. Make sure the script removes temporary (#12101)
file used for the yaml generation.
(cherry picked from commit 1423664f43d6f763bf87d493b6c1251b1b20dbcd)
---
tools/records/convert2yaml.py | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/tools/records/convert2yaml.py b/tools/records/convert2yaml.py
index 46d2975b3e..0b425f3083 100755
--- a/tools/records/convert2yaml.py
+++ b/tools/records/convert2yaml.py
@@ -219,7 +219,7 @@ def add_object(config, var, value, type, track_info):
add_object(config[key], var[index + 1:], value, type, track_info)
-def fix_record_names(file):
+def make_tmp_file_with_renamed_fields(file):
temp = tempfile.NamedTemporaryFile(prefix='records.config_', delete=False)
for l in fileinput.input(files=file):
@@ -232,6 +232,7 @@ def fix_record_names(file):
rec_line = ' '.join(elements)
temp.write(rec_line.encode('utf-8'))
temp.write(b'\n')
+ # Store the record to keep track of the renamed fields.
Remapped_Vars[rec_name] = Renamed_Records[rec_name]
continue
@@ -246,7 +247,7 @@ def handle_file_input(args):
config = {}
# Fix the names first.
- filename = fix_record_names(args.file)
+ filename = make_tmp_file_with_renamed_fields(args.file)
with open(filename, "r+") as f:
lines = f.readlines()
num_lines = len(lines)
@@ -284,6 +285,13 @@ def handle_file_input(args):
save_to_file(args.output, args.json, args.typerepr, args.no_backup, ts)
f.close()
+
+ # Clean up the temp file we've created with the renamed fields.
+ try:
+ os.remove(filename)
+ except OSError as e:
+ raise Exception(f"Error removing temporary file {e.filename} - {e.strerror}. YAML file was created")
+
return
(trafficserver) 01/04: Fix typo on header_rewrite documentation (#12109)
Posted by cm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit a5c4dcfb3b255e8373e70b1070c4402cc268d7c0
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Thu Mar 20 15:24:53 2025 -0600
Fix typo on header_rewrite documentation (#12109)
(cherry picked from commit 07888c0aa85523871a9adb39b11e1075cc0a4d62)
---
doc/admin-guide/plugins/header_rewrite.en.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/admin-guide/plugins/header_rewrite.en.rst b/doc/admin-guide/plugins/header_rewrite.en.rst
index 474df01ab3..39f8f7fc37 100644
--- a/doc/admin-guide/plugins/header_rewrite.en.rst
+++ b/doc/admin-guide/plugins/header_rewrite.en.rst
@@ -559,7 +559,7 @@ NOW
cond %{NOW:<part>} <operand>
This is the current time, in the local timezone as set on the machine,
-typically GMC. Without any further qualifiers, this is the time in seconds
+typically GMT. Without any further qualifiers, this is the time in seconds
since EPOCH aka Unix time. Qualifiers can be used to give various other
values, such as year, month etc.
::