TS-1255 Make proxy.config.http.normalize_ae_gzip overridable
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/cc0b06a2 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/cc0b06a2 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/cc0b06a2 Branch: refs/heads/master Commit: cc0b06a28afd2c56c2809a28d582489e0e6e6c63 Parents: db2bc67 Author: Leif Hedstrom <[email protected]> Authored: Sun Jul 28 00:59:56 2013 +0200 Committer: Leif Hedstrom <[email protected]> Committed: Thu Aug 1 22:42:48 2013 +0200 ---------------------------------------------------------------------- proxy/InkAPI.cc | 9 +++++++++ proxy/InkAPITest.cc | 3 ++- proxy/api/ts/ts.h.in | 1 + proxy/http/HttpConfig.cc | 6 ++---- proxy/http/HttpConfig.h | 15 +++++++-------- proxy/http/HttpTransact.cc | 2 +- 6 files changed, 22 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cc0b06a2/proxy/InkAPI.cc ---------------------------------------------------------------------- diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc index 3433f7d..7c2f20f 100644 --- a/proxy/InkAPI.cc +++ b/proxy/InkAPI.cc @@ -7565,6 +7565,10 @@ _conf_to_memberp(TSOverridableConfigKey conf, HttpSM* sm, OverridableDataType *t typ = OVERRIDABLE_TYPE_INT; ret = &sm->t_state.txn_conf->cache_range_lookup; break; + case TS_CONFIG_HTTP_NORMALIZE_AE_GZIP: + typ = OVERRIDABLE_TYPE_INT; + ret = &sm->t_state.txn_conf->normalize_ae_gzip; + break; // This helps avoiding compiler warnings, yet detect unhandled enum members. case TS_CONFIG_NULL: @@ -7764,6 +7768,11 @@ TSHttpTxnConfigFind(const char* name, int length, TSOverridableConfigKey *conf, cnf = TS_CONFIG_HTTP_CHUNKING_ENABLED; break; + case 35: + if (!strncmp(name, "proxy.config.http.normalize_ae_gzip", length)) + cnf = TS_CONFIG_HTTP_NORMALIZE_AE_GZIP; + break; + case 36: switch (name[length-1]) { case 'p': http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cc0b06a2/proxy/InkAPITest.cc ---------------------------------------------------------------------- diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc index 6f54a3b..c33ab2b 100644 --- a/proxy/InkAPITest.cc +++ b/proxy/InkAPITest.cc @@ -7396,7 +7396,8 @@ const char *SDK_Overridable_Configs[TS_CONFIG_LAST_ENTRY] = { "proxy.config.http.flow_control.enabled", "proxy.config.http.flow_control.low_water", "proxy.config.http.flow_control.high_water", - "proxy.config.http.cache.range.lookup" + "proxy.config.http.cache.range.lookup", + "proxy.config.http.normalize_ae_gzip" }; REGRESSION_TEST(SDK_API_OVERRIDABLE_CONFIGS) (RegressionTest * test, int /* atype ATS_UNUSED */, int *pstatus) http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cc0b06a2/proxy/api/ts/ts.h.in ---------------------------------------------------------------------- diff --git a/proxy/api/ts/ts.h.in b/proxy/api/ts/ts.h.in index 7793055..e72b1c5 100644 --- a/proxy/api/ts/ts.h.in +++ b/proxy/api/ts/ts.h.in @@ -672,6 +672,7 @@ extern "C" TS_CONFIG_HTTP_FLOW_CONTROL_LOW_WATER_MARK, TS_CONFIG_HTTP_FLOW_CONTROL_HIGH_WATER_MARK, TS_CONFIG_HTTP_CACHE_RANGE_LOOKUP, + TS_CONFIG_HTTP_NORMALIZE_AE_GZIP, TS_CONFIG_LAST_ENTRY, } TSOverridableConfigKey; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cc0b06a2/proxy/http/HttpConfig.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc index fb5b9ed..02b7704 100644 --- a/proxy/http/HttpConfig.cc +++ b/proxy/http/HttpConfig.cc @@ -1236,10 +1236,8 @@ HttpConfig::startup() HttpEstablishStaticConfigByte(c.oride.insert_age_in_response, "proxy.config.http.insert_age_in_response"); - HttpEstablishStaticConfigByte(c.enable_http_stats, "proxy.config.http.enable_http_stats"); - - HttpEstablishStaticConfigByte(c.normalize_ae_gzip, "proxy.config.http.normalize_ae_gzip"); + HttpEstablishStaticConfigByte(c.oride.normalize_ae_gzip, "proxy.config.http.normalize_ae_gzip"); HttpEstablishStaticConfigByte(c.icp_enabled, "proxy.config.icp.enabled"); HttpEstablishStaticConfigByte(c.stale_icp_enabled, "proxy.config.icp.stale_icp_enabled"); @@ -1512,7 +1510,7 @@ HttpConfig::reconfigure() params->oride.insert_squid_x_forwarded_for = INT_TO_BOOL(m_master.oride.insert_squid_x_forwarded_for); params->oride.insert_age_in_response = INT_TO_BOOL(m_master.oride.insert_age_in_response); params->enable_http_stats = INT_TO_BOOL(m_master.enable_http_stats); - params->normalize_ae_gzip = INT_TO_BOOL(m_master.normalize_ae_gzip); + params->oride.normalize_ae_gzip = INT_TO_BOOL(m_master.oride.normalize_ae_gzip); params->icp_enabled = (m_master.icp_enabled == ICP_MODE_SEND_RECEIVE ? 1 : 0); // INT_TO_BOOL params->stale_icp_enabled = INT_TO_BOOL(m_master.stale_icp_enabled); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cc0b06a2/proxy/http/HttpConfig.h ---------------------------------------------------------------------- diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h index 35508a8..bfbe29b 100644 --- a/proxy/http/HttpConfig.h +++ b/proxy/http/HttpConfig.h @@ -411,7 +411,7 @@ struct OverridableHttpConfigParams { cache_ims_on_client_no_cache(1), cache_ignore_server_no_cache(0), cache_responses_to_cookies(1), cache_ignore_auth(0), cache_urls_that_look_dynamic(1), cache_required_headers(2), cache_range_lookup(1), insert_request_via_string(1), insert_response_via_string(0), doc_in_cache_skip_dns(1), - negative_caching_lifetime(1800), + negative_caching_lifetime(1800), normalize_ae_gzip(0), sock_recv_buffer_size_out(0), sock_send_buffer_size_out(0), sock_option_flag_out(0), sock_packet_mark_out(0), sock_packet_tos_out(0), server_tcp_init_cwnd(0), cache_heuristic_min_lifetime(3600), cache_heuristic_max_lifetime(86400), @@ -504,6 +504,11 @@ struct OverridableHttpConfigParams { MgmtInt negative_caching_lifetime; + //////////////////////////////// + // Optimize gzip alternates // + //////////////////////////////// + MgmtByte normalize_ae_gzip; + /////////////////////////////////////// // origin server connection settings // /////////////////////////////////////// @@ -784,11 +789,6 @@ public: MgmtByte ignore_accept_encoding_mismatch; MgmtByte ignore_accept_charset_mismatch; - //////////////////////////////// - // Optimize gzip alternates // - //////////////////////////////// - MgmtByte normalize_ae_gzip; - OverridableHttpConfigParams oride; private: @@ -946,8 +946,7 @@ HttpConfigParams::HttpConfigParams() ignore_accept_mismatch(0), ignore_accept_language_mismatch(0), ignore_accept_encoding_mismatch(0), - ignore_accept_charset_mismatch(0), - normalize_ae_gzip(0) + ignore_accept_charset_mismatch(0) { } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cc0b06a2/proxy/http/HttpTransact.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc index c1cf88d..23696ae 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -1054,7 +1054,7 @@ HttpTransact::ModifyRequest(State* s) } } - if (s->http_config_param->normalize_ae_gzip) { + if (s->txn_conf->normalize_ae_gzip) { // if enabled, force Accept-Encoding header to gzip or no header MIMEField *ae_field = s->hdr_info.client_request.field_find(MIME_FIELD_ACCEPT_ENCODING, MIME_LEN_ACCEPT_ENCODING);
