You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2017/01/31 00:49:56 UTC
[trafficserver] branch master updated: Allow configurable body
factory response max size
This is an automated email from the ASF dual-hosted git repository.
bcall pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new d0e5392 Allow configurable body factory response max size
d0e5392 is described below
commit d0e5392d3399df2a67937b079928e357da43a273
Author: Igor Brezac <ig...@discovery.com>
AuthorDate: Sun Jan 29 00:42:39 2017 +0000
Allow configurable body factory response max size
New config: proxy.config.body_factory.response_max_size
---
doc/admin-guide/files/records.config.en.rst | 5 +++++
lib/perl/lib/Apache/TS/AdminClient.pm | 1 +
mgmt/RecordsConfig.cc | 2 ++
proxy/http/HttpConfig.cc | 2 ++
proxy/http/HttpConfig.h | 5 ++++-
proxy/http/HttpTransact.cc | 2 +-
6 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/doc/admin-guide/files/records.config.en.rst b/doc/admin-guide/files/records.config.en.rst
index 6004051..a5e537b 100644
--- a/doc/admin-guide/files/records.config.en.rst
+++ b/doc/admin-guide/files/records.config.en.rst
@@ -2264,6 +2264,11 @@ Customizable User Response Pages
this value and an underscore are predended to the file name to find in the template sets
directory. See :ref:`body-factory`.
+.. ts:cv:: CONFIG proxy.config.body_factory.response_max_size INT 8192
+ :reloadable:
+
+ Maximum size of the error template response page.
+
.. ts:cv:: CONFIG proxy.config.body_factory.response_suppression_mode INT 0
Specifies when Traffic Server suppresses generated response pages:
diff --git a/lib/perl/lib/Apache/TS/AdminClient.pm b/lib/perl/lib/Apache/TS/AdminClient.pm
index aa48d96..653e7a4 100644
--- a/lib/perl/lib/Apache/TS/AdminClient.pm
+++ b/lib/perl/lib/Apache/TS/AdminClient.pm
@@ -323,6 +323,7 @@ The Apache Traffic Server Administration Manual will explain what these strings
proxy.config.bin_path
proxy.config.body_factory.enable_customizations
proxy.config.body_factory.enable_logging
+ proxy.config.body_factory.response_max_size
proxy.config.body_factory.response_suppression_mode
proxy.config.body_factory.template_sets_dir
proxy.config.cache.agg_write_backlog
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index acae481..d0303dc 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -753,6 +753,8 @@ static const RecordElement RecordsConfig[] =
,
{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, NULL, RECA_NULL}
+ ,
//# 0 - never suppress generated responses
//# 1 - always suppress generated responses
//# 2 - suppress responses for intercepted traffic
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index 9c69e0a..7594c54 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -1076,6 +1076,7 @@ HttpConfig::startup()
c.reverse_proxy_no_host_redirect_len = -1;
HttpEstablishStaticConfigStringAlloc(c.oride.body_factory_template_base, "proxy.config.body_factory.template_base");
c.oride.body_factory_template_base_len = c.oride.body_factory_template_base ? strlen(c.oride.body_factory_template_base) : 0;
+ HttpEstablishStaticConfigLongLong(c.body_factory_response_max_size, "proxy.config.body_factory.response_max_size");
HttpEstablishStaticConfigByte(c.errors_log_error_pages, "proxy.config.http.errors.log_error_pages");
HttpEstablishStaticConfigLongLong(c.oride.slow_log_threshold, "proxy.config.http.slow.log.threshold");
@@ -1370,6 +1371,7 @@ HttpConfig::reconfigure()
params->oride.body_factory_template_base = ats_strdup(m_master.oride.body_factory_template_base);
params->oride.body_factory_template_base_len =
params->oride.body_factory_template_base ? strlen(params->oride.body_factory_template_base) : 0;
+ params->body_factory_response_max_size = m_master.body_factory_response_max_size;
params->reverse_proxy_no_host_redirect = ats_strdup(m_master.reverse_proxy_no_host_redirect);
params->reverse_proxy_no_host_redirect_len =
params->reverse_proxy_no_host_redirect ? strlen(params->reverse_proxy_no_host_redirect) : 0;
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index cc75710..7ca86f1 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -817,6 +817,8 @@ public:
// are not copied over until needed ("lazy").
OverridableHttpConfigParams oride;
+ MgmtInt body_factory_response_max_size;
+
private:
/////////////////////////////////////
// operator = and copy constructor //
@@ -918,7 +920,8 @@ inline HttpConfigParams::HttpConfigParams()
disallow_post_100_continue(0),
parser_allow_non_http(1),
keepalive_internal_vc(0),
- server_session_sharing_pool(TS_SERVER_SESSION_SHARING_POOL_THREAD)
+ server_session_sharing_pool(TS_SERVER_SESSION_SHARING_POOL_THREAD),
+ body_factory_response_max_size(8192)
{
}
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index a4aea1d..b4e1a47 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -8198,7 +8198,7 @@ HttpTransact::build_error_response(State *s, HTTPStatus status_code, const char
char *new_msg;
va_start(ap, format);
- new_msg = body_factory->fabricate_with_old_api(error_body_type, s, 8192, &len, body_language, sizeof(body_language), body_type,
+ new_msg = body_factory->fabricate_with_old_api(error_body_type, s, s->http_config_param->body_factory_response_max_size, &len, body_language, sizeof(body_language), body_type,
sizeof(body_type), format, ap);
va_end(ap);
--
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].