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 2020/06/12 19:59:54 UTC
[trafficserver] branch 9.0.x updated: Fix the relative path for
template_sets_dir to be install directory (#6203)
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 1e45e9c Fix the relative path for template_sets_dir to be install directory (#6203)
1e45e9c is described below
commit 1e45e9c5611d9a7365071a48196d5a8c5e089f86
Author: Susan Hinrichs <sh...@yahoo-inc.com>
AuthorDate: Fri Jun 12 14:57:44 2020 -0500
Fix the relative path for template_sets_dir to be install directory (#6203)
Co-authored-by: Susan Hinrichs <sh...@oath.com>
(cherry picked from commit c9e5ce1dffbcb255d6baeeecb89fb4335ed033b1)
---
mgmt/RecordsConfig.cc | 2 +-
proxy/http/HttpBodyFactory.cc | 16 ++++++++++++----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index 7173a96..a70200d 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -668,7 +668,7 @@ static const RecordElement RecordsConfig[] =
,
{RECT_CONFIG, "proxy.config.body_factory.enable_logging", RECD_INT, "0", RECU_RESTART_TS, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
,
- {RECT_CONFIG, "proxy.config.body_factory.template_sets_dir", RECD_STRING, "body_factory", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[^[:space:]]+$", RECA_NULL}
+ {RECT_CONFIG, "proxy.config.body_factory.template_sets_dir", RECD_STRING, TS_BUILD_SYSCONFDIR "/body_factory", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[^[:space:]]+$", RECA_NULL}
,
{RECT_CONFIG, "proxy.config.body_factory.response_max_size", RECD_INT, "8192", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
,
diff --git a/proxy/http/HttpBodyFactory.cc b/proxy/http/HttpBodyFactory.cc
index 4622cda..6d2150d 100644
--- a/proxy/http/HttpBodyFactory.cc
+++ b/proxy/http/HttpBodyFactory.cc
@@ -241,6 +241,7 @@ void
HttpBodyFactory::reconfigure()
{
RecInt e;
+ RecString s = nullptr;
bool all_found;
int rec_err;
@@ -276,15 +277,22 @@ HttpBodyFactory::reconfigure()
all_found = all_found && (rec_err == REC_ERR_OKAY);
Debug("body_factory", "response_suppression_mode = %d (found = %" PRId64 ")", response_suppression_mode, e);
- ats_scoped_str directory_of_template_sets(RecConfigReadConfigPath("proxy.config.body_factory.template_sets_dir", "body_factory"));
+ ats_scoped_str directory_of_template_sets;
- 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' ");
+ 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);
+ 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' ");
+ }
}
Debug("body_factory", "directory_of_template_sets = '%s' ", (const char *)directory_of_template_sets);
+ ats_free(s);
+
if (!all_found) {
Warning("config changed, but can't fetch all proxy.config.body_factory values");
}