TS-1387: Allow proxy.config.http.insert_age_in_response to be overridden
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/e24e79d0 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/e24e79d0 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/e24e79d0 Branch: refs/heads/master Commit: e24e79d0b01e4d2b08a1ca8dfb7d171a8aa3ff7e Parents: 9c3bebd Author: Phil Sorber <[email protected]> Authored: Tue Aug 7 20:37:10 2012 -0700 Committer: James Peach <[email protected]> Committed: Tue Aug 7 20:37:10 2012 -0700 ---------------------------------------------------------------------- plugins/experimental/lua/lconfig.cc | 1 + proxy/InkAPI.cc | 6 ++++++ proxy/InkAPITest.cc | 1 + proxy/api/ts/ts.h.in | 1 + proxy/http/HttpConfig.cc | 4 ++-- proxy/http/HttpConfig.h | 5 +++-- proxy/http/HttpTransact.cc | 2 +- 7 files changed, 15 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e24e79d0/plugins/experimental/lua/lconfig.cc ---------------------------------------------------------------------- diff --git a/plugins/experimental/lua/lconfig.cc b/plugins/experimental/lua/lconfig.cc index a36c4df..c112a7e 100644 --- a/plugins/experimental/lua/lconfig.cc +++ b/plugins/experimental/lua/lconfig.cc @@ -142,6 +142,7 @@ LuaConfigApiInit(lua_State * lua) DEFINE_CONFIG_KEY(HTTP_CACHE_FUZZ_PROBABILITY); DEFINE_CONFIG_KEY(NET_SOCK_PACKET_MARK_OUT); DEFINE_CONFIG_KEY(NET_SOCK_PACKET_TOS_OUT); + DEFINE_CONFIG_KEY(HTTP_INSERT_AGE_IN_RESPONSE); #undef DEFINE_CONFIG_KEY return 1; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e24e79d0/proxy/InkAPI.cc ---------------------------------------------------------------------- diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc index fd4bdf6..b5e373a 100644 --- a/proxy/InkAPI.cc +++ b/proxy/InkAPI.cc @@ -7561,6 +7561,10 @@ _conf_to_memberp(TSOverridableConfigKey conf, HttpSM* sm, OverridableDataType *t case TS_CONFIG_HTTP_BACKGROUND_FILL_ACTIVE_TIMEOUT: ret = &sm->t_state.txn_conf->background_fill_active_timeout; break; + case TS_CONFIG_HTTP_INSERT_AGE_IN_RESPONSE: + typ = OVERRIDABLE_TYPE_INT; + ret = &sm->t_state.txn_conf->insert_age_in_response; + break; case TS_CONFIG_HTTP_CACHE_HEURISTIC_LM_FACTOR: typ = OVERRIDABLE_TYPE_FLOAT; @@ -7840,6 +7844,8 @@ TSHttpTxnConfigFind(const char* name, int length, TSOverridableConfigKey *conf, case 'e': if (!strncmp(name, "proxy.config.http.down_server.cache_time", length)) cnf = TS_CONFIG_HTTP_DOWN_SERVER_CACHE_TIME; + else if (!strncmp(name, "proxy.config.http.insert_age_in_response", length)) + cnf = TS_CONFIG_HTTP_INSERT_AGE_IN_RESPONSE; break; case 'r': if (!strncmp(name, "proxy.config.url_remap.pristine_host_hdr", length)) http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e24e79d0/proxy/InkAPITest.cc ---------------------------------------------------------------------- diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc index e072edb..e03e996 100644 --- a/proxy/InkAPITest.cc +++ b/proxy/InkAPITest.cc @@ -7400,6 +7400,7 @@ const char *SDK_Overridable_Configs[] = { "proxy.config.http.background_fill_completed_threshold", "proxy.config.net.sock_packet_mark_out", "proxy.config.net.sock_packet_tos_out", + "proxy.config.http.insert_age_in_response", NULL }; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e24e79d0/proxy/api/ts/ts.h.in ---------------------------------------------------------------------- diff --git a/proxy/api/ts/ts.h.in b/proxy/api/ts/ts.h.in index f758f6f..afa4f35 100644 --- a/proxy/api/ts/ts.h.in +++ b/proxy/api/ts/ts.h.in @@ -610,6 +610,7 @@ extern "C" TS_CONFIG_HTTP_BACKGROUND_FILL_COMPLETED_THRESHOLD, TS_CONFIG_NET_SOCK_PACKET_MARK_OUT, TS_CONFIG_NET_SOCK_PACKET_TOS_OUT, + TS_CONFIG_HTTP_INSERT_AGE_IN_RESPONSE, TS_CONFIG_LAST_ENTRY } TSOverridableConfigKey; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e24e79d0/proxy/http/HttpConfig.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc index 5f2fce3..2707a53 100644 --- a/proxy/http/HttpConfig.cc +++ b/proxy/http/HttpConfig.cc @@ -1236,7 +1236,7 @@ HttpConfig::startup() HttpEstablishStaticConfigByte(c.oride.insert_squid_x_forwarded_for, "proxy.config.http.insert_squid_x_forwarded_for"); - HttpEstablishStaticConfigByte(c.insert_age_in_response, "proxy.config.http.insert_age_in_response"); + HttpEstablishStaticConfigByte(c.oride.insert_age_in_response, "proxy.config.http.insert_age_in_response"); HttpEstablishStaticConfigByte(c.avoid_content_spoofing, "proxy.config.http.avoid_content_spoofing"); @@ -1507,7 +1507,7 @@ HttpConfig::reconfigure() params->oride.proxy_response_server_enabled = m_master.oride.proxy_response_server_enabled; params->oride.insert_squid_x_forwarded_for = INT_TO_BOOL(m_master.oride.insert_squid_x_forwarded_for); - params->insert_age_in_response = INT_TO_BOOL(m_master.insert_age_in_response); + params->oride.insert_age_in_response = INT_TO_BOOL(m_master.oride.insert_age_in_response); params->avoid_content_spoofing = INT_TO_BOOL(m_master.avoid_content_spoofing); params->enable_http_stats = INT_TO_BOOL(m_master.enable_http_stats); params->normalize_ae_gzip = INT_TO_BOOL(m_master.normalize_ae_gzip); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e24e79d0/proxy/http/HttpConfig.h ---------------------------------------------------------------------- diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h index 2550dff..0b907fb 100644 --- a/proxy/http/HttpConfig.h +++ b/proxy/http/HttpConfig.h @@ -404,6 +404,7 @@ struct OverridableHttpConfigParams { negative_caching_enabled(0), cache_when_to_revalidate(0), keep_alive_enabled_in(0), keep_alive_enabled_out(0), keep_alive_post_out(0), share_server_sessions(0), fwd_proxy_auth_to_parent(0), + insert_age_in_response(1), anonymize_remove_from(0), anonymize_remove_referer(0), anonymize_remove_user_agent(0), anonymize_remove_cookie(0), anonymize_remove_client_ip(0), anonymize_insert_client_ip(1), proxy_response_server_enabled(0), insert_squid_x_forwarded_for(0), @@ -459,6 +460,8 @@ struct OverridableHttpConfigParams { MgmtByte share_server_sessions; MgmtByte fwd_proxy_auth_to_parent; + MgmtByte insert_age_in_response; + /////////////////////////////////////////////////////////////////// // Privacy: fields which are removed from the user agent request // /////////////////////////////////////////////////////////////////// @@ -673,7 +676,6 @@ public: ///////////////////// // Benchmark hacks // ///////////////////// - MgmtByte insert_age_in_response; MgmtByte avoid_content_spoofing; MgmtByte enable_http_stats; @@ -926,7 +928,6 @@ HttpConfigParams::HttpConfigParams() anonymize_other_header_list(NULL), global_user_agent_header(NULL), global_user_agent_header_size(0), - insert_age_in_response(1), avoid_content_spoofing(1), enable_http_stats(1), icp_enabled(0), http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e24e79d0/proxy/http/HttpTransact.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc index 1d524c9..19d405d 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -7871,7 +7871,7 @@ HttpTransact::build_response(State* s, HTTPHdr* base_response, HTTPHdr* outgoing HttpTransactHeaders::copy_header_fields(base_response, outgoing_response, s->txn_conf->fwd_proxy_auth_to_parent); HttpTransactHeaders::process_connection_headers(base_response, outgoing_response); - if (s->http_config_param->insert_age_in_response) + if (s->txn_conf->insert_age_in_response) HttpTransactHeaders::insert_time_and_age_headers_in_response(s->request_sent_time, s->response_received_time, s->current.now, base_response, outgoing_response);
