You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bn...@apache.org on 2026/03/16 15:57:20 UTC
(trafficserver) 01/01: Merge master into 11-Dev
This is an automated email from the ASF dual-hosted git repository.
bneradt pushed a commit to branch 11-Dev
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit a77f8153b04af7da541f0facac17ee656d06d7ec
Merge: 5bab268cb4 f6dd1c7701
Author: bneradt <bn...@yahooinc.com>
AuthorDate: Mon Mar 16 10:55:51 2026 -0500
Merge master into 11-Dev
Conflicts:
include/ts/ts.h
include/tscore/ArgParser.h
src/iocore/cache/P_CacheHosting.h
src/proxy/ReverseProxy.cc
src/tscore/ArgParser.cc
CMakeLists.txt | 19 +-
ci/rat-regex.txt | 1 +
cmake/ExperimentalPlugins.cmake | 10 +-
cmake/Findcap.cmake | 22 +-
configs/volume.config.default | 33 +-
doc/admin-guide/configuration/hrw4u.en.rst | 357 ++++++++++-
doc/admin-guide/files/records.yaml.en.rst | 62 +-
doc/admin-guide/files/remap.config.en.rst | 48 ++
doc/admin-guide/files/volume.config.en.rst | 86 ++-
doc/admin-guide/logging/formatting.en.rst | 127 ++--
doc/admin-guide/plugins/compress.en.rst | 27 +-
doc/admin-guide/plugins/index.en.rst | 4 +
doc/admin-guide/plugins/ja4_fingerprint.en.rst | 209 +++++++
doc/admin-guide/plugins/lua.en.rst | 2 +
.../api/functions/TSHttpTxnMilestoneGet.en.rst | 12 +-
.../api/functions/TSLifecycleHookAdd.en.rst | 6 +
.../api/functions/TSLogFieldRegister.en.rst | 99 +++
.../api/functions/TSVConnClientHelloGet.en.rst | 50 ++
doc/developer-guide/api/types/TSClientHello.en.rst | 83 +++
doc/developer-guide/api/types/TSEvent.en.rst | 4 +
doc/developer-guide/cripts/cripts-misc.en.rst | 62 ++
doc/release-notes/upgrading.en.rst | 1 +
example/cripts/cache_groups.cc | 106 ++++
example/plugins/c-api/CMakeLists.txt | 1 +
.../c-api/custom_logfield/custom_logfield.cc | 230 +++++++
include/cripts/CacheGroup.hpp | 217 +++++++
include/iocore/cache/Cache.h | 5 +-
include/iocore/net/ProxyProtocol.h | 2 +
include/iocore/net/TLSSNISupport.h | 45 +-
include/proxy/Milestones.h | 2 +-
include/proxy/ReverseProxy.h | 7 +-
include/proxy/http/HttpConfig.h | 1 +
include/proxy/http/HttpTransact.h | 24 +-
include/proxy/http/remap/RemapConfig.h | 1 +
include/proxy/http/remap/UrlMapping.h | 37 +-
include/proxy/http/remap/UrlMappingPathIndex.h | 13 +
include/proxy/logging/Log.h | 1 +
include/proxy/logging/LogAccess.h | 24 +-
include/proxy/logging/LogField.h | 8 +
include/records/RecCore.h | 33 +-
include/ts/apidefs.h.in | 89 ++-
include/ts/ts.h | 44 ++
include/tscore/ArgParser.h | 2 +-
include/tscore/ink_config.h.cmake.in | 1 +
plugins/compress/sample.compress.config | 3 +-
plugins/experimental/ja4_fingerprint/README.md | 2 +
plugins/experimental/ja4_fingerprint/plugin.cc | 75 ++-
plugins/header_rewrite/condition.h | 6 +
plugins/header_rewrite/header_rewrite.cc | 5 +-
plugins/lua/ts_lua_http_milestone.cc | 54 +-
src/api/InkAPI.cc | 243 ++++++++
src/api/InkAPITest.cc | 32 +-
src/cripts/CMakeLists.txt | 10 +-
src/cripts/CacheGroup.cc | 453 ++++++++++++++
src/cripts/unit_tests/stub.cc | 78 +++
src/cripts/unit_tests/test_CacheGroup.cc | 224 +++++++
src/iocore/cache/Cache.cc | 102 +++-
src/iocore/cache/CacheHosting.cc | 120 +++-
src/iocore/cache/CacheProcessor.cc | 121 +++-
src/iocore/cache/CacheVC.cc | 12 +-
src/iocore/cache/P_CacheHosting.h | 43 +-
src/iocore/cache/P_CacheInternal.h | 11 +-
src/iocore/cache/Stripe.h | 2 +
src/iocore/hostdb/HostDB.cc | 4 +-
src/iocore/net/OCSPStapling.cc | 17 +-
src/iocore/net/ProxyProtocol.cc | 6 +
src/iocore/net/SSLNetVConnection.cc | 12 +
src/iocore/net/SSLUtils.cc | 2 +
src/iocore/net/TLSSNISupport.cc | 102 ++++
src/iocore/net/unit_tests/test_ProxyProtocol.cc | 6 +-
src/proxy/ReverseProxy.cc | 74 ++-
src/proxy/http/HttpCacheSM.cc | 38 +-
src/proxy/http/HttpConfig.cc | 4 +-
src/proxy/http/HttpSM.cc | 107 +++-
src/proxy/http/HttpTransact.cc | 238 +++++++-
src/proxy/http/remap/RemapConfig.cc | 76 ++-
src/proxy/http/remap/RemapProcessor.cc | 3 +
src/proxy/http/remap/UrlMapping.cc | 33 +
src/proxy/logging/Log.cc | 28 +-
src/proxy/logging/LogAccess.cc | 104 ++++
src/proxy/logging/LogField.cc | 117 +++-
src/records/RecConfigParse.cc | 54 +-
src/records/RecYAMLDecoder.cc | 9 +-
src/records/RecordsConfig.cc | 6 +-
src/records/RecordsConfigUtils.cc | 17 +-
src/traffic_ctl/traffic_ctl.cc | 14 +-
src/traffic_layout/traffic_layout.cc | 11 +-
src/traffic_server/traffic_server.cc | 14 +
src/tscore/ArgParser.cc | 2 +-
tests/gold_tests/autest-site/ats_replay.test.ext | 37 ++
.../cache/cache-read-retry-stale.test.py | 33 +-
.../cache/cache-write-lock-contention.test.py | 175 ++++++
.../cache/cache_volume_defaults.replay.yaml | 144 +++++
.../gold_tests/cache/cache_volume_defaults.test.py | 31 +-
.../cache/cache_volume_features.replay.yaml | 141 +++++
.../gold_tests/cache/cache_volume_features.test.py | 32 +-
.../replay/cache-read-retry-stale.replay.yaml | 187 ++++++
.../connect_down_policy_3.test.py | 113 ++++
.../replay/inactive_timeout.replay.yaml} | 31 +-
.../gold_tests/dns/connect_attempts.test.py | 34 +-
tests/gold_tests/dns/dns_host_down.test.py | 14 +-
.../connect_attempts_rr_max_retries_error_log.gold | 8 +
.../dns/gold/connect_attempts_rr_no_error_log.gold | 6 +
.../connect_attempts_rr_retries_error_log.gold | 8 +
.../connect_attempts_rr_max_retries.replay.yaml | 129 ++++
.../connect_attempts_rr_no_retry.replay.yaml | 129 ++++
.../replay/connect_attempts_rr_retries.replay.yaml | 165 +++++
.../gold_tests/dns/replay/server_down.replay.yaml | 5 +-
tests/gold_tests/logging/log-mstsms.test.py | 121 ++++
.../compress/compress-cache-untransformed.test.py | 118 ++++
.../compress/compress_100_continue_origin.py | 126 ++++
.../compress/etc/compress-cache-false.config | 5 +
.../header_rewrite_bundle.replay.yaml | 669 +++++++++++++++++++++
.../header_rewrite/rules/complex_logics.conf | 158 +++++
.../records/records_runroot_precedence.test.py | 163 +++++
tools/hrw4u/.gitignore | 1 +
tools/hrw4u/Makefile | 10 +-
tools/hrw4u/grammar/hrw4u.g4 | 41 +-
tools/hrw4u/pyproject.toml | 5 +-
tools/hrw4u/schema/sandbox.schema.json | 136 +++++
tools/hrw4u/scripts/hrw4u | 34 +-
tools/hrw4u/scripts/hrw4u-lsp | 264 ++++++--
tools/hrw4u/scripts/testcase.py | 18 +-
tools/hrw4u/src/common.py | 93 ++-
tools/hrw4u/src/errors.py | 179 ++++--
tools/hrw4u/src/hrw_symbols.py | 5 +-
tools/hrw4u/src/hrw_visitor.py | 19 +-
tools/hrw4u/src/lsp/hover.py | 214 +++----
tools/hrw4u/src/lsp/strings.py | 70 +--
tools/hrw4u/{scripts/hrw4u => src/procedures.py} | 28 +-
tools/hrw4u/src/sandbox.py | 180 ++++++
tools/hrw4u/src/symbols.py | 16 +-
tools/hrw4u/src/symbols_base.py | 18 +-
tools/hrw4u/src/visitor.py | 652 ++++++++++++++++++--
tools/hrw4u/src/visitor_base.py | 252 ++------
.../tests/data/conds/double-negation.output.txt | 4 +-
tools/hrw4u/tests/data/conds/exceptions.txt | 2 +-
tools/hrw4u/tests/data/conds/group-and-not.ast.txt | 1 +
.../hrw4u/tests/data/conds/group-and-not.input.txt | 5 +
.../tests/data/conds/group-and-not.output.txt | 6 +
tools/hrw4u/tests/data/conds/group-in-if.ast.txt | 1 +
tools/hrw4u/tests/data/conds/group-in-if.input.txt | 11 +
.../hrw4u/tests/data/conds/group-in-if.output.txt | 15 +
tools/hrw4u/tests/data/conds/group-nested.ast.txt | 1 +
.../hrw4u/tests/data/conds/group-nested.input.txt | 5 +
.../hrw4u/tests/data/conds/group-nested.output.txt | 7 +
tools/hrw4u/tests/data/conds/group-or.ast.txt | 1 +
tools/hrw4u/tests/data/conds/group-or.input.txt | 5 +
tools/hrw4u/tests/data/conds/group-or.output.txt | 6 +
tools/hrw4u/tests/data/conds/group-two.ast.txt | 1 +
tools/hrw4u/tests/data/conds/group-two.input.txt | 5 +
tools/hrw4u/tests/data/conds/group-two.output.txt | 10 +
.../tests/data/examples/all-nonsense.output.txt | 22 +-
.../hrw4u/tests/data/procedures/basic-call.ast.txt | 1 +
.../tests/data/procedures/basic-call.input.txt | 5 +
.../tests/data/procedures/basic-call.output.txt | 2 +
.../data/procedures/circular-use.fail.error.txt | 1 +
.../data/procedures/circular-use.fail.input.txt | 5 +
.../tests/data/procedures/default-param.ast.txt | 1 +
.../tests/data/procedures/default-param.input.txt | 5 +
.../tests/data/procedures/default-param.output.txt | 2 +
.../data/procedures/duplicate-proc.fail.error.txt | 1 +
.../data/procedures/duplicate-proc.fail.input.txt | 11 +
.../tests/data/procedures/elif-in-proc.ast.txt | 1 +
.../tests/data/procedures/elif-in-proc.flatten.txt | 20 +
.../tests/data/procedures/elif-in-proc.input.txt | 8 +
.../tests/data/procedures/elif-in-proc.output.txt | 24 +
.../tests/data/procedures/in-conditional.ast.txt | 1 +
.../data/procedures/in-conditional.flatten.txt | 5 +
.../tests/data/procedures/in-conditional.input.txt | 7 +
.../data/procedures/in-conditional.output.txt | 3 +
.../tests/data/procedures/local-and-use.ast.txt | 1 +
.../tests/data/procedures/local-and-use.input.txt | 10 +
.../tests/data/procedures/local-and-use.output.txt | 3 +
.../tests/data/procedures/local-mixed-body.ast.txt | 1 +
.../data/procedures/local-mixed-body.flatten.txt | 6 +
.../data/procedures/local-mixed-body.input.txt | 11 +
.../data/procedures/local-mixed-body.output.txt | 6 +
.../data/procedures/local-multi-section.ast.txt | 1 +
.../data/procedures/local-multi-section.input.txt | 11 +
.../data/procedures/local-multi-section.output.txt | 5 +
.../hrw4u/tests/data/procedures/local-proc.ast.txt | 1 +
.../tests/data/procedures/local-proc.input.txt | 7 +
.../tests/data/procedures/local-proc.output.txt | 2 +
.../data/procedures/local-with-params.ast.txt | 1 +
.../data/procedures/local-with-params.input.txt | 7 +
.../data/procedures/local-with-params.output.txt | 2 +
.../hrw4u/tests/data/procedures/mixed-body.ast.txt | 1 +
.../tests/data/procedures/mixed-body.flatten.txt | 6 +
.../tests/data/procedures/mixed-body.input.txt | 5 +
.../tests/data/procedures/mixed-body.output.txt | 6 +
.../hrw4u/tests/data/procedures/multi-proc.ast.txt | 1 +
.../tests/data/procedures/multi-proc.input.txt | 6 +
.../tests/data/procedures/multi-proc.output.txt | 3 +
.../data/procedures/multi-section-mixed.ast.txt | 1 +
.../procedures/multi-section-mixed.flatten.txt | 13 +
.../data/procedures/multi-section-mixed.input.txt | 15 +
.../data/procedures/multi-section-mixed.output.txt | 13 +
.../hrw4u/tests/data/procedures/multi-use.ast.txt | 1 +
.../tests/data/procedures/multi-use.input.txt | 7 +
.../tests/data/procedures/multi-use.output.txt | 3 +
.../tests/data/procedures/override-param.ast.txt | 1 +
.../tests/data/procedures/override-param.input.txt | 5 +
.../data/procedures/override-param.output.txt | 2 +
.../procedures/proc-after-section.fail.error.txt | 1 +
.../procedures/proc-after-section.fail.input.txt | 7 +
.../tests/data/procedures/procs/base/Stamp.hrw4u | 3 +
.../tests/data/procedures/procs/caller/Wrap.hrw4u | 6 +
.../tests/data/procedures/procs/circular/A.hrw4u | 5 +
.../tests/data/procedures/procs/circular/B.hrw4u | 5 +
.../data/procedures/procs/reexport/debug.hrw4u | 1 +
.../data/procedures/procs/test/TagAndOrigin.hrw4u | 7 +
.../procedures/procs/test/add-debug-header.hrw4u | 3 +
.../procedures/procs/test/classify-request.hrw4u | 10 +
.../data/procedures/procs/test/mixed-body.hrw4u | 7 +
.../data/procedures/procs/test/set-cache.hrw4u | 3 +
.../data/procedures/procs/test/set-origin.hrw4u | 3 +
.../procedures/procs/test/wrong-namespace.hrw4u | 3 +
tools/hrw4u/tests/data/procedures/reexport.ast.txt | 1 +
.../hrw4u/tests/data/procedures/reexport.input.txt | 5 +
.../tests/data/procedures/reexport.output.txt | 2 +
.../tests/data/procedures/string-param.ast.txt | 1 +
.../tests/data/procedures/string-param.input.txt | 5 +
.../tests/data/procedures/string-param.output.txt | 2 +
.../data/procedures/top-level-only.fail.error.txt | 1 +
.../data/procedures/top-level-only.fail.input.txt | 5 +
.../hrw4u/tests/data/procedures/transitive.ast.txt | 1 +
.../tests/data/procedures/transitive.input.txt | 5 +
.../tests/data/procedures/transitive.output.txt | 3 +
.../data/procedures/unknown-proc.fail.error.txt | 1 +
.../data/procedures/unknown-proc.fail.input.txt | 3 +
.../data/procedures/wrong-arity.fail.error.txt | 1 +
.../data/procedures/wrong-arity.fail.input.txt | 5 +
.../data/procedures/wrong-namespace.fail.error.txt | 1 +
.../data/procedures/wrong-namespace.fail.input.txt | 5 +
tools/hrw4u/tests/data/sandbox/allowed.ast.txt | 1 +
tools/hrw4u/tests/data/sandbox/allowed.input.txt | 3 +
tools/hrw4u/tests/data/sandbox/allowed.output.txt | 2 +
.../tests/data/sandbox/denied-function.ast.txt | 1 +
.../tests/data/sandbox/denied-function.error.txt | 2 +
.../tests/data/sandbox/denied-function.input.txt | 3 +
.../data/sandbox/denied-language-break.ast.txt | 1 +
.../data/sandbox/denied-language-break.error.txt | 2 +
.../data/sandbox/denied-language-break.input.txt | 4 +
.../data/sandbox/denied-language-elif.ast.txt | 1 +
.../data/sandbox/denied-language-elif.error.txt | 1 +
.../data/sandbox/denied-language-elif.input.txt | 7 +
.../data/sandbox/denied-language-elif.sandbox.yaml | 6 +
.../data/sandbox/denied-language-else.ast.txt | 1 +
.../data/sandbox/denied-language-else.error.txt | 1 +
.../data/sandbox/denied-language-else.input.txt | 7 +
.../data/sandbox/denied-language-else.sandbox.yaml | 6 +
.../tests/data/sandbox/denied-language-in.ast.txt | 1 +
.../data/sandbox/denied-language-in.error.txt | 1 +
.../data/sandbox/denied-language-in.input.txt | 5 +
.../data/sandbox/denied-language-in.sandbox.yaml | 6 +
.../data/sandbox/denied-modifier-nocase.ast.txt | 1 +
.../data/sandbox/denied-modifier-nocase.error.txt | 1 +
.../data/sandbox/denied-modifier-nocase.input.txt | 5 +
.../sandbox/denied-modifier-nocase.sandbox.yaml | 6 +
.../tests/data/sandbox/denied-modifier-or.ast.txt | 1 +
.../data/sandbox/denied-modifier-or.error.txt | 1 +
.../data/sandbox/denied-modifier-or.input.txt | 5 +
.../data/sandbox/denied-modifier-or.sandbox.yaml | 6 +
.../tests/data/sandbox/denied-section.ast.txt | 1 +
.../tests/data/sandbox/denied-section.error.txt | 2 +
.../tests/data/sandbox/denied-section.input.txt | 3 +
tools/hrw4u/tests/data/sandbox/exceptions.txt | 10 +
.../tests/data/sandbox/multiple-denials.ast.txt | 1 +
.../tests/data/sandbox/multiple-denials.error.txt | 4 +
.../tests/data/sandbox/multiple-denials.input.txt | 4 +
.../tests/data/sandbox/per-test-sandbox.error.txt | 1 +
.../tests/data/sandbox/per-test-sandbox.input.txt | 3 +
.../data/sandbox/per-test-sandbox.sandbox.yaml | 4 +
tools/hrw4u/tests/data/sandbox/sandbox.yaml | 12 +
.../tests/data/sandbox/warned-function.ast.txt | 1 +
.../tests/data/sandbox/warned-function.input.txt | 3 +
.../tests/data/sandbox/warned-function.output.txt | 2 +
.../data/sandbox/warned-function.sandbox.yaml | 6 +
.../tests/data/sandbox/warned-function.warning.txt | 2 +
tools/hrw4u/tests/test_lsp.py | 84 ++-
tools/hrw4u/tests/test_procedures.py | 51 ++
tools/hrw4u/tests/test_sandbox.py | 43 ++
tools/hrw4u/tests/test_units.py | 218 ++++---
tools/hrw4u/tests/utils.py | 296 +++++++--
tools/slow_log_report.pl | 13 +-
286 files changed, 9875 insertions(+), 1391 deletions(-)
diff --cc include/proxy/ReverseProxy.h
index 20cf5a0cea,c24748b796..201327d8aa
--- a/include/proxy/ReverseProxy.h
+++ b/include/proxy/ReverseProxy.h
@@@ -55,7 -56,8 +57,8 @@@ mapping_type request_url_remap_redirect
bool response_url_remap(HTTPHdr *response_header, UrlRewrite *table);
// Reload Functions
-bool reloadUrlRewrite();
+bool reloadUrlRewrite(ConfigContext ctx);
bool urlRewriteVerify();
- int url_rewrite_CB(const char *name, RecDataT data_type, RecData data, void *cookie);
+ void init_remap_volume_host_records();
+ int url_rewrite_CB(const char *name, RecDataT data_type, RecData data, void *cookie);
diff --cc src/iocore/cache/P_CacheHosting.h
index 37008ccba8,d36821c51e..0e1a6f3618
--- a/src/iocore/cache/P_CacheHosting.h
+++ b/src/iocore/cache/P_CacheHosting.h
@@@ -241,12 -256,31 +257,25 @@@ public
return hostMatch.get();
}
- CacheType type = CacheType::HTTP;
- Cache *cache = nullptr;
- int m_numEntries = 0;
- CacheHostRecord gen_host_rec;
+ CacheType
+ getType() const
+ {
+ return type;
+ }
+
+ Cache *
+ getCache() const
+ {
+ return cache;
+ }
- void
- register_config_callback(ReplaceablePtr<CacheHostTable> *p)
- {
- RecRegisterConfigUpdateCb("proxy.config.cache.hosting_filename", CacheHostTable::config_callback, (void *)p);
- }
-
private:
+ static int config_callback(const char *, RecDataT, RecData, void *);
+
+ CacheType type = CacheType::HTTP;
+ Cache *cache = nullptr;
+ int m_numEntries = 0;
+ CacheHostRecord gen_host_rec;
std::unique_ptr<CacheHostMatcher> hostMatch = nullptr;
const matcher_tags config_tags = {"hostname", "domain", nullptr, nullptr, nullptr, nullptr, false};
const char *matcher_name = "unknown"; // Used for Debug/Warning/Error messages
diff --cc src/proxy/ReverseProxy.cc
index 9fb8da55c5,8deb9d0016..a17840fc90
--- a/src/proxy/ReverseProxy.cc
+++ b/src/proxy/ReverseProxy.cc
@@@ -66,33 -67,23 +67,31 @@@ thread_local PluginThreadContext *plugi
int
init_reverse_proxy()
{
- ink_assert(rewrite_table == nullptr);
+ ink_assert(rewrite_table.load() == nullptr);
reconfig_mutex = new_ProxyMutex();
- rewrite_table = new UrlRewrite();
+ rewrite_table.store(new UrlRewrite());
+ // Register with ConfigRegistry BEFORE load() so that remap.config is in
+ // FileManager's bindings when .include directives call configFileChild()
+ // to register child files (e.g. test.inc).
+ config::ConfigRegistry::Get_Instance().register_config("remap", // registry key
+ ts::filename::REMAP, // default filename
+ "proxy.config.url_remap.filename", // record holding the filename
+ [](ConfigContext ctx) { reloadUrlRewrite(ctx); }, // reload handler
+ config::ConfigSource::FileOnly, // file-based only
+ {"proxy.config.url_remap.filename", // trigger records
+ "proxy.config.proxy_name", "proxy.config.http.referer_default_redirect"});
+
+ rewrite_table.load()->acquire();
Note("%s loading ...", ts::filename::REMAP);
- if (!rewrite_table->load()) {
+ if (!rewrite_table.load()->load()) {
Emergency("%s failed to load", ts::filename::REMAP);
} else {
Note("%s finished loading", ts::filename::REMAP);
}
- RecRegisterConfigUpdateCb("proxy.config.url_remap.filename", url_rewrite_CB, (void *)FILE_CHANGED);
- RecRegisterConfigUpdateCb("proxy.config.proxy_name", url_rewrite_CB, (void *)TSNAME_CHANGED);
RecRegisterConfigUpdateCb("proxy.config.reverse_proxy.enabled", url_rewrite_CB, (void *)REVERSE_CHANGED);
- RecRegisterConfigUpdateCb("proxy.config.http.referer_default_redirect", url_rewrite_CB, (void *)HTTP_DEFAULT_REDIRECT_CHANGED);
- // Hold at least one lease, until we reload the configuration
- rewrite_table->acquire();
-
return 0;
}
@@@ -168,10 -167,89 +167,69 @@@ reloadUrlRewrite(ConfigContext ctx
}
}
+ /**
+ * Helper function to initialize volume_host_rec for a single url_mapping.
+ * This is a no-op if the mapping has no volume string or is already initialized.
+ */
+ static void
+ init_mapping_volume_host_rec(url_mapping &mapping)
+ {
+ char errbuf[256];
+
+ if (!mapping.initVolumeHostRec(errbuf, sizeof(errbuf))) {
+ Error("Failed to initialize volume record for @volume=%s: %s", mapping.getVolume().c_str(), errbuf);
+ }
+ }
+
+ static void
+ init_store_volume_host_records(UrlRewrite::MappingsStore &store)
+ {
+ if (store.hash_lookup) {
+ for (auto &entry : *store.hash_lookup) {
+ UrlMappingPathIndex *path_index = entry.second;
+
+ if (path_index) {
+ path_index->foreach_mapping(init_mapping_volume_host_rec);
+ }
+ }
+ }
+
+ for (UrlRewrite::RegexMapping *reg_map = store.regex_list.head; reg_map; reg_map = reg_map->link.next) {
+ if (reg_map->url_map) {
+ init_mapping_volume_host_rec(*reg_map->url_map);
+ }
+ }
+ }
+
+ // This is called after the cache is initialized, since we may need the volume_host_records.
+ // Must only be called during startup before any remap reload can occur.
+ void
+ init_remap_volume_host_records()
+ {
+ UrlRewrite *table = rewrite_table.load(std::memory_order_acquire);
+
+ if (!table) {
+ return;
+ }
+
+ table->acquire();
+
+ Dbg(dbg_ctl_url_rewrite, "Initializing volume_host_rec for all remap rules after cache init");
+
+ // Initialize for all mapping stores
+ init_store_volume_host_records(table->forward_mappings);
+ init_store_volume_host_records(table->reverse_mappings);
+ init_store_volume_host_records(table->permanent_redirects);
+ init_store_volume_host_records(table->temporary_redirects);
+ init_store_volume_host_records(table->forward_mappings_with_recv_port);
+
+ table->release();
+ }
+
int
-url_rewrite_CB(const char * /* name ATS_UNUSED */, RecDataT /* data_type ATS_UNUSED */, RecData data, void *cookie)
+url_rewrite_CB(const char * /* name ATS_UNUSED */, RecDataT /* data_type ATS_UNUSED */, RecData data,
+ void * /* cookie ATS_UNUSED */)
{
- int my_token = static_cast<int>((long)cookie);
-
- switch (my_token) {
- case REVERSE_CHANGED:
- rewrite_table.load()->SetReverseFlag(data.rec_int);
- break;
-
- case TSNAME_CHANGED:
- case FILE_CHANGED:
- case HTTP_DEFAULT_REDIRECT_CHANGED:
- eventProcessor.schedule_imm(new UR_UpdateContinuation(reconfig_mutex), ET_TASK);
- break;
-
- case URL_REMAP_MODE_CHANGED:
- // You need to restart TS.
- break;
-
- default:
- ink_assert(0);
- break;
- }
-
+ rewrite_table->SetReverseFlag(data.rec_int);
return 0;
}