You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2021/10/13 22:55:50 UTC
[trafficserver] branch 9.2.x updated: body factory does not respect
runroot (#8388)
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/9.2.x by this push:
new bfe61ef body factory does not respect runroot (#8388)
bfe61ef is described below
commit bfe61ef32467d82699b3c148431e299493f8a7d0
Author: dragon512 <dr...@live.com>
AuthorDate: Fri Oct 8 10:31:58 2021 -0500
body factory does not respect runroot (#8388)
(cherry picked from commit d19ef809cce96a684e1854b249231c909e0bad02)
---
lib/records/RecConfigParse.cc | 2 +-
proxy/http/HttpBodyFactory.cc | 8 +++++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/lib/records/RecConfigParse.cc b/lib/records/RecConfigParse.cc
index bc7e5d5..a6cc89b 100644
--- a/lib/records/RecConfigParse.cc
+++ b/lib/records/RecConfigParse.cc
@@ -89,7 +89,7 @@ RecConfigOverrideFromRunroot(const char *name)
if (!get_runroot().empty()) {
if (!strcmp(name, "proxy.config.bin_path") || !strcmp(name, "proxy.config.local_state_dir") ||
!strcmp(name, "proxy.config.log.logfile_dir") || !strcmp(name, "proxy.config.plugin.plugin_dir") ||
- !strcmp(name, "proxy.config.hostdb.storage_path")) {
+ !strcmp(name, "proxy.config.hostdb.storage_path") || !strcmp(name, "proxy.config.body_factory.template_sets_dir")) {
return true;
}
}
diff --git a/proxy/http/HttpBodyFactory.cc b/proxy/http/HttpBodyFactory.cc
index ee515f1..ecc7943 100644
--- a/proxy/http/HttpBodyFactory.cc
+++ b/proxy/http/HttpBodyFactory.cc
@@ -282,7 +282,13 @@ HttpBodyFactory::reconfigure()
rec_err = RecGetRecordString_Xmalloc("proxy.config.body_factory.template_sets_dir", &s);
all_found = all_found && (rec_err == REC_ERR_OKAY);
if (rec_err == REC_ERR_OKAY) {
- directory_of_template_sets = Layout::get()->relative(s);
+ // check if we should tweak with run_root value
+ if (s && strlen(s) > 0) {
+ // the value is set via config file or ENV var
+ directory_of_template_sets = Layout::get()->relative(s);
+ } else {
+ directory_of_template_sets = Layout::relative_to(RecConfigReadConfigDir(), "body_factory");
+ }
if (access(directory_of_template_sets, R_OK) < 0) {
Warning("Unable to access() directory '%s': %d, %s", (const char *)directory_of_template_sets, errno, strerror(errno));
Warning(" Please set 'proxy.config.body_factory.template_sets_dir' ");