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 2013/08/01 22:46:30 UTC

[01/10] git commit: TS-1255 Add Req/Resp max header size to be overridable

Updated Branches:
  refs/heads/master cecc082d4 -> 7485e0b5f


TS-1255 Add Req/Resp max header size to be overridable


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/b0e7c2ab
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/b0e7c2ab
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/b0e7c2ab

Branch: refs/heads/master
Commit: b0e7c2ab4a513ff6c0e3f79f65a0ef523fee7882
Parents: 2f98469
Author: Leif Hedstrom <zw...@apache.org>
Authored: Sun Jul 28 22:50:14 2013 +0200
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Thu Aug 1 22:42:48 2013 +0200

----------------------------------------------------------------------
 proxy/InkAPI.cc          | 12 ++++++++++++
 proxy/InkAPITest.cc      |  4 +++-
 proxy/api/ts/ts.h.in     |  4 +++-
 proxy/http/HttpConfig.cc | 12 ++++++------
 proxy/http/HttpConfig.h  | 15 +++++++--------
 proxy/http/HttpSM.cc     |  4 ++--
 6 files changed, 33 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b0e7c2ab/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 1ed9933..99c833d 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -7577,6 +7577,14 @@ _conf_to_memberp(TSOverridableConfigKey conf, HttpSM* sm, OverridableDataType *t
     typ = OVERRIDABLE_TYPE_INT;
     ret = &sm->t_state.txn_conf->default_buffer_water_mark;
     break;
+  case TS_CONFIG_HTTP_REQUEST_HEADER_MAX_SIZE:
+    typ = OVERRIDABLE_TYPE_INT;
+    ret = &sm->t_state.txn_conf->request_hdr_max_size;
+    break;
+  case TS_CONFIG_HTTP_RESPONSE_HEADER_MAX_SIZE:
+    typ = OVERRIDABLE_TYPE_INT;
+    ret = &sm->t_state.txn_conf->response_hdr_max_size;
+    break;
 
     // This helps avoiding compiler warnings, yet detect unhandled enum members.
   case TS_CONFIG_NULL:
@@ -7898,6 +7906,8 @@ TSHttpTxnConfigFind(const char* name, int length, TSOverridableConfigKey *conf,
     case 'e':
       if (!strncmp(name, "proxy.config.http.anonymize_remove_cookie", length))
         cnf = TS_CONFIG_HTTP_ANONYMIZE_REMOVE_COOKIE;
+      else if (!strncmp(name, "proxy.config.http.request_header_max_size", length))
+        cnf = TS_CONFIG_HTTP_REQUEST_HEADER_MAX_SIZE;
       break;
     case 'r':
       if (!strncmp(name, "proxy.config.http.insert_response_via_str", length))
@@ -7917,6 +7927,8 @@ TSHttpTxnConfigFind(const char* name, int length, TSOverridableConfigKey *conf,
     case 'e':
       if (!strncmp(name, "proxy.config.http.cache.when_to_revalidate", length))
         cnf = TS_CONFIG_HTTP_CACHE_WHEN_TO_REVALIDATE;
+      else if (!strncmp(name, "proxy.config.http.response_header_max_size", length))
+        cnf = TS_CONFIG_HTTP_RESPONSE_HEADER_MAX_SIZE;
       break;
     case 'r':
       if (!strncmp(name, "proxy.config.http.anonymize_remove_referer", length))

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b0e7c2ab/proxy/InkAPITest.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
index 42de90c..85cc589 100644
--- a/proxy/InkAPITest.cc
+++ b/proxy/InkAPITest.cc
@@ -7399,7 +7399,9 @@ const char *SDK_Overridable_Configs[TS_CONFIG_LAST_ENTRY] = {
   "proxy.config.http.cache.range.lookup",
   "proxy.config.http.normalize_ae_gzip",
   "proxy.config.http.default_buffer_size",
-  "proxy.config.http.default_buffer_water_mark"
+  "proxy.config.http.default_buffer_water_mark",
+  "proxy.config.http.request_header_max_size",
+  "proxy.config.http.response_header_max_size"
 };
 
 REGRESSION_TEST(SDK_API_OVERRIDABLE_CONFIGS) (RegressionTest * test, int /* atype ATS_UNUSED */, int *pstatus)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b0e7c2ab/proxy/api/ts/ts.h.in
----------------------------------------------------------------------
diff --git a/proxy/api/ts/ts.h.in b/proxy/api/ts/ts.h.in
index b9cd558..47eeaf6 100644
--- a/proxy/api/ts/ts.h.in
+++ b/proxy/api/ts/ts.h.in
@@ -675,7 +675,9 @@ extern "C"
     TS_CONFIG_HTTP_NORMALIZE_AE_GZIP,
     TS_CONFIG_HTTP_DEFAULT_BUFFER_SIZE,
     TS_CONFIG_HTTP_DEFAULT_BUFFER_WATER_MARK,
-    TS_CONFIG_LAST_ENTRY,
+    TS_CONFIG_HTTP_REQUEST_HEADER_MAX_SIZE,
+    TS_CONFIG_HTTP_RESPONSE_HEADER_MAX_SIZE,
+    TS_CONFIG_LAST_ENTRY
   } TSOverridableConfigKey;
 
   /* The TASK pool of threads is the primary method of off-loading continuations from the

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b0e7c2ab/proxy/http/HttpConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index b4db289..c8c0abc 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -1291,9 +1291,8 @@ HttpConfig::startup()
 
   HttpEstablishStaticConfigStringAlloc(c.connect_ports_string, "proxy.config.http.connect_ports");
 
-  HttpEstablishStaticConfigLongLong(c.request_hdr_max_size, "proxy.config.http.request_header_max_size");
-
-  HttpEstablishStaticConfigLongLong(c.response_hdr_max_size, "proxy.config.http.response_header_max_size");
+  HttpEstablishStaticConfigLongLong(c.oride.request_hdr_max_size, "proxy.config.http.request_header_max_size");
+  HttpEstablishStaticConfigLongLong(c.oride.response_hdr_max_size, "proxy.config.http.response_header_max_size");
 
   HttpEstablishStaticConfigByte(c.push_method_enabled, "proxy.config.http.push_method_enabled");
 
@@ -1561,9 +1560,10 @@ HttpConfig::reconfigure()
   params->connect_ports_string = ats_strdup(m_master.connect_ports_string);
   params->connect_ports = parse_ports_list(params->connect_ports_string);
 
-  params->request_hdr_max_size = m_master.request_hdr_max_size;
-  params->response_hdr_max_size = m_master.response_hdr_max_size;
-  params->push_method_enabled = INT_TO_BOOL(m_master.push_method_enabled);
+  params->oride.request_hdr_max_size = m_master.oride.request_hdr_max_size;
+  params->oride.response_hdr_max_size = m_master.oride.response_hdr_max_size;
+  
+params->push_method_enabled = INT_TO_BOOL(m_master.push_method_enabled);
 
   params->reverse_proxy_enabled = INT_TO_BOOL(m_master.reverse_proxy_enabled);
   params->url_remap_required = INT_TO_BOOL(m_master.url_remap_required);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b0e7c2ab/proxy/http/HttpConfig.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index 27a96e7..de47b94 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -414,6 +414,7 @@ struct OverridableHttpConfigParams {
       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),
+      request_hdr_max_size(131072), response_hdr_max_size(131072),
       cache_heuristic_min_lifetime(3600), cache_heuristic_max_lifetime(86400),
       cache_guaranteed_min_lifetime(0), cache_guaranteed_max_lifetime(31536000), cache_max_stale_age(604800),
       keep_alive_no_activity_timeout_in(115), keep_alive_no_activity_timeout_out(120),
@@ -524,6 +525,12 @@ struct OverridableHttpConfigParams {
   ///////////////////////////////
   MgmtInt server_tcp_init_cwnd;
 
+  ///////////////
+  // Hdr Limit //
+  ///////////////
+  MgmtInt request_hdr_max_size;
+  MgmtInt response_hdr_max_size;
+
   /////////////////////
   // cache variables //
   /////////////////////
@@ -702,12 +709,6 @@ public:
   char *connect_ports_string;
   HttpConfigPortRange *connect_ports;
 
-  ///////////////
-  // Hdr Limit //
-  ///////////////
-  MgmtInt request_hdr_max_size;
-  MgmtInt response_hdr_max_size;
-
   //////////
   // Push //
   //////////
@@ -923,8 +924,6 @@ HttpConfigParams::HttpConfigParams()
     cache_when_to_add_no_cache_to_msie_requests(-1),
     connect_ports_string(NULL),
     connect_ports(NULL),
-    request_hdr_max_size(131072),
-    response_hdr_max_size(131072),
     push_method_enabled(0),
     referer_filter_enabled(0),
     referer_format_redirect(0),

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b0e7c2ab/proxy/http/HttpSM.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 5647f22..5b879bc 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -720,7 +720,7 @@ HttpSM::state_read_client_request_header(int event, void *data)
   client_request_hdr_bytes += bytes_used;
 
   // Check to see if we are over the hdr size limit
-  if (client_request_hdr_bytes > t_state.http_config_param->request_hdr_max_size) {
+  if (client_request_hdr_bytes > t_state.txn_conf->request_hdr_max_size) {
     DebugSM("http", "client header bytes were over max header size; treating as a bad request");
     state = PARSE_ERROR;
   }
@@ -1776,7 +1776,7 @@ HttpSM::state_read_server_response_header(int event, void *data)
     state = PARSE_ERROR;
   }
   // Check to see if we are over the hdr size limit
-  if (server_response_hdr_bytes > t_state.http_config_param->response_hdr_max_size) {
+  if (server_response_hdr_bytes > t_state.txn_conf->response_hdr_max_size) {
     state = PARSE_ERROR;
   }
 


[05/10] git commit: TS-1255 Set all HTTP configs to their defaults, to be consistent

Posted by zw...@apache.org.
TS-1255 Set all HTTP configs to their defaults, to be consistent


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/db2bc67c
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/db2bc67c
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/db2bc67c

Branch: refs/heads/master
Commit: db2bc67cf2c6679c50cb84a7f1fb2dfacaa80eca
Parents: bb6939c
Author: Leif Hedstrom <zw...@apache.org>
Authored: Sat Jul 27 03:35:04 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Thu Aug 1 22:42:48 2013 +0200

----------------------------------------------------------------------
 proxy/http/HttpConfig.h | 125 ++++++++++++++++++++-----------------------
 1 file changed, 59 insertions(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/db2bc67c/proxy/http/HttpConfig.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index cbee1fd..35508a8 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -400,43 +400,36 @@ struct HttpConfigPortRange
 // to be overridable per transaction more easily.
 struct OverridableHttpConfigParams {
   OverridableHttpConfigParams()
-    :  maintain_pristine_host_hdr(0), chunking_enabled(0),
-       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),
-       send_http11_requests(3),
-       cache_http(0), cache_cluster_cache_local(0), cache_ignore_client_no_cache(0), cache_ignore_client_cc_max_age(1),
-       cache_ims_on_client_no_cache(0), cache_ignore_server_no_cache(0), cache_responses_to_cookies(0),
-       cache_ignore_auth(0), cache_urls_that_look_dynamic(0), cache_required_headers(0), cache_range_lookup(1),
-       insert_request_via_string(0), insert_response_via_string(0), doc_in_cache_skip_dns(1),
-       negative_caching_lifetime(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(0), cache_heuristic_max_lifetime(0),
-       cache_guaranteed_min_lifetime(0), cache_guaranteed_max_lifetime(0), cache_max_stale_age(0),
-       keep_alive_no_activity_timeout_in(0),
-       keep_alive_no_activity_timeout_out(0),
-       transaction_no_activity_timeout_in(0), transaction_no_activity_timeout_out(0),
-       transaction_active_timeout_out(0),
-       origin_max_connections(0),
-       connect_attempts_max_retries(0), connect_attempts_max_retries_dead_server(0),
-       connect_attempts_rr_retries(0), connect_attempts_timeout(0),
-       post_connect_attempts_timeout(0),
-       down_server_timeout(0), client_abort_threshold(0),
-       freshness_fuzz_time(0), freshness_fuzz_min_time(0),
-       max_cache_open_read_retries(0), cache_open_read_retry_time(0),
-       background_fill_active_timeout(0),
-       http_chunking_size(0), flow_high_water_mark(0), flow_low_water_mark(0),
-
-       // Strings / floats must come last
-       proxy_response_server_string(NULL), proxy_response_server_string_len(0),
-       cache_heuristic_lm_factor(0.0), freshness_fuzz_prob(0.0),
-       background_fill_threshold(0.5)
+    : maintain_pristine_host_hdr(1), chunking_enabled(1),
+      negative_caching_enabled(0), cache_when_to_revalidate(0),
+      keep_alive_enabled_in(1), keep_alive_enabled_out(1), keep_alive_post_out(0),
+      share_server_sessions(2), 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(1), insert_squid_x_forwarded_for(1), send_http11_requests(1),
+      cache_http(1), cache_cluster_cache_local(0), cache_ignore_client_no_cache(1), cache_ignore_client_cc_max_age(0),
+      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),
+      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),
+      cache_guaranteed_min_lifetime(0), cache_guaranteed_max_lifetime(31536000), cache_max_stale_age(604800),
+      keep_alive_no_activity_timeout_in(115), keep_alive_no_activity_timeout_out(120),
+      transaction_no_activity_timeout_in(30), transaction_no_activity_timeout_out(30),
+      transaction_active_timeout_out(0), origin_max_connections(0),
+      connect_attempts_max_retries(0), connect_attempts_max_retries_dead_server(3),
+      connect_attempts_rr_retries(3), connect_attempts_timeout(30),
+      post_connect_attempts_timeout(1800), down_server_timeout(300), client_abort_threshold(10),
+      freshness_fuzz_time(240), freshness_fuzz_min_time(0),
+      max_cache_open_read_retries(-1), cache_open_read_retry_time(10), background_fill_active_timeout(60),
+      http_chunking_size(4096), flow_high_water_mark(0), flow_low_water_mark(0),
+
+      // Strings / floats must come last
+      proxy_response_server_string(NULL), proxy_response_server_string_len(0),
+      cache_heuristic_lm_factor(0.10), freshness_fuzz_prob(0.005),
+      background_fill_threshold(0.5)
   { }
 
   // A few rules here:
@@ -887,7 +880,7 @@ extern volatile int32_t icp_dynamic_enabled;
 /////////////////////////////////////////////////////////////
 inline
 HttpConfigParams::HttpConfigParams()
-  : proxy_hostname(0),
+  : proxy_hostname(NULL),
     proxy_hostname_len(0),
     server_max_connections(0),
     origin_min_keep_alive_connections(0),
@@ -899,62 +892,62 @@ HttpConfigParams::HttpConfigParams()
     no_origin_server_dns(0),
     use_client_target_addr(0),
     use_client_source_port(0),
-    proxy_request_via_string(0),
+    proxy_request_via_string(NULL),
     proxy_request_via_string_len(0),
-    proxy_response_via_string(0),
+    proxy_response_via_string(NULL),
     proxy_response_via_string_len(0),
-    url_expansions_string(0),
-    url_expansions(0),
+    url_expansions_string(NULL),
+    url_expansions(NULL),
     num_url_expansions(0),
-    session_auth_cache_keep_alive_enabled(0),
-    origin_server_pipeline(0),
-    user_agent_pipeline(0),
-    transaction_active_timeout_in(0),
-    accept_no_activity_timeout(0),
-    parent_connect_attempts(0),
-    per_parent_connect_attempts(0),
-    parent_connect_timeout(0),
+    session_auth_cache_keep_alive_enabled(1),
+    origin_server_pipeline(1),
+    user_agent_pipeline(8),
+    transaction_active_timeout_in(900),
+    accept_no_activity_timeout(120),
+    parent_connect_attempts(4),
+    per_parent_connect_attempts(2),
+    parent_connect_timeout(30),
     anonymize_other_header_list(NULL),
     global_user_agent_header(NULL),
     global_user_agent_header_size(0),
     enable_http_stats(1),
     icp_enabled(0),
     stale_icp_enabled(0),
-    cache_vary_default_text(0),
-    cache_vary_default_images(0),
-    cache_vary_default_other(0),
-    max_cache_open_write_retries(0),
+    cache_vary_default_text(NULL),
+    cache_vary_default_images(NULL),
+    cache_vary_default_other(NULL),
+    max_cache_open_write_retries(1),
     cache_enable_default_vary_headers(0),
-    cache_when_to_add_no_cache_to_msie_requests(0),
-    connect_ports_string(0),
-    connect_ports(0),
+    cache_when_to_add_no_cache_to_msie_requests(-1),
+    connect_ports_string(NULL),
+    connect_ports(NULL),
     request_hdr_max_size(131072),
     response_hdr_max_size(131072),
     push_method_enabled(0),
     referer_filter_enabled(0),
     referer_format_redirect(0),
     accept_encoding_filter_enabled(0),
-    client_transparency_enabled(0),
-    server_transparency_enabled(0),
+    client_transparency_enabled(false),
+    server_transparency_enabled(false),
     reverse_proxy_enabled(0),
-    url_remap_required(0),
+    url_remap_required(1),
     negative_revalidating_enabled(0),
-    negative_revalidating_lifetime(0),
+    negative_revalidating_lifetime(1800),
     record_cop_page(0),
     record_tcp_mem_hit(0),
-    errors_log_error_pages(0),
-    default_buffer_size_index(0),
-    default_buffer_water_mark(0),
+    errors_log_error_pages(1),
+    default_buffer_size_index(8),
+    default_buffer_water_mark(32768),
     enable_http_info(0),
     cluster_time_delta(0),
     redirection_enabled(1),
-    number_of_redirections(0),
+    number_of_redirections(1),
     post_copy_size(2048),
     ignore_accept_mismatch(0),
     ignore_accept_language_mismatch(0),
     ignore_accept_encoding_mismatch(0),
     ignore_accept_charset_mismatch(0),
-    normalize_ae_gzip(1)
+    normalize_ae_gzip(0)
 {
 }
 


Re: [01/10] git commit: TS-1255 Add Req/Resp max header size to be overridable

Posted by Leif Hedstrom <le...@ogre.com>.
On Aug 1, 2013, at 11:00 PM, James Peach <jp...@apache.org> wrote:
> On Aug 1, 2013, at 1:46 PM, zwoop@apache.org wrote:
> 
>> Updated Branches:
>> refs/heads/master cecc082d4 -> 7485e0b5f
>> 
>> 
>> TS-1255 Add Req/Resp max header size to be overridable
> 
> Would it be more robust to use a lookup table for the overridable value types?
> 
> static const
> struct {
>    OverridableDataType o_type;
>    size_t o_offset;
> } overridable[] = {
> 
>  /* TS_CONFIG_URL_REMAP_PRISTINE_HOST_HDR */
>  { OVERRIDABLE_TYPE_BYTE, offsetof(OverridableHttpConfigParams, maintain_pristine_host_hdr},


Seems reasonable. File a bug, and fix it after v3.4 ?

-- leif


Re: [01/10] git commit: TS-1255 Add Req/Resp max header size to be overridable

Posted by James Peach <jp...@apache.org>.
On Aug 1, 2013, at 1:46 PM, zwoop@apache.org wrote:

> Updated Branches:
>  refs/heads/master cecc082d4 -> 7485e0b5f
> 
> 
> TS-1255 Add Req/Resp max header size to be overridable

Would it be more robust to use a lookup table for the overridable value types?

static const
struct {
    OverridableDataType o_type;
    size_t o_offset;
} overridable[] = {

  /* TS_CONFIG_URL_REMAP_PRISTINE_HOST_HDR */
  { OVERRIDABLE_TYPE_BYTE, offsetof(OverridableHttpConfigParams, maintain_pristine_host_hdr},

  ...
};

void*
_conf_to_memberp(TSOverridableConfigKey conf, HttpSM* sm, OverridableDataType *typep)
{

    *typep = overridable[conf].o_type;
    return  ((uint8_t *)(sm->t_state.txn_conf)) + overridable[conf].o_offset;
}

> 
> 
> Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
> Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/b0e7c2ab
> Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/b0e7c2ab
> Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/b0e7c2ab
> 
> Branch: refs/heads/master
> Commit: b0e7c2ab4a513ff6c0e3f79f65a0ef523fee7882
> Parents: 2f98469
> Author: Leif Hedstrom <zw...@apache.org>
> Authored: Sun Jul 28 22:50:14 2013 +0200
> Committer: Leif Hedstrom <zw...@apache.org>
> Committed: Thu Aug 1 22:42:48 2013 +0200
> 
> ----------------------------------------------------------------------
> proxy/InkAPI.cc          | 12 ++++++++++++
> proxy/InkAPITest.cc      |  4 +++-
> proxy/api/ts/ts.h.in     |  4 +++-
> proxy/http/HttpConfig.cc | 12 ++++++------
> proxy/http/HttpConfig.h  | 15 +++++++--------
> proxy/http/HttpSM.cc     |  4 ++--
> 6 files changed, 33 insertions(+), 18 deletions(-)
> ----------------------------------------------------------------------
> 
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b0e7c2ab/proxy/InkAPI.cc
> ----------------------------------------------------------------------
> diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
> index 1ed9933..99c833d 100644
> --- a/proxy/InkAPI.cc
> +++ b/proxy/InkAPI.cc
> @@ -7577,6 +7577,14 @@ _conf_to_memberp(TSOverridableConfigKey conf, HttpSM* sm, OverridableDataType *t
>     typ = OVERRIDABLE_TYPE_INT;
>     ret = &sm->t_state.txn_conf->default_buffer_water_mark;
>     break;
> +  case TS_CONFIG_HTTP_REQUEST_HEADER_MAX_SIZE:
> +    typ = OVERRIDABLE_TYPE_INT;
> +    ret = &sm->t_state.txn_conf->request_hdr_max_size;
> +    break;
> +  case TS_CONFIG_HTTP_RESPONSE_HEADER_MAX_SIZE:
> +    typ = OVERRIDABLE_TYPE_INT;
> +    ret = &sm->t_state.txn_conf->response_hdr_max_size;
> +    break;
> 
>     // This helps avoiding compiler warnings, yet detect unhandled enum members.
>   case TS_CONFIG_NULL:
> @@ -7898,6 +7906,8 @@ TSHttpTxnConfigFind(const char* name, int length, TSOverridableConfigKey *conf,
>     case 'e':
>       if (!strncmp(name, "proxy.config.http.anonymize_remove_cookie", length))
>         cnf = TS_CONFIG_HTTP_ANONYMIZE_REMOVE_COOKIE;
> +      else if (!strncmp(name, "proxy.config.http.request_header_max_size", length))
> +        cnf = TS_CONFIG_HTTP_REQUEST_HEADER_MAX_SIZE;
>       break;
>     case 'r':
>       if (!strncmp(name, "proxy.config.http.insert_response_via_str", length))
> @@ -7917,6 +7927,8 @@ TSHttpTxnConfigFind(const char* name, int length, TSOverridableConfigKey *conf,
>     case 'e':
>       if (!strncmp(name, "proxy.config.http.cache.when_to_revalidate", length))
>         cnf = TS_CONFIG_HTTP_CACHE_WHEN_TO_REVALIDATE;
> +      else if (!strncmp(name, "proxy.config.http.response_header_max_size", length))
> +        cnf = TS_CONFIG_HTTP_RESPONSE_HEADER_MAX_SIZE;
>       break;
>     case 'r':
>       if (!strncmp(name, "proxy.config.http.anonymize_remove_referer", length))
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b0e7c2ab/proxy/InkAPITest.cc
> ----------------------------------------------------------------------
> diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
> index 42de90c..85cc589 100644
> --- a/proxy/InkAPITest.cc
> +++ b/proxy/InkAPITest.cc
> @@ -7399,7 +7399,9 @@ const char *SDK_Overridable_Configs[TS_CONFIG_LAST_ENTRY] = {
>   "proxy.config.http.cache.range.lookup",
>   "proxy.config.http.normalize_ae_gzip",
>   "proxy.config.http.default_buffer_size",
> -  "proxy.config.http.default_buffer_water_mark"
> +  "proxy.config.http.default_buffer_water_mark",
> +  "proxy.config.http.request_header_max_size",
> +  "proxy.config.http.response_header_max_size"
> };
> 
> REGRESSION_TEST(SDK_API_OVERRIDABLE_CONFIGS) (RegressionTest * test, int /* atype ATS_UNUSED */, int *pstatus)
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b0e7c2ab/proxy/api/ts/ts.h.in
> ----------------------------------------------------------------------
> diff --git a/proxy/api/ts/ts.h.in b/proxy/api/ts/ts.h.in
> index b9cd558..47eeaf6 100644
> --- a/proxy/api/ts/ts.h.in
> +++ b/proxy/api/ts/ts.h.in
> @@ -675,7 +675,9 @@ extern "C"
>     TS_CONFIG_HTTP_NORMALIZE_AE_GZIP,
>     TS_CONFIG_HTTP_DEFAULT_BUFFER_SIZE,
>     TS_CONFIG_HTTP_DEFAULT_BUFFER_WATER_MARK,
> -    TS_CONFIG_LAST_ENTRY,
> +    TS_CONFIG_HTTP_REQUEST_HEADER_MAX_SIZE,
> +    TS_CONFIG_HTTP_RESPONSE_HEADER_MAX_SIZE,
> +    TS_CONFIG_LAST_ENTRY
>   } TSOverridableConfigKey;
> 
>   /* The TASK pool of threads is the primary method of off-loading continuations from the
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b0e7c2ab/proxy/http/HttpConfig.cc
> ----------------------------------------------------------------------
> diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
> index b4db289..c8c0abc 100644
> --- a/proxy/http/HttpConfig.cc
> +++ b/proxy/http/HttpConfig.cc
> @@ -1291,9 +1291,8 @@ HttpConfig::startup()
> 
>   HttpEstablishStaticConfigStringAlloc(c.connect_ports_string, "proxy.config.http.connect_ports");
> 
> -  HttpEstablishStaticConfigLongLong(c.request_hdr_max_size, "proxy.config.http.request_header_max_size");
> -
> -  HttpEstablishStaticConfigLongLong(c.response_hdr_max_size, "proxy.config.http.response_header_max_size");
> +  HttpEstablishStaticConfigLongLong(c.oride.request_hdr_max_size, "proxy.config.http.request_header_max_size");
> +  HttpEstablishStaticConfigLongLong(c.oride.response_hdr_max_size, "proxy.config.http.response_header_max_size");
> 
>   HttpEstablishStaticConfigByte(c.push_method_enabled, "proxy.config.http.push_method_enabled");
> 
> @@ -1561,9 +1560,10 @@ HttpConfig::reconfigure()
>   params->connect_ports_string = ats_strdup(m_master.connect_ports_string);
>   params->connect_ports = parse_ports_list(params->connect_ports_string);
> 
> -  params->request_hdr_max_size = m_master.request_hdr_max_size;
> -  params->response_hdr_max_size = m_master.response_hdr_max_size;
> -  params->push_method_enabled = INT_TO_BOOL(m_master.push_method_enabled);
> +  params->oride.request_hdr_max_size = m_master.oride.request_hdr_max_size;
> +  params->oride.response_hdr_max_size = m_master.oride.response_hdr_max_size;
> +  
> +params->push_method_enabled = INT_TO_BOOL(m_master.push_method_enabled);
> 
>   params->reverse_proxy_enabled = INT_TO_BOOL(m_master.reverse_proxy_enabled);
>   params->url_remap_required = INT_TO_BOOL(m_master.url_remap_required);
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b0e7c2ab/proxy/http/HttpConfig.h
> ----------------------------------------------------------------------
> diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
> index 27a96e7..de47b94 100644
> --- a/proxy/http/HttpConfig.h
> +++ b/proxy/http/HttpConfig.h
> @@ -414,6 +414,7 @@ struct OverridableHttpConfigParams {
>       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),
> +      request_hdr_max_size(131072), response_hdr_max_size(131072),
>       cache_heuristic_min_lifetime(3600), cache_heuristic_max_lifetime(86400),
>       cache_guaranteed_min_lifetime(0), cache_guaranteed_max_lifetime(31536000), cache_max_stale_age(604800),
>       keep_alive_no_activity_timeout_in(115), keep_alive_no_activity_timeout_out(120),
> @@ -524,6 +525,12 @@ struct OverridableHttpConfigParams {
>   ///////////////////////////////
>   MgmtInt server_tcp_init_cwnd;
> 
> +  ///////////////
> +  // Hdr Limit //
> +  ///////////////
> +  MgmtInt request_hdr_max_size;
> +  MgmtInt response_hdr_max_size;
> +
>   /////////////////////
>   // cache variables //
>   /////////////////////
> @@ -702,12 +709,6 @@ public:
>   char *connect_ports_string;
>   HttpConfigPortRange *connect_ports;
> 
> -  ///////////////
> -  // Hdr Limit //
> -  ///////////////
> -  MgmtInt request_hdr_max_size;
> -  MgmtInt response_hdr_max_size;
> -
>   //////////
>   // Push //
>   //////////
> @@ -923,8 +924,6 @@ HttpConfigParams::HttpConfigParams()
>     cache_when_to_add_no_cache_to_msie_requests(-1),
>     connect_ports_string(NULL),
>     connect_ports(NULL),
> -    request_hdr_max_size(131072),
> -    response_hdr_max_size(131072),
>     push_method_enabled(0),
>     referer_filter_enabled(0),
>     referer_format_redirect(0),
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b0e7c2ab/proxy/http/HttpSM.cc
> ----------------------------------------------------------------------
> diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
> index 5647f22..5b879bc 100644
> --- a/proxy/http/HttpSM.cc
> +++ b/proxy/http/HttpSM.cc
> @@ -720,7 +720,7 @@ HttpSM::state_read_client_request_header(int event, void *data)
>   client_request_hdr_bytes += bytes_used;
> 
>   // Check to see if we are over the hdr size limit
> -  if (client_request_hdr_bytes > t_state.http_config_param->request_hdr_max_size) {
> +  if (client_request_hdr_bytes > t_state.txn_conf->request_hdr_max_size) {
>     DebugSM("http", "client header bytes were over max header size; treating as a bad request");
>     state = PARSE_ERROR;
>   }
> @@ -1776,7 +1776,7 @@ HttpSM::state_read_server_response_header(int event, void *data)
>     state = PARSE_ERROR;
>   }
>   // Check to see if we are over the hdr size limit
> -  if (server_response_hdr_bytes > t_state.http_config_param->response_hdr_max_size) {
> +  if (server_response_hdr_bytes > t_state.txn_conf->response_hdr_max_size) {
>     state = PARSE_ERROR;
>   }
> 
> 


[02/10] git commit: TS-1255 Added buffer size configurations to overridable

Posted by zw...@apache.org.
TS-1255 Added buffer size configurations to overridable


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/2f984695
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/2f984695
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/2f984695

Branch: refs/heads/master
Commit: 2f98469585cd0368232cd90f7acd8a90dbb7bff6
Parents: cc0b06a
Author: Leif Hedstrom <zw...@apache.org>
Authored: Sun Jul 28 21:57:39 2013 +0200
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Thu Aug 1 22:42:48 2013 +0200

----------------------------------------------------------------------
 proxy/InkAPI.cc          | 14 ++++++++++++++
 proxy/InkAPITest.cc      |  4 +++-
 proxy/api/ts/ts.h.in     |  2 ++
 proxy/http/HttpConfig.cc | 12 +++++-------
 proxy/http/HttpConfig.h  |  8 ++++----
 proxy/http/HttpSM.cc     | 10 +++++-----
 6 files changed, 33 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2f984695/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 7c2f20f..1ed9933 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -7569,6 +7569,14 @@ _conf_to_memberp(TSOverridableConfigKey conf, HttpSM* sm, OverridableDataType *t
     typ = OVERRIDABLE_TYPE_INT;
     ret = &sm->t_state.txn_conf->normalize_ae_gzip;
     break;
+  case TS_CONFIG_HTTP_DEFAULT_BUFFER_SIZE:
+    typ = OVERRIDABLE_TYPE_INT;
+    ret = &sm->t_state.txn_conf->default_buffer_size_index;
+    break;
+  case TS_CONFIG_HTTP_DEFAULT_BUFFER_WATER_MARK:
+    typ = OVERRIDABLE_TYPE_INT;
+    ret = &sm->t_state.txn_conf->default_buffer_water_mark;
+    break;
 
     // This helps avoiding compiler warnings, yet detect unhandled enum members.
   case TS_CONFIG_NULL:
@@ -7793,6 +7801,8 @@ TSHttpTxnConfigFind(const char* name, int length, TSOverridableConfigKey *conf,
         cnf = TS_CONFIG_HTTP_CACHE_MAX_STALE_AGE;
       else if (!strncmp(name, "proxy.config.http.cache.fuzz.min_time", length))
         cnf = TS_CONFIG_HTTP_CACHE_FUZZ_MIN_TIME;
+      else if (!strncmp(name, "proxy.config.http.default_buffer_size", length))
+        cnf = TS_CONFIG_HTTP_DEFAULT_BUFFER_SIZE;
       break;
     case 'r':
       if (!strncmp(name, "proxy.config.http.response_server_str", length)) {
@@ -7929,6 +7939,10 @@ TSHttpTxnConfigFind(const char* name, int length, TSOverridableConfigKey *conf,
       if (!strncmp(name, "proxy.config.http.negative_caching_lifetime", length))
         cnf = TS_CONFIG_HTTP_NEGATIVE_CACHING_LIFETIME;
       break;
+    case 'k':
+      if (!strncmp(name, "proxy.config.http.default_buffer_water_mark", length))
+        cnf = TS_CONFIG_HTTP_DEFAULT_BUFFER_WATER_MARK;
+      break;
     case 'l':
       if (!strncmp(name, "proxy.config.http.cache.cluster_cache_local", length))
         cnf = TS_CONFIG_HTTP_CACHE_CLUSTER_CACHE_LOCAL;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2f984695/proxy/InkAPITest.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
index c33ab2b..42de90c 100644
--- a/proxy/InkAPITest.cc
+++ b/proxy/InkAPITest.cc
@@ -7397,7 +7397,9 @@ const char *SDK_Overridable_Configs[TS_CONFIG_LAST_ENTRY] = {
   "proxy.config.http.flow_control.low_water",
   "proxy.config.http.flow_control.high_water",
   "proxy.config.http.cache.range.lookup",
-  "proxy.config.http.normalize_ae_gzip"
+  "proxy.config.http.normalize_ae_gzip",
+  "proxy.config.http.default_buffer_size",
+  "proxy.config.http.default_buffer_water_mark"
 };
 
 REGRESSION_TEST(SDK_API_OVERRIDABLE_CONFIGS) (RegressionTest * test, int /* atype ATS_UNUSED */, int *pstatus)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2f984695/proxy/api/ts/ts.h.in
----------------------------------------------------------------------
diff --git a/proxy/api/ts/ts.h.in b/proxy/api/ts/ts.h.in
index e72b1c5..b9cd558 100644
--- a/proxy/api/ts/ts.h.in
+++ b/proxy/api/ts/ts.h.in
@@ -673,6 +673,8 @@ extern "C"
     TS_CONFIG_HTTP_FLOW_CONTROL_HIGH_WATER_MARK,
     TS_CONFIG_HTTP_CACHE_RANGE_LOOKUP,
     TS_CONFIG_HTTP_NORMALIZE_AE_GZIP,
+    TS_CONFIG_HTTP_DEFAULT_BUFFER_SIZE,
+    TS_CONFIG_HTTP_DEFAULT_BUFFER_WATER_MARK,
     TS_CONFIG_LAST_ENTRY,
   } TSOverridableConfigKey;
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2f984695/proxy/http/HttpConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index 02b7704..b4db289 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -1329,11 +1329,9 @@ HttpConfig::startup()
   HttpEstablishStaticConfigByte(c.oride.negative_caching_enabled, "proxy.config.http.negative_caching_enabled");
   HttpEstablishStaticConfigLongLong(c.oride.negative_caching_lifetime, "proxy.config.http.negative_caching_lifetime");
 
-  // Buffer size
-  HttpEstablishStaticConfigLongLong(c.default_buffer_size_index, "proxy.config.http.default_buffer_size");
-
-  // Buffer water mark
-  HttpEstablishStaticConfigLongLong(c.default_buffer_water_mark, "proxy.config.http.default_buffer_water_mark");
+  // Buffer size and watermark
+  HttpEstablishStaticConfigLongLong(c.oride.default_buffer_size_index, "proxy.config.http.default_buffer_size");
+  HttpEstablishStaticConfigLongLong(c.oride.default_buffer_water_mark, "proxy.config.http.default_buffer_water_mark");
 
   // Stat Page Info
   HttpEstablishStaticConfigByte(c.enable_http_info, "proxy.config.http.enable_http_info");
@@ -1575,8 +1573,8 @@ HttpConfig::reconfigure()
   params->record_tcp_mem_hit = INT_TO_BOOL(m_master.record_tcp_mem_hit);
   params->oride.send_http11_requests = m_master.oride.send_http11_requests;
   params->oride.doc_in_cache_skip_dns = INT_TO_BOOL(m_master.oride.doc_in_cache_skip_dns);
-  params->default_buffer_size_index = m_master.default_buffer_size_index;
-  params->default_buffer_water_mark = m_master.default_buffer_water_mark;
+  params->oride.default_buffer_size_index = m_master.oride.default_buffer_size_index;
+  params->oride.default_buffer_water_mark = m_master.oride.default_buffer_water_mark;
   params->enable_http_info = INT_TO_BOOL(m_master.enable_http_info);
   params->reverse_proxy_no_host_redirect = ats_strdup(m_master.reverse_proxy_no_host_redirect);
   params->reverse_proxy_no_host_redirect_len =

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2f984695/proxy/http/HttpConfig.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index bfbe29b..27a96e7 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -425,6 +425,7 @@ struct OverridableHttpConfigParams {
       freshness_fuzz_time(240), freshness_fuzz_min_time(0),
       max_cache_open_read_retries(-1), cache_open_read_retry_time(10), background_fill_active_timeout(60),
       http_chunking_size(4096), flow_high_water_mark(0), flow_low_water_mark(0),
+      default_buffer_size_index(8), default_buffer_water_mark(32768),
 
       // Strings / floats must come last
       proxy_response_server_string(NULL), proxy_response_server_string_len(0),
@@ -570,6 +571,9 @@ struct OverridableHttpConfigParams {
   MgmtInt flow_high_water_mark; ///< Flow control high water mark.
   MgmtInt flow_low_water_mark; ///< Flow control low water mark.
 
+  MgmtInt default_buffer_size_index;
+  MgmtInt default_buffer_water_mark;
+
   // IMPORTANT: Here comes all strings / floats configs.
 
   ///////////////////////////////////////////////////////////////////
@@ -758,8 +762,6 @@ public:
   MgmtByte errors_log_error_pages;
   MgmtInt slow_log_threshold;
 
-  MgmtInt default_buffer_size_index;
-  MgmtInt default_buffer_water_mark;
   MgmtByte enable_http_info;
 
   // Cluster time delta is not a config variable,
@@ -936,8 +938,6 @@ HttpConfigParams::HttpConfigParams()
     record_cop_page(0),
     record_tcp_mem_hit(0),
     errors_log_error_pages(1),
-    default_buffer_size_index(8),
-    default_buffer_water_mark(32768),
     enable_http_info(0),
     cluster_time_delta(0),
     redirection_enabled(1),

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2f984695/proxy/http/HttpSM.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 51f8a66..5647f22 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -5202,7 +5202,7 @@ HttpSM::do_setup_post_tunnel(HttpVC_t to_vc_type)
     int64_t alloc_index;
     // content length is undefined, use default buffer size
     if (t_state.hdr_info.request_content_length == HTTP_UNDEFINED_CL) {
-      alloc_index = (int) t_state.http_config_param->default_buffer_size_index;
+      alloc_index = (int) t_state.txn_conf->default_buffer_size_index;
       if (alloc_index<MIN_CONFIG_BUFFER_SIZE_INDEX || alloc_index> MAX_BUFFER_SIZE_INDEX) {
         alloc_index = DEFAULT_REQUEST_BUFFER_SIZE_INDEX;
       }
@@ -5639,7 +5639,7 @@ HttpSM::setup_cache_read_transfer()
   buf->append_block(HTTP_HEADER_BUFFER_SIZE_INDEX);
 #endif
 
-  buf->water_mark = (int) t_state.http_config_param->default_buffer_water_mark;
+  buf->water_mark = (int) t_state.txn_conf->default_buffer_water_mark;
 
   IOBufferReader *buf_start = buf->alloc_reader();
 
@@ -5884,7 +5884,7 @@ HttpSM::find_http_resp_buffer_size(int64_t content_length)
   if (content_length == HTTP_UNDEFINED_CL) {
     // Try use our configured default size.  Otherwise pick
     //   the default size
-    alloc_index = (int) t_state.http_config_param->default_buffer_size_index;
+    alloc_index = (int) t_state.txn_conf->default_buffer_size_index;
     if (alloc_index<MIN_CONFIG_BUFFER_SIZE_INDEX || alloc_index> DEFAULT_MAX_BUFFER_SIZE) {
       alloc_index = DEFAULT_RESPONSE_BUFFER_SIZE_INDEX;
     }
@@ -6002,7 +6002,7 @@ HttpSM::setup_transfer_from_transform()
 
   // TODO change this call to new_empty_MIOBuffer()
   MIOBuffer *buf = new_MIOBuffer(alloc_index);
-  buf->water_mark = (int) t_state.http_config_param->default_buffer_water_mark;
+  buf->water_mark = (int) t_state.txn_conf->default_buffer_water_mark;
   IOBufferReader *buf_start = buf->alloc_reader();
 
   HttpTunnelConsumer *c = tunnel.get_consumer(transform_info.vc);
@@ -6117,7 +6117,7 @@ HttpSM::setup_server_transfer()
   MIOBuffer *buf = new_empty_MIOBuffer(alloc_index);
   buf->append_block(HTTP_HEADER_BUFFER_SIZE_INDEX);
 #endif
-  buf->water_mark = (int) t_state.http_config_param->default_buffer_water_mark;
+  buf->water_mark = (int) t_state.txn_conf->default_buffer_water_mark;
   IOBufferReader *buf_start = buf->alloc_reader();
 
   // we need to know if we are going to chunk the response or not


[08/10] git commit: TS-1255 Add negative revalidation as overridable configs, and cleanup

Posted by zw...@apache.org.
TS-1255 Add negative revalidation as overridable configs, and cleanup


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/ec65b119
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/ec65b119
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/ec65b119

Branch: refs/heads/master
Commit: ec65b1193fcb9bcd6ee2150160c94d6825a85a25
Parents: b0e7c2a
Author: Leif Hedstrom <zw...@apache.org>
Authored: Sun Jul 28 23:59:53 2013 +0200
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Thu Aug 1 22:42:49 2013 +0200

----------------------------------------------------------------------
 .../configuration/records.config.en.rst         |  3 +++
 proxy/InkAPI.cc                                 | 14 +++++++++++++
 proxy/InkAPITest.cc                             |  4 +++-
 proxy/api/ts/ts.h.in                            |  2 ++
 proxy/http/HttpConfig.cc                        | 15 ++++++-------
 proxy/http/HttpConfig.h                         | 22 +++++++++-----------
 proxy/http/HttpTransact.cc                      |  4 ++--
 7 files changed, 40 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ec65b119/doc/reference/configuration/records.config.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/configuration/records.config.en.rst b/doc/reference/configuration/records.config.en.rst
index a17fbbd..3b0d1e2 100644
--- a/doc/reference/configuration/records.config.en.rst
+++ b/doc/reference/configuration/records.config.en.rst
@@ -764,6 +764,9 @@ Negative Response Caching
         503  Service Unavailable
         504  Gateway Timeout
 
+    The cache lifetime for objects cached from this setting is controlled via 
+    ``proxy.config.http.negative_caching_lifetime``.
+
 Proxy User Variables
 ====================
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ec65b119/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 99c833d..63001f2 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -7585,6 +7585,14 @@ _conf_to_memberp(TSOverridableConfigKey conf, HttpSM* sm, OverridableDataType *t
     typ = OVERRIDABLE_TYPE_INT;
     ret = &sm->t_state.txn_conf->response_hdr_max_size;
     break;
+  case TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_ENABLED:
+    typ = OVERRIDABLE_TYPE_INT;
+    ret = &sm->t_state.txn_conf->negative_revalidating_enabled;
+    break;
+  case TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_LIFETIME:
+    typ = OVERRIDABLE_TYPE_INT;
+    ret = &sm->t_state.txn_conf->negative_revalidating_lifetime;
+    break;
 
     // This helps avoiding compiler warnings, yet detect unhandled enum members.
   case TS_CONFIG_NULL:
@@ -8025,6 +8033,10 @@ TSHttpTxnConfigFind(const char* name, int length, TSOverridableConfigKey *conf,
 
   case 47:
     switch (name[length-1]) {
+    case 'd':
+      if (!strncmp(name, "proxy.config.http.negative_revalidating_enabled", length))
+        cnf = TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_ENABLED;
+      break;
     case 'e':
       if (!strncmp(name, "proxy.config.http.cache.guaranteed_min_lifetime", length))
         cnf = TS_CONFIG_HTTP_CACHE_GUARANTEED_MIN_LIFETIME;
@@ -8043,6 +8055,8 @@ TSHttpTxnConfigFind(const char* name, int length, TSOverridableConfigKey *conf,
     case 'e':
       if (!strncmp(name, "proxy.config.http.cache.ignore_client_cc_max_age", length))
         cnf = TS_CONFIG_HTTP_CACHE_IGNORE_CLIENT_CC_MAX_AGE;
+      else if (!strncmp(name, "proxy.config.http.negative_revalidating_lifetime", length))
+        cnf = TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_LIFETIME;
       break;
     case 't':
       switch (name[length-4]) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ec65b119/proxy/InkAPITest.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
index 85cc589..108a125 100644
--- a/proxy/InkAPITest.cc
+++ b/proxy/InkAPITest.cc
@@ -7401,7 +7401,9 @@ const char *SDK_Overridable_Configs[TS_CONFIG_LAST_ENTRY] = {
   "proxy.config.http.default_buffer_size",
   "proxy.config.http.default_buffer_water_mark",
   "proxy.config.http.request_header_max_size",
-  "proxy.config.http.response_header_max_size"
+  "proxy.config.http.response_header_max_size",
+  "proxy.config.http.negative_revalidating_enabled",
+  "proxy.config.http.negative_revalidating_lifetime"
 };
 
 REGRESSION_TEST(SDK_API_OVERRIDABLE_CONFIGS) (RegressionTest * test, int /* atype ATS_UNUSED */, int *pstatus)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ec65b119/proxy/api/ts/ts.h.in
----------------------------------------------------------------------
diff --git a/proxy/api/ts/ts.h.in b/proxy/api/ts/ts.h.in
index 47eeaf6..4b34bd8 100644
--- a/proxy/api/ts/ts.h.in
+++ b/proxy/api/ts/ts.h.in
@@ -677,6 +677,8 @@ extern "C"
     TS_CONFIG_HTTP_DEFAULT_BUFFER_WATER_MARK,
     TS_CONFIG_HTTP_REQUEST_HEADER_MAX_SIZE,
     TS_CONFIG_HTTP_RESPONSE_HEADER_MAX_SIZE,
+    TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_ENABLED,
+    TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_LIFETIME,
     TS_CONFIG_LAST_ENTRY
   } TSOverridableConfigKey;
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ec65b119/proxy/http/HttpConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index c8c0abc..1f7c478 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -1316,17 +1316,15 @@ HttpConfig::startup()
   HttpEstablishStaticConfigByte(c.referer_filter_enabled, "proxy.config.http.referer_filter");
   HttpEstablishStaticConfigByte(c.referer_format_redirect, "proxy.config.http.referer_format_redirect");
 
-  // Negative caching
   HttpEstablishStaticConfigLongLong(c.oride.down_server_timeout, "proxy.config.http.down_server.cache_time");
   HttpEstablishStaticConfigLongLong(c.oride.client_abort_threshold, "proxy.config.http.down_server.abort_threshold");
 
-  // Negative revalidating
-  HttpEstablishStaticConfigByte(c.negative_revalidating_enabled, "proxy.config.http.negative_revalidating_enabled");
-  HttpEstablishStaticConfigLongLong(c.negative_revalidating_lifetime, "proxy.config.http.negative_revalidating_lifetime");
-
-  // Negative response caching
+  // Negative caching and revalidation
   HttpEstablishStaticConfigByte(c.oride.negative_caching_enabled, "proxy.config.http.negative_caching_enabled");
   HttpEstablishStaticConfigLongLong(c.oride.negative_caching_lifetime, "proxy.config.http.negative_caching_lifetime");
+  HttpEstablishStaticConfigByte(c.oride.negative_revalidating_enabled, "proxy.config.http.negative_revalidating_enabled");
+  HttpEstablishStaticConfigLongLong(c.oride.negative_revalidating_lifetime,
+                                    "proxy.config.http.negative_revalidating_lifetime");
 
   // Buffer size and watermark
   HttpEstablishStaticConfigLongLong(c.oride.default_buffer_size_index, "proxy.config.http.default_buffer_size");
@@ -1588,11 +1586,10 @@ params->push_method_enabled = INT_TO_BOOL(m_master.push_method_enabled);
   params->oride.down_server_timeout = m_master.oride.down_server_timeout;
   params->oride.client_abort_threshold = m_master.oride.client_abort_threshold;
 
-  params->negative_revalidating_enabled = INT_TO_BOOL(m_master.negative_revalidating_enabled);
-  params->negative_revalidating_lifetime = m_master.negative_revalidating_lifetime;
-
   params->oride.negative_caching_enabled = INT_TO_BOOL(m_master.oride.negative_caching_enabled);
   params->oride.negative_caching_lifetime = m_master.oride.negative_caching_lifetime;
+  params->oride.negative_revalidating_enabled = INT_TO_BOOL(m_master.oride.negative_revalidating_enabled);
+  params->oride.negative_revalidating_lifetime = m_master.oride.negative_revalidating_lifetime;
 
   //##############################################################################
   //#

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ec65b119/proxy/http/HttpConfig.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index de47b94..d4970e5 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -401,7 +401,7 @@ struct HttpConfigPortRange
 struct OverridableHttpConfigParams {
   OverridableHttpConfigParams()
     : maintain_pristine_host_hdr(1), chunking_enabled(1),
-      negative_caching_enabled(0), cache_when_to_revalidate(0),
+      negative_caching_enabled(0), negative_revalidating_enabled(0), cache_when_to_revalidate(0),
       keep_alive_enabled_in(1), keep_alive_enabled_out(1), keep_alive_post_out(0),
       share_server_sessions(2), fwd_proxy_auth_to_parent(0), insert_age_in_response(1),
       anonymize_remove_from(0), anonymize_remove_referer(0), anonymize_remove_user_agent(0),
@@ -411,7 +411,8 @@ 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), normalize_ae_gzip(0),
+      flow_control_enabled(0), accept_encoding_filter_enabled(0), normalize_ae_gzip(0),
+      negative_caching_lifetime(1800), negative_revalidating_lifetime(1800),
       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),
       request_hdr_max_size(131072), response_hdr_max_size(131072),
@@ -446,6 +447,7 @@ struct OverridableHttpConfigParams {
   //  Negative Response Caching //
   ////////////////////////////////
   MgmtByte negative_caching_enabled;
+  MgmtByte negative_revalidating_enabled;
 
   MgmtByte cache_when_to_revalidate;
 
@@ -504,13 +506,17 @@ struct OverridableHttpConfigParams {
   MgmtByte doc_in_cache_skip_dns;
   MgmtByte flow_control_enabled;
 
-  MgmtInt negative_caching_lifetime;
-
   ////////////////////////////////
   // Optimize gzip alternates   //
   ////////////////////////////////
   MgmtByte normalize_ae_gzip;
 
+  ////////////////////////////////
+  //  Negative cache lifetimes  //
+  ////////////////////////////////
+  MgmtInt negative_caching_lifetime;
+  MgmtInt negative_revalidating_lifetime;
+
   ///////////////////////////////////////
   // origin server connection settings //
   ///////////////////////////////////////
@@ -741,12 +747,6 @@ public:
   char *reverse_proxy_no_host_redirect;
   int reverse_proxy_no_host_redirect_len;
 
-  ////////////////////////////
-  //  Negative Revalidating //
-  ////////////////////////////
-  MgmtByte negative_revalidating_enabled;
-  MgmtInt negative_revalidating_lifetime;
-
   ///////////////////
   // cop access    //
   ///////////////////
@@ -932,8 +932,6 @@ HttpConfigParams::HttpConfigParams()
     server_transparency_enabled(false),
     reverse_proxy_enabled(0),
     url_remap_required(1),
-    negative_revalidating_enabled(0),
-    negative_revalidating_lifetime(1800),
     record_cop_page(0),
     record_tcp_mem_hit(0),
     errors_log_error_pages(1),

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ec65b119/proxy/http/HttpTransact.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 23696ae..a39447e 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -4103,14 +4103,14 @@ HttpTransact::handle_cache_operation_on_forward_server_response(State* s)
          server_response_code == HTTP_STATUS_BAD_GATEWAY ||
          server_response_code == HTTP_STATUS_SERVICE_UNAVAILABLE) &&
         s->cache_info.action == CACHE_DO_UPDATE &&
-        s->http_config_param->negative_revalidating_enabled && is_stale_cache_response_returnable(s)) {
+        s->txn_conf->negative_revalidating_enabled && is_stale_cache_response_returnable(s)) {
       DebugTxn("http_trans", "[hcoofsr] negative revalidating: revalidate stale object and serve from cache");
 
       s->cache_info.object_store.create();
       s->cache_info.object_store.request_set(&s->hdr_info.client_request);
       s->cache_info.object_store.response_set(s->cache_info.object_read->response_get());
       base_response = s->cache_info.object_store.response_get();
-      time_t exp_time = s->http_config_param->negative_revalidating_lifetime + ink_cluster_time();
+      time_t exp_time = s->txn_conf->negative_revalidating_lifetime + ink_cluster_time();
       base_response->set_expires(exp_time);
 
       SET_VIA_STRING(VIA_CACHE_FILL_ACTION, VIA_CACHE_UPDATED);


[06/10] git commit: TS-1255 Fix the types for all overridable configs. This was actually a real bug in the code, in that all float configurations were actually treated as integer, rendering them useless

Posted by zw...@apache.org.
TS-1255 Fix the types for all overridable configs. This was actually a real bug in the code,
in that all float configurations were actually treated as integer, rendering them useless


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/f047b43e
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/f047b43e
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/f047b43e

Branch: refs/heads/master
Commit: f047b43ecd68d107ef8d904e6afe1415fc6507f0
Parents: cba9303
Author: Leif Hedstrom <zw...@apache.org>
Authored: Mon Jul 29 20:33:48 2013 +0200
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Thu Aug 1 22:42:49 2013 +0200

----------------------------------------------------------------------
 proxy/InkAPI.cc     | 31 +++++++++++++++++--------------
 proxy/InkAPITest.cc | 38 +++++++++++++++++++++++---------------
 2 files changed, 40 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f047b43e/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 5b3e728..602c6a0 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -7516,6 +7516,7 @@ _conf_to_memberp(TSOverridableConfigKey conf, HttpSM* sm, OverridableDataType *t
     ret = &sm->t_state.txn_conf->doc_in_cache_skip_dns;
     break;
   case TS_CONFIG_HTTP_BACKGROUND_FILL_ACTIVE_TIMEOUT:
+    typ = OVERRIDABLE_TYPE_INT;
     ret = &sm->t_state.txn_conf->background_fill_active_timeout;
     break;
   case TS_CONFIG_HTTP_RESPONSE_SERVER_STR:
@@ -7543,7 +7544,6 @@ _conf_to_memberp(TSOverridableConfigKey conf, HttpSM* sm, OverridableDataType *t
     ret = &sm->t_state.txn_conf->sock_packet_tos_out;
     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_CHUNKING_SIZE:
@@ -7562,11 +7562,9 @@ _conf_to_memberp(TSOverridableConfigKey conf, HttpSM* sm, OverridableDataType *t
     ret = &sm->t_state.txn_conf->flow_high_water_mark;
     break;
   case TS_CONFIG_HTTP_CACHE_RANGE_LOOKUP:
-    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;
   case TS_CONFIG_HTTP_DEFAULT_BUFFER_SIZE:
@@ -7586,7 +7584,6 @@ _conf_to_memberp(TSOverridableConfigKey conf, HttpSM* sm, OverridableDataType *t
     ret = &sm->t_state.txn_conf->response_hdr_max_size;
     break;
   case TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_ENABLED:
-    typ = OVERRIDABLE_TYPE_INT;
     ret = &sm->t_state.txn_conf->negative_revalidating_enabled;
     break;
   case TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_LIFETIME:
@@ -7594,7 +7591,6 @@ _conf_to_memberp(TSOverridableConfigKey conf, HttpSM* sm, OverridableDataType *t
     ret = &sm->t_state.txn_conf->negative_revalidating_lifetime;
     break;
   case TS_CONFIG_HTTP_ACCEPT_ENCODING_FILTER_ENABLED:
-    typ = OVERRIDABLE_TYPE_INT;
     ret = &sm->t_state.txn_conf->accept_encoding_filter_enabled;
     break;
 
@@ -7903,8 +7899,10 @@ TSHttpTxnConfigFind(const char* name, int length, TSOverridableConfigKey *conf,
         cnf = TS_CONFIG_HTTP_KEEP_ALIVE_ENABLED_OUT;
       break;
     case 'y':
-      if (!strncmp(name, "proxy.config.http.cache.fuzz.probability", length))
+      if (!strncmp(name, "proxy.config.http.cache.fuzz.probability", length)) {
+        typ = TS_RECORDDATATYPE_FLOAT;
         cnf = TS_CONFIG_HTTP_CACHE_FUZZ_PROBABILITY;
+      }
       break;
     }
     break;
@@ -7972,8 +7970,10 @@ TSHttpTxnConfigFind(const char* name, int length, TSOverridableConfigKey *conf,
         cnf = TS_CONFIG_HTTP_CACHE_CLUSTER_CACHE_LOCAL;
       break;
     case 'r':
-      if (!strncmp(name, "proxy.config.http.cache.heuristic_lm_factor", length))
+      if (!strncmp(name, "proxy.config.http.cache.heuristic_lm_factor", length)) {
+        typ = TS_RECORDDATATYPE_FLOAT;
         cnf = TS_CONFIG_HTTP_CACHE_HEURISTIC_LM_FACTOR;
+      }
       break;
     }
     break;
@@ -8068,14 +8068,15 @@ TSHttpTxnConfigFind(const char* name, int length, TSOverridableConfigKey *conf,
       break;
     case 't':
       switch (name[length-4]) {
-        case '_':
+      case '_':
         if (!strncmp(name, "proxy.config.http.transaction_active_timeout_out", length))
           cnf = TS_CONFIG_HTTP_TRANSACTION_ACTIVE_TIMEOUT_OUT;
         break;
-        case 'e':
-        if (!strncmp(name, "proxy.config.http.background_fill_active_timeout", length))
-          cnf = TS_CONFIG_HTTP_BACKGROUND_FILL_ACTIVE_TIMEOUT;
-        break;
+      case 'e':
+          if (!strncmp(name, "proxy.config.http.background_fill_active_timeout", length)) {
+            cnf = TS_CONFIG_HTTP_BACKGROUND_FILL_ACTIVE_TIMEOUT;
+          }
+          break;
       }
       break;
     }
@@ -8115,8 +8116,10 @@ TSHttpTxnConfigFind(const char* name, int length, TSOverridableConfigKey *conf,
         cnf = TS_CONFIG_HTTP_TRANSACTION_NO_ACTIVITY_TIMEOUT_OUT;
       break;
       case 'd':
-      if (!strncmp(name, "proxy.config.http.background_fill_completed_threshold", length))
-        cnf = TS_CONFIG_HTTP_BACKGROUND_FILL_COMPLETED_THRESHOLD;
+        if (!strncmp(name, "proxy.config.http.background_fill_completed_threshold", length)) {
+          typ = TS_RECORDDATATYPE_FLOAT;
+          cnf = TS_CONFIG_HTTP_BACKGROUND_FILL_COMPLETED_THRESHOLD;
+        }
       break;
     }
     break;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f047b43e/proxy/InkAPITest.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
index f9a0f83..9bbf6a5 100644
--- a/proxy/InkAPITest.cc
+++ b/proxy/InkAPITest.cc
@@ -7415,11 +7415,13 @@ REGRESSION_TEST(SDK_API_OVERRIDABLE_CONFIGS) (RegressionTest * test, int /* atyp
   HttpSM* s = HttpSM::allocate();
   bool success = true;
   TSHttpTxn txnp = reinterpret_cast<TSHttpTxn>(s);
-  TSMgmtInt ival = 0;
-  TSMgmtFloat fval;
-  const char *sval;
+  InkRand generator(17);
+  TSMgmtInt ival_read, ival_rand;
+  TSMgmtFloat fval_read, fval_rand;
+  const char *sval_read;
   const char *test_string = "The Apache Traffic Server";
-  int tmp_int;
+  int len;
+  
 
   s->init();
 
@@ -7438,23 +7440,28 @@ REGRESSION_TEST(SDK_API_OVERRIDABLE_CONFIGS) (RegressionTest * test, int /* atyp
       success = false;
       continue;
     }
+
     // Now check the getters / setters
     switch (type) {
     case TS_RECORDDATATYPE_INT:
-      TSHttpTxnConfigIntSet(txnp, key, 17);
-      TSHttpTxnConfigIntGet(txnp, key, &ival);
-      if (17 != ival) {
-        SDK_RPRINT(test, "TSHttpTxnConfigIntSet", "TestCase1", TC_FAIL, "Failed on %s, expected 17, got %d", conf, ival);
+      ival_rand = generator.random() % 126; // to fit in a signed byte
+      TSHttpTxnConfigIntSet(txnp, key, ival_rand);
+      TSHttpTxnConfigIntGet(txnp, key, &ival_read);
+      if (ival_rand != ival_read) {
+        SDK_RPRINT(test, "TSHttpTxnConfigIntSet", "TestCase1", TC_FAIL, "Failed on %s, %d != %d", conf,
+                   ival_read, ival_rand);
         success = false;
         continue;
       }
       break;
 
     case TS_RECORDDATATYPE_FLOAT:
-      TSHttpTxnConfigFloatSet(txnp, key, 17.17);
-      TSHttpTxnConfigFloatGet(txnp, key, &fval);
-      if (17.17 != fval) {
-        SDK_RPRINT(test, "TSHttpTxnConfigFloatSet", "TestCase1", TC_FAIL, "Failed on %s, expected 17, got %d", conf, ival);
+      fval_rand = generator.random();
+      TSHttpTxnConfigFloatSet(txnp, key, fval_rand);
+      TSHttpTxnConfigFloatGet(txnp, key, &fval_read);
+      if (fval_rand != fval_read) {
+        SDK_RPRINT(test, "TSHttpTxnConfigFloatSet", "TestCase1", TC_FAIL, "Failed on %s, %f != %f", conf,
+                   fval_read, fval_rand);
         success = false;
         continue;
       }
@@ -7462,9 +7469,10 @@ REGRESSION_TEST(SDK_API_OVERRIDABLE_CONFIGS) (RegressionTest * test, int /* atyp
 
     case TS_RECORDDATATYPE_STRING:
       TSHttpTxnConfigStringSet(txnp, key, test_string, -1);
-      TSHttpTxnConfigStringGet(txnp, key, &sval, &tmp_int);
-      if (test_string != sval) {
-        SDK_RPRINT(test, "TSHttpTxnConfigStringSet", "TestCase1", TC_FAIL, "Failed on %s, expected 17, got %s", conf, sval);
+      TSHttpTxnConfigStringGet(txnp, key, &sval_read, &len);
+      if (test_string != sval_read) {
+        SDK_RPRINT(test, "TSHttpTxnConfigStringSet", "TestCase1", TC_FAIL, "Failed on %s, %s != %s", conf,
+                   sval_read, test_string);
         success = false;
         continue;
       }


Re: [01/10] git commit: TS-1255 Add Req/Resp max header size to be overridable

Posted by James Peach <jp...@apache.org>.
On Aug 1, 2013, at 1:46 PM, zwoop@apache.org wrote:

> Updated Branches:
>  refs/heads/master cecc082d4 -> 7485e0b5f
> 
> 
> TS-1255 Add Req/Resp max header size to be overridable

Would it be more robust to use a lookup table for the overridable value types?

static const
struct {
    OverridableDataType o_type;
    size_t o_offset;
} overridable[] = {

  /* TS_CONFIG_URL_REMAP_PRISTINE_HOST_HDR */
  { OVERRIDABLE_TYPE_BYTE, offsetof(OverridableHttpConfigParams, maintain_pristine_host_hdr},

  ...
};

void*
_conf_to_memberp(TSOverridableConfigKey conf, HttpSM* sm, OverridableDataType *typep)
{

    *typep = overridable[conf].o_type;
    return  ((uint8_t *)(sm->t_state.txn_conf)) + overridable[conf].o_offset;
}

> 
> 
> Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
> Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/b0e7c2ab
> Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/b0e7c2ab
> Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/b0e7c2ab
> 
> Branch: refs/heads/master
> Commit: b0e7c2ab4a513ff6c0e3f79f65a0ef523fee7882
> Parents: 2f98469
> Author: Leif Hedstrom <zw...@apache.org>
> Authored: Sun Jul 28 22:50:14 2013 +0200
> Committer: Leif Hedstrom <zw...@apache.org>
> Committed: Thu Aug 1 22:42:48 2013 +0200
> 
> ----------------------------------------------------------------------
> proxy/InkAPI.cc          | 12 ++++++++++++
> proxy/InkAPITest.cc      |  4 +++-
> proxy/api/ts/ts.h.in     |  4 +++-
> proxy/http/HttpConfig.cc | 12 ++++++------
> proxy/http/HttpConfig.h  | 15 +++++++--------
> proxy/http/HttpSM.cc     |  4 ++--
> 6 files changed, 33 insertions(+), 18 deletions(-)
> ----------------------------------------------------------------------
> 
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b0e7c2ab/proxy/InkAPI.cc
> ----------------------------------------------------------------------
> diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
> index 1ed9933..99c833d 100644
> --- a/proxy/InkAPI.cc
> +++ b/proxy/InkAPI.cc
> @@ -7577,6 +7577,14 @@ _conf_to_memberp(TSOverridableConfigKey conf, HttpSM* sm, OverridableDataType *t
>     typ = OVERRIDABLE_TYPE_INT;
>     ret = &sm->t_state.txn_conf->default_buffer_water_mark;
>     break;
> +  case TS_CONFIG_HTTP_REQUEST_HEADER_MAX_SIZE:
> +    typ = OVERRIDABLE_TYPE_INT;
> +    ret = &sm->t_state.txn_conf->request_hdr_max_size;
> +    break;
> +  case TS_CONFIG_HTTP_RESPONSE_HEADER_MAX_SIZE:
> +    typ = OVERRIDABLE_TYPE_INT;
> +    ret = &sm->t_state.txn_conf->response_hdr_max_size;
> +    break;
> 
>     // This helps avoiding compiler warnings, yet detect unhandled enum members.
>   case TS_CONFIG_NULL:
> @@ -7898,6 +7906,8 @@ TSHttpTxnConfigFind(const char* name, int length, TSOverridableConfigKey *conf,
>     case 'e':
>       if (!strncmp(name, "proxy.config.http.anonymize_remove_cookie", length))
>         cnf = TS_CONFIG_HTTP_ANONYMIZE_REMOVE_COOKIE;
> +      else if (!strncmp(name, "proxy.config.http.request_header_max_size", length))
> +        cnf = TS_CONFIG_HTTP_REQUEST_HEADER_MAX_SIZE;
>       break;
>     case 'r':
>       if (!strncmp(name, "proxy.config.http.insert_response_via_str", length))
> @@ -7917,6 +7927,8 @@ TSHttpTxnConfigFind(const char* name, int length, TSOverridableConfigKey *conf,
>     case 'e':
>       if (!strncmp(name, "proxy.config.http.cache.when_to_revalidate", length))
>         cnf = TS_CONFIG_HTTP_CACHE_WHEN_TO_REVALIDATE;
> +      else if (!strncmp(name, "proxy.config.http.response_header_max_size", length))
> +        cnf = TS_CONFIG_HTTP_RESPONSE_HEADER_MAX_SIZE;
>       break;
>     case 'r':
>       if (!strncmp(name, "proxy.config.http.anonymize_remove_referer", length))
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b0e7c2ab/proxy/InkAPITest.cc
> ----------------------------------------------------------------------
> diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
> index 42de90c..85cc589 100644
> --- a/proxy/InkAPITest.cc
> +++ b/proxy/InkAPITest.cc
> @@ -7399,7 +7399,9 @@ const char *SDK_Overridable_Configs[TS_CONFIG_LAST_ENTRY] = {
>   "proxy.config.http.cache.range.lookup",
>   "proxy.config.http.normalize_ae_gzip",
>   "proxy.config.http.default_buffer_size",
> -  "proxy.config.http.default_buffer_water_mark"
> +  "proxy.config.http.default_buffer_water_mark",
> +  "proxy.config.http.request_header_max_size",
> +  "proxy.config.http.response_header_max_size"
> };
> 
> REGRESSION_TEST(SDK_API_OVERRIDABLE_CONFIGS) (RegressionTest * test, int /* atype ATS_UNUSED */, int *pstatus)
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b0e7c2ab/proxy/api/ts/ts.h.in
> ----------------------------------------------------------------------
> diff --git a/proxy/api/ts/ts.h.in b/proxy/api/ts/ts.h.in
> index b9cd558..47eeaf6 100644
> --- a/proxy/api/ts/ts.h.in
> +++ b/proxy/api/ts/ts.h.in
> @@ -675,7 +675,9 @@ extern "C"
>     TS_CONFIG_HTTP_NORMALIZE_AE_GZIP,
>     TS_CONFIG_HTTP_DEFAULT_BUFFER_SIZE,
>     TS_CONFIG_HTTP_DEFAULT_BUFFER_WATER_MARK,
> -    TS_CONFIG_LAST_ENTRY,
> +    TS_CONFIG_HTTP_REQUEST_HEADER_MAX_SIZE,
> +    TS_CONFIG_HTTP_RESPONSE_HEADER_MAX_SIZE,
> +    TS_CONFIG_LAST_ENTRY
>   } TSOverridableConfigKey;
> 
>   /* The TASK pool of threads is the primary method of off-loading continuations from the
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b0e7c2ab/proxy/http/HttpConfig.cc
> ----------------------------------------------------------------------
> diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
> index b4db289..c8c0abc 100644
> --- a/proxy/http/HttpConfig.cc
> +++ b/proxy/http/HttpConfig.cc
> @@ -1291,9 +1291,8 @@ HttpConfig::startup()
> 
>   HttpEstablishStaticConfigStringAlloc(c.connect_ports_string, "proxy.config.http.connect_ports");
> 
> -  HttpEstablishStaticConfigLongLong(c.request_hdr_max_size, "proxy.config.http.request_header_max_size");
> -
> -  HttpEstablishStaticConfigLongLong(c.response_hdr_max_size, "proxy.config.http.response_header_max_size");
> +  HttpEstablishStaticConfigLongLong(c.oride.request_hdr_max_size, "proxy.config.http.request_header_max_size");
> +  HttpEstablishStaticConfigLongLong(c.oride.response_hdr_max_size, "proxy.config.http.response_header_max_size");
> 
>   HttpEstablishStaticConfigByte(c.push_method_enabled, "proxy.config.http.push_method_enabled");
> 
> @@ -1561,9 +1560,10 @@ HttpConfig::reconfigure()
>   params->connect_ports_string = ats_strdup(m_master.connect_ports_string);
>   params->connect_ports = parse_ports_list(params->connect_ports_string);
> 
> -  params->request_hdr_max_size = m_master.request_hdr_max_size;
> -  params->response_hdr_max_size = m_master.response_hdr_max_size;
> -  params->push_method_enabled = INT_TO_BOOL(m_master.push_method_enabled);
> +  params->oride.request_hdr_max_size = m_master.oride.request_hdr_max_size;
> +  params->oride.response_hdr_max_size = m_master.oride.response_hdr_max_size;
> +  
> +params->push_method_enabled = INT_TO_BOOL(m_master.push_method_enabled);
> 
>   params->reverse_proxy_enabled = INT_TO_BOOL(m_master.reverse_proxy_enabled);
>   params->url_remap_required = INT_TO_BOOL(m_master.url_remap_required);
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b0e7c2ab/proxy/http/HttpConfig.h
> ----------------------------------------------------------------------
> diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
> index 27a96e7..de47b94 100644
> --- a/proxy/http/HttpConfig.h
> +++ b/proxy/http/HttpConfig.h
> @@ -414,6 +414,7 @@ struct OverridableHttpConfigParams {
>       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),
> +      request_hdr_max_size(131072), response_hdr_max_size(131072),
>       cache_heuristic_min_lifetime(3600), cache_heuristic_max_lifetime(86400),
>       cache_guaranteed_min_lifetime(0), cache_guaranteed_max_lifetime(31536000), cache_max_stale_age(604800),
>       keep_alive_no_activity_timeout_in(115), keep_alive_no_activity_timeout_out(120),
> @@ -524,6 +525,12 @@ struct OverridableHttpConfigParams {
>   ///////////////////////////////
>   MgmtInt server_tcp_init_cwnd;
> 
> +  ///////////////
> +  // Hdr Limit //
> +  ///////////////
> +  MgmtInt request_hdr_max_size;
> +  MgmtInt response_hdr_max_size;
> +
>   /////////////////////
>   // cache variables //
>   /////////////////////
> @@ -702,12 +709,6 @@ public:
>   char *connect_ports_string;
>   HttpConfigPortRange *connect_ports;
> 
> -  ///////////////
> -  // Hdr Limit //
> -  ///////////////
> -  MgmtInt request_hdr_max_size;
> -  MgmtInt response_hdr_max_size;
> -
>   //////////
>   // Push //
>   //////////
> @@ -923,8 +924,6 @@ HttpConfigParams::HttpConfigParams()
>     cache_when_to_add_no_cache_to_msie_requests(-1),
>     connect_ports_string(NULL),
>     connect_ports(NULL),
> -    request_hdr_max_size(131072),
> -    response_hdr_max_size(131072),
>     push_method_enabled(0),
>     referer_filter_enabled(0),
>     referer_format_redirect(0),
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b0e7c2ab/proxy/http/HttpSM.cc
> ----------------------------------------------------------------------
> diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
> index 5647f22..5b879bc 100644
> --- a/proxy/http/HttpSM.cc
> +++ b/proxy/http/HttpSM.cc
> @@ -720,7 +720,7 @@ HttpSM::state_read_client_request_header(int event, void *data)
>   client_request_hdr_bytes += bytes_used;
> 
>   // Check to see if we are over the hdr size limit
> -  if (client_request_hdr_bytes > t_state.http_config_param->request_hdr_max_size) {
> +  if (client_request_hdr_bytes > t_state.txn_conf->request_hdr_max_size) {
>     DebugSM("http", "client header bytes were over max header size; treating as a bad request");
>     state = PARSE_ERROR;
>   }
> @@ -1776,7 +1776,7 @@ HttpSM::state_read_server_response_header(int event, void *data)
>     state = PARSE_ERROR;
>   }
>   // Check to see if we are over the hdr size limit
> -  if (server_response_hdr_bytes > t_state.http_config_param->response_hdr_max_size) {
> +  if (server_response_hdr_bytes > t_state.txn_conf->response_hdr_max_size) {
>     state = PARSE_ERROR;
>   }
> 
> 


[07/10] git commit: TS-1255 Added new configs to plugin docs.

Posted by zw...@apache.org.
TS-1255 Added new configs to plugin docs.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/cba93031
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/cba93031
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/cba93031

Branch: refs/heads/master
Commit: cba930314ee4a41ce7c9e64e6eeffcc938503447
Parents: 73b277f
Author: Leif Hedstrom <zw...@apache.org>
Authored: Mon Jul 29 08:08:00 2013 +0200
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Thu Aug 1 22:42:49 2013 +0200

----------------------------------------------------------------------
 doc/reference/plugins/conf_remap.en.rst | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cba93031/doc/reference/plugins/conf_remap.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/plugins/conf_remap.en.rst b/doc/reference/plugins/conf_remap.en.rst
index 2f90e1c..c18ae8d 100644
--- a/doc/reference/plugins/conf_remap.en.rst
+++ b/doc/reference/plugins/conf_remap.en.rst
@@ -105,3 +105,12 @@ the `conf_remap` plugin:
 | 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.normalize_ae_gzip
+| proxy.config.http.default_buffer_size
+| proxy.config.http.default_buffer_water_mark
+| proxy.config.http.request_header_max_size
+| proxy.config.http.response_header_max_size
+| proxy.config.http.negative_revalidating_enabled
+| proxy.config.http.negative_revalidating_lifetime
+| proxy.config.http.accept_encoding_filter_enable


[04/10] git commit: TS-1255 Added proxy.config.http.cache.range.lookup as overridable config, and also organized the switch statement in InkAPI.cc to match ts.h

Posted by zw...@apache.org.
TS-1255 Added proxy.config.http.cache.range.lookup as overridable config, and also organized the switch statement in InkAPI.cc to match ts.h


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/bb6939cf
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/bb6939cf
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/bb6939cf

Branch: refs/heads/master
Commit: bb6939cf56cc0664fff971da81b59b0b26dd4068
Parents: cecc082
Author: Leif Hedstrom <zw...@apache.org>
Authored: Sat Jul 27 02:46:17 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Thu Aug 1 22:42:48 2013 +0200

----------------------------------------------------------------------
 proxy/InkAPI.cc            | 51 +++++++++++++++++++++++++----------------
 proxy/InkAPITest.cc        |  3 ++-
 proxy/api/ts/ts.h.in       |  1 +
 proxy/http/HttpConfig.cc   |  4 ++--
 proxy/http/HttpConfig.h    |  6 ++---
 proxy/http/HttpTransact.cc |  2 +-
 6 files changed, 40 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bb6939cf/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 540bec8..3433f7d 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -7362,14 +7362,6 @@ _conf_to_memberp(TSOverridableConfigKey conf, HttpSM* sm, OverridableDataType *t
     typ = OVERRIDABLE_TYPE_INT;
     ret = &sm->t_state.txn_conf->sock_option_flag_out;
     break;
-  case TS_CONFIG_NET_SOCK_PACKET_MARK_OUT:
-    typ = OVERRIDABLE_TYPE_INT;
-    ret = &sm->t_state.txn_conf->sock_packet_mark_out;
-    break;
-  case TS_CONFIG_NET_SOCK_PACKET_TOS_OUT:
-    typ = OVERRIDABLE_TYPE_INT;
-    ret = &sm->t_state.txn_conf->sock_packet_tos_out;
-    break;
   case TS_CONFIG_HTTP_FORWARD_PROXY_AUTH_TO_PARENT:
     ret = &sm->t_state.txn_conf->fwd_proxy_auth_to_parent;
     break;
@@ -7526,11 +7518,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;
+  case TS_CONFIG_HTTP_RESPONSE_SERVER_STR:
+    typ = OVERRIDABLE_TYPE_STRING;
+    ret = &sm->t_state.txn_conf->proxy_response_server_string;
     break;
-
   case TS_CONFIG_HTTP_CACHE_HEURISTIC_LM_FACTOR:
     typ = OVERRIDABLE_TYPE_FLOAT;
     ret = &sm->t_state.txn_conf->cache_heuristic_lm_factor;
@@ -7543,10 +7534,17 @@ _conf_to_memberp(TSOverridableConfigKey conf, HttpSM* sm, OverridableDataType *t
     typ = OVERRIDABLE_TYPE_FLOAT;
     ret = &sm->t_state.txn_conf->background_fill_threshold;
     break;
-
-  case TS_CONFIG_HTTP_RESPONSE_SERVER_STR:
-    typ = OVERRIDABLE_TYPE_STRING;
-    ret = &sm->t_state.txn_conf->proxy_response_server_string;
+  case TS_CONFIG_NET_SOCK_PACKET_MARK_OUT:
+    typ = OVERRIDABLE_TYPE_INT;
+    ret = &sm->t_state.txn_conf->sock_packet_mark_out;
+    break;
+  case TS_CONFIG_NET_SOCK_PACKET_TOS_OUT:
+    typ = OVERRIDABLE_TYPE_INT;
+    ret = &sm->t_state.txn_conf->sock_packet_tos_out;
+    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_CHUNKING_SIZE:
     typ = OVERRIDABLE_TYPE_INT;
@@ -7555,13 +7553,17 @@ _conf_to_memberp(TSOverridableConfigKey conf, HttpSM* sm, OverridableDataType *t
   case TS_CONFIG_HTTP_FLOW_CONTROL_ENABLED:
     ret = &sm->t_state.txn_conf->flow_control_enabled;
     break;
+  case TS_CONFIG_HTTP_FLOW_CONTROL_LOW_WATER_MARK:
+    typ = OVERRIDABLE_TYPE_INT;
+    ret = &sm->t_state.txn_conf->flow_low_water_mark;
+    break;
   case TS_CONFIG_HTTP_FLOW_CONTROL_HIGH_WATER_MARK:
     typ = OVERRIDABLE_TYPE_INT;
     ret = &sm->t_state.txn_conf->flow_high_water_mark;
     break;
-  case TS_CONFIG_HTTP_FLOW_CONTROL_LOW_WATER_MARK:
+  case TS_CONFIG_HTTP_CACHE_RANGE_LOOKUP:
     typ = OVERRIDABLE_TYPE_INT;
-    ret = &sm->t_state.txn_conf->flow_low_water_mark;
+    ret = &sm->t_state.txn_conf->cache_range_lookup;
     break;
 
     // This helps avoiding compiler warnings, yet detect unhandled enum members.
@@ -7746,6 +7748,7 @@ TSHttpTxnConfigFind(const char* name, int length, TSOverridableConfigKey *conf,
     if (!strncmp(name, "proxy.config.http.cache.http", length))
       cnf = TS_CONFIG_HTTP_CACHE_HTTP;
     break;
+
   case 31:
     if (!strncmp(name, "proxy.config.http.chunking.size", length))
       cnf = TS_CONFIG_HTTP_CHUNKING_SIZE;
@@ -7762,8 +7765,16 @@ TSHttpTxnConfigFind(const char* name, int length, TSOverridableConfigKey *conf,
     break;
 
   case 36:
-    if (!strncmp(name, "proxy.config.net.sock_packet_tos_out", length))
-      cnf = TS_CONFIG_NET_SOCK_PACKET_TOS_OUT;
+    switch (name[length-1]) {
+    case 'p':
+      if (!strncmp(name, "proxy.config.http.cache.range.lookup", length))
+        cnf = TS_CONFIG_HTTP_CACHE_RANGE_LOOKUP;
+      break;
+    case 't':
+      if (!strncmp(name, "proxy.config.net.sock_packet_tos_out", length))
+        cnf = TS_CONFIG_NET_SOCK_PACKET_TOS_OUT;
+      break;
+    }
     break;
 
   case 37:

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bb6939cf/proxy/InkAPITest.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
index 1be5eb0..6f54a3b 100644
--- a/proxy/InkAPITest.cc
+++ b/proxy/InkAPITest.cc
@@ -7395,7 +7395,8 @@ const char *SDK_Overridable_Configs[TS_CONFIG_LAST_ENTRY] = {
   "proxy.config.http.chunking.size",
   "proxy.config.http.flow_control.enabled",
   "proxy.config.http.flow_control.low_water",
-  "proxy.config.http.flow_control.high_water"
+  "proxy.config.http.flow_control.high_water",
+  "proxy.config.http.cache.range.lookup"
 };
 
 REGRESSION_TEST(SDK_API_OVERRIDABLE_CONFIGS) (RegressionTest * test, int /* atype ATS_UNUSED */, int *pstatus)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bb6939cf/proxy/api/ts/ts.h.in
----------------------------------------------------------------------
diff --git a/proxy/api/ts/ts.h.in b/proxy/api/ts/ts.h.in
index fc65e0e..7793055 100644
--- a/proxy/api/ts/ts.h.in
+++ b/proxy/api/ts/ts.h.in
@@ -671,6 +671,7 @@ extern "C"
     TS_CONFIG_HTTP_FLOW_CONTROL_ENABLED,
     TS_CONFIG_HTTP_FLOW_CONTROL_LOW_WATER_MARK,
     TS_CONFIG_HTTP_FLOW_CONTROL_HIGH_WATER_MARK,
+    TS_CONFIG_HTTP_CACHE_RANGE_LOOKUP,
     TS_CONFIG_LAST_ENTRY,
   } TSOverridableConfigKey;
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bb6939cf/proxy/http/HttpConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index 2080f65..fb5b9ed 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -1289,7 +1289,7 @@ HttpConfig::startup()
   HttpEstablishStaticConfigByte(c.cache_when_to_add_no_cache_to_msie_requests,
                                     "proxy.config.http.cache.when_to_add_no_cache_to_msie_requests");
   HttpEstablishStaticConfigByte(c.oride.cache_required_headers, "proxy.config.http.cache.required_headers");
-  HttpEstablishStaticConfigByte(c.cache_range_lookup, "proxy.config.http.cache.range.lookup");
+  HttpEstablishStaticConfigByte(c.oride.cache_range_lookup, "proxy.config.http.cache.range.lookup");
 
   HttpEstablishStaticConfigStringAlloc(c.connect_ports_string, "proxy.config.http.connect_ports");
 
@@ -1560,7 +1560,7 @@ HttpConfig::reconfigure()
   params->cache_when_to_add_no_cache_to_msie_requests = m_master.cache_when_to_add_no_cache_to_msie_requests;
 
   params->oride.cache_required_headers = m_master.oride.cache_required_headers;
-  params->cache_range_lookup = INT_TO_BOOL(m_master.cache_range_lookup);
+  params->oride.cache_range_lookup = INT_TO_BOOL(m_master.oride.cache_range_lookup);
 
   params->connect_ports_string = ats_strdup(m_master.connect_ports_string);
   params->connect_ports = parse_ports_list(params->connect_ports_string);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bb6939cf/proxy/http/HttpConfig.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index 659bbe7..cbee1fd 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -408,10 +408,10 @@ struct OverridableHttpConfigParams {
        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),
-       send_http11_requests(3), // SEND_HTTP11_IF_REQUEST_11_AND_HOSTDB
+       send_http11_requests(3),
        cache_http(0), cache_cluster_cache_local(0), cache_ignore_client_no_cache(0), cache_ignore_client_cc_max_age(1),
        cache_ims_on_client_no_cache(0), cache_ignore_server_no_cache(0), cache_responses_to_cookies(0),
-       cache_ignore_auth(0), cache_urls_that_look_dynamic(0), cache_required_headers(0), // CACHE_REQUIRED_HEADERS_NONE
+       cache_ignore_auth(0), cache_urls_that_look_dynamic(0), cache_required_headers(0), cache_range_lookup(1),
        insert_request_via_string(0), insert_response_via_string(0), doc_in_cache_skip_dns(1),
        negative_caching_lifetime(0),
        sock_recv_buffer_size_out(0), sock_send_buffer_size_out(0), sock_option_flag_out(0),
@@ -498,6 +498,7 @@ struct OverridableHttpConfigParams {
   MgmtByte cache_ignore_auth;
   MgmtByte cache_urls_that_look_dynamic;
   MgmtByte cache_required_headers;
+  MgmtByte cache_range_lookup;
 
   MgmtByte insert_request_via_string;
   MgmtByte insert_response_via_string;
@@ -692,7 +693,6 @@ public:
   ///////////////////
   MgmtByte cache_enable_default_vary_headers;
   MgmtByte cache_when_to_add_no_cache_to_msie_requests;
-  MgmtByte cache_range_lookup;
 
   ////////////////////////////////////////////
   // CONNECT ports (used to be == ssl_ports //

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bb6939cf/proxy/http/HttpTransact.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index f31a8bc..c1cf88d 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -5887,7 +5887,7 @@ HttpTransact::is_request_cache_lookupable(State* s)
   }
 
   // Don't cache if it's a RANGE request but the cache is not enabled for RANGE.
-  if (!s->http_config_param->cache_range_lookup && s->hdr_info.client_request.presence(MIME_PRESENCE_RANGE)) {
+  if (!s->txn_conf->cache_range_lookup && s->hdr_info.client_request.presence(MIME_PRESENCE_RANGE)) {
     SET_VIA_STRING(VIA_DETAIL_TUNNEL, VIA_DETAIL_TUNNEL_HEADER_FIELD);
     return false;
   }


Re: [01/10] git commit: TS-1255 Add Req/Resp max header size to be overridable

Posted by Leif Hedstrom <le...@ogre.com>.
On Aug 2, 2013, at 7:01 AM, James Peach <jp...@apache.org> wrote:

> On Aug 1, 2013, at 9:36 PM, Leif Hedstrom <zw...@apache.org> wrote:
> 
>> On Aug 2, 2013, at 12:33 AM, Igor Galić <i....@brainsware.org> wrote:
>> 
>>> 
>>>> +  "proxy.config.http.request_header_max_size",
>>>> +  "proxy.config.http.response_header_max_size"
>>> 
>>> why not close this up with a ',' ?
>> 
>> Here it *might* make sense, but I personally don't care for it much.
> 
> In the olden days compilers would puke on that.

I think you are implying I'm old ? :) You'll catch up, just wait and see…

Cheers,

-- leif


Re: [01/10] git commit: TS-1255 Add Req/Resp max header size to be overridable

Posted by James Peach <jp...@apache.org>.
On Aug 1, 2013, at 9:36 PM, Leif Hedstrom <zw...@apache.org> wrote:

> On Aug 2, 2013, at 12:33 AM, Igor Galić <i....@brainsware.org> wrote:
> 
>> 
>>> +  "proxy.config.http.request_header_max_size",
>>> +  "proxy.config.http.response_header_max_size"
>> 
>> why not close this up with a ',' ?
> 
> Here it *might* make sense, but I personally don't care for it much.

In the olden days compilers would puke on that.

> 
>>> +    TS_CONFIG_HTTP_RESPONSE_HEADER_MAX_SIZE,
>>> +    TS_CONFIG_LAST_ENTRY
>> 
>> why not close this up with a ',' ?
> 
> Here we should absolutely not add a trailing (extraneous) ",". There's a reason for this, TS_CONFIG_LAST_ENTRY is a sentinel, it must always be the last. Having a trailing "," would potentially invite people to append to it, which simply won't work. :)
> 
> 
> Cheers and thanks for the reviews, as usual. We need more Igor's.
> 
> -- leif
> 


Re: [01/10] git commit: TS-1255 Add Req/Resp max header size to be overridable

Posted by Leif Hedstrom <zw...@apache.org>.
On Aug 2, 2013, at 12:33 AM, Igor Galić <i....@brainsware.org> wrote:

> 
>> +  "proxy.config.http.request_header_max_size",
>> +  "proxy.config.http.response_header_max_size"
> 
> why not close this up with a ',' ?

Here it *might* make sense, but I personally don't care for it much.

>> +    TS_CONFIG_HTTP_RESPONSE_HEADER_MAX_SIZE,
>> +    TS_CONFIG_LAST_ENTRY
> 
> why not close this up with a ',' ?

Here we should absolutely not add a trailing (extraneous) ",". There's a reason for this, TS_CONFIG_LAST_ENTRY is a sentinel, it must always be the last. Having a trailing "," would potentially invite people to append to it, which simply won't work. :)


Cheers and thanks for the reviews, as usual. We need more Igor's.

-- leif


Re: [01/10] git commit: TS-1255 Add Req/Resp max header size to be overridable

Posted by Igor Galić <i....@brainsware.org>.

----- Original Message -----
> Updated Branches:
>   refs/heads/master cecc082d4 -> 7485e0b5f
> 
> 
> TS-1255 Add Req/Resp max header size to be overridable
> 

> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b0e7c2ab/proxy/InkAPI.cc
> ----------------------------------------------------------------------
> diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
> index 1ed9933..99c833d 100644
> --- a/proxy/InkAPI.cc
> +++ b/proxy/InkAPI.cc
> @@ -7577,6 +7577,14 @@ _conf_to_memberp(TSOverridableConfigKey conf,
> HttpSM* sm, OverridableDataType *t
>      typ = OVERRIDABLE_TYPE_INT;
>      ret = &sm->t_state.txn_conf->default_buffer_water_mark;
>      break;
> +  case TS_CONFIG_HTTP_REQUEST_HEADER_MAX_SIZE:
> +    typ = OVERRIDABLE_TYPE_INT;
> +    ret = &sm->t_state.txn_conf->request_hdr_max_size;
> +    break;
> +  case TS_CONFIG_HTTP_RESPONSE_HEADER_MAX_SIZE:
> +    typ = OVERRIDABLE_TYPE_INT;
> +    ret = &sm->t_state.txn_conf->response_hdr_max_size;
> +    break;
>  
>      // This helps avoiding compiler warnings, yet detect unhandled
>      enum members.
>    case TS_CONFIG_NULL:
> @@ -7898,6 +7906,8 @@ TSHttpTxnConfigFind(const char* name, int
> length, TSOverridableConfigKey *conf,
>      case 'e':
>        if (!strncmp(name,
>        "proxy.config.http.anonymize_remove_cookie", length))
>          cnf = TS_CONFIG_HTTP_ANONYMIZE_REMOVE_COOKIE;
> +      else if (!strncmp(name,
> "proxy.config.http.request_header_max_size", length))
> +        cnf = TS_CONFIG_HTTP_REQUEST_HEADER_MAX_SIZE;
>        break;
>      case 'r':
>        if (!strncmp(name,
>        "proxy.config.http.insert_response_via_str", length))
> @@ -7917,6 +7927,8 @@ TSHttpTxnConfigFind(const char* name, int
> length, TSOverridableConfigKey *conf,
>      case 'e':
>        if (!strncmp(name,
>        "proxy.config.http.cache.when_to_revalidate", length))
>          cnf = TS_CONFIG_HTTP_CACHE_WHEN_TO_REVALIDATE;
> +      else if (!strncmp(name,
> "proxy.config.http.response_header_max_size", length))
> +        cnf = TS_CONFIG_HTTP_RESPONSE_HEADER_MAX_SIZE;
>        break;
>      case 'r':
>        if (!strncmp(name,
>        "proxy.config.http.anonymize_remove_referer", length))
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b0e7c2ab/proxy/InkAPITest.cc
> ----------------------------------------------------------------------
> diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
> index 42de90c..85cc589 100644
> --- a/proxy/InkAPITest.cc
> +++ b/proxy/InkAPITest.cc
> @@ -7399,7 +7399,9 @@ const char
> *SDK_Overridable_Configs[TS_CONFIG_LAST_ENTRY] = {
>    "proxy.config.http.cache.range.lookup",
>    "proxy.config.http.normalize_ae_gzip",
>    "proxy.config.http.default_buffer_size",
> -  "proxy.config.http.default_buffer_water_mark"
> +  "proxy.config.http.default_buffer_water_mark",
> +  "proxy.config.http.request_header_max_size",
> +  "proxy.config.http.response_header_max_size"

why not close this up with a ',' ?

>  };
>  
>  REGRESSION_TEST(SDK_API_OVERRIDABLE_CONFIGS) (RegressionTest * test,
>  int /* atype ATS_UNUSED */, int *pstatus)
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b0e7c2ab/proxy/api/ts/ts.h.in
> ----------------------------------------------------------------------
> diff --git a/proxy/api/ts/ts.h.in b/proxy/api/ts/ts.h.in
> index b9cd558..47eeaf6 100644
> --- a/proxy/api/ts/ts.h.in
> +++ b/proxy/api/ts/ts.h.in
> @@ -675,7 +675,9 @@ extern "C"
>      TS_CONFIG_HTTP_NORMALIZE_AE_GZIP,
>      TS_CONFIG_HTTP_DEFAULT_BUFFER_SIZE,
>      TS_CONFIG_HTTP_DEFAULT_BUFFER_WATER_MARK,
> -    TS_CONFIG_LAST_ENTRY,
> +    TS_CONFIG_HTTP_REQUEST_HEADER_MAX_SIZE,
> +    TS_CONFIG_HTTP_RESPONSE_HEADER_MAX_SIZE,
> +    TS_CONFIG_LAST_ENTRY

why not close this up with a ',' ?


>    } TSOverridableConfigKey;
>  
>    /* The TASK pool of threads is the primary method of off-loading
>    continuations from the
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b0e7c2ab/proxy/http/HttpConfig.cc
> ----------------------------------------------------------------------
> diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
> index b4db289..c8c0abc 100644
> --- a/proxy/http/HttpConfig.cc
> +++ b/proxy/http/HttpConfig.cc
> @@ -1291,9 +1291,8 @@ HttpConfig::startup()
>  
>    HttpEstablishStaticConfigStringAlloc(c.connect_ports_string,
>    "proxy.config.http.connect_ports");
>  
> -  HttpEstablishStaticConfigLongLong(c.request_hdr_max_size,
> "proxy.config.http.request_header_max_size");
> -
> -  HttpEstablishStaticConfigLongLong(c.response_hdr_max_size,
> "proxy.config.http.response_header_max_size");
> +  HttpEstablishStaticConfigLongLong(c.oride.request_hdr_max_size,
> "proxy.config.http.request_header_max_size");
> +  HttpEstablishStaticConfigLongLong(c.oride.response_hdr_max_size,
> "proxy.config.http.response_header_max_size");
>  
>    HttpEstablishStaticConfigByte(c.push_method_enabled,
>    "proxy.config.http.push_method_enabled");
>  
> @@ -1561,9 +1560,10 @@ HttpConfig::reconfigure()
>    params->connect_ports_string =
>    ats_strdup(m_master.connect_ports_string);
>    params->connect_ports =
>    parse_ports_list(params->connect_ports_string);
>  
> -  params->request_hdr_max_size = m_master.request_hdr_max_size;
> -  params->response_hdr_max_size = m_master.response_hdr_max_size;
> -  params->push_method_enabled =
> INT_TO_BOOL(m_master.push_method_enabled);
> +  params->oride.request_hdr_max_size =
> m_master.oride.request_hdr_max_size;
> +  params->oride.response_hdr_max_size =
> m_master.oride.response_hdr_max_size;
> +
> +params->push_method_enabled =
> INT_TO_BOOL(m_master.push_method_enabled);
>  
>    params->reverse_proxy_enabled =
>    INT_TO_BOOL(m_master.reverse_proxy_enabled);
>    params->url_remap_required =
>    INT_TO_BOOL(m_master.url_remap_required);
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b0e7c2ab/proxy/http/HttpConfig.h
> ----------------------------------------------------------------------
> diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
> index 27a96e7..de47b94 100644
> --- a/proxy/http/HttpConfig.h
> +++ b/proxy/http/HttpConfig.h
> @@ -414,6 +414,7 @@ struct OverridableHttpConfigParams {
>        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),
> +      request_hdr_max_size(131072), response_hdr_max_size(131072),
>        cache_heuristic_min_lifetime(3600),
>        cache_heuristic_max_lifetime(86400),
>        cache_guaranteed_min_lifetime(0),
>        cache_guaranteed_max_lifetime(31536000),
>        cache_max_stale_age(604800),
>        keep_alive_no_activity_timeout_in(115),
>        keep_alive_no_activity_timeout_out(120),
> @@ -524,6 +525,12 @@ struct OverridableHttpConfigParams {
>    ///////////////////////////////
>    MgmtInt server_tcp_init_cwnd;
>  
> +  ///////////////
> +  // Hdr Limit //
> +  ///////////////
> +  MgmtInt request_hdr_max_size;
> +  MgmtInt response_hdr_max_size;
> +
>    /////////////////////
>    // cache variables //
>    /////////////////////
> @@ -702,12 +709,6 @@ public:
>    char *connect_ports_string;
>    HttpConfigPortRange *connect_ports;
>  
> -  ///////////////
> -  // Hdr Limit //
> -  ///////////////
> -  MgmtInt request_hdr_max_size;
> -  MgmtInt response_hdr_max_size;
> -
>    //////////
>    // Push //
>    //////////
> @@ -923,8 +924,6 @@ HttpConfigParams::HttpConfigParams()
>      cache_when_to_add_no_cache_to_msie_requests(-1),
>      connect_ports_string(NULL),
>      connect_ports(NULL),
> -    request_hdr_max_size(131072),
> -    response_hdr_max_size(131072),
>      push_method_enabled(0),
>      referer_filter_enabled(0),
>      referer_format_redirect(0),
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b0e7c2ab/proxy/http/HttpSM.cc
> ----------------------------------------------------------------------
> diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
> index 5647f22..5b879bc 100644
> --- a/proxy/http/HttpSM.cc
> +++ b/proxy/http/HttpSM.cc
> @@ -720,7 +720,7 @@ HttpSM::state_read_client_request_header(int
> event, void *data)
>    client_request_hdr_bytes += bytes_used;
>  
>    // Check to see if we are over the hdr size limit
> -  if (client_request_hdr_bytes >
> t_state.http_config_param->request_hdr_max_size) {
> +  if (client_request_hdr_bytes >
> t_state.txn_conf->request_hdr_max_size) {
>      DebugSM("http", "client header bytes were over max header size;
>      treating as a bad request");
>      state = PARSE_ERROR;
>    }
> @@ -1776,7 +1776,7 @@ HttpSM::state_read_server_response_header(int
> event, void *data)
>      state = PARSE_ERROR;
>    }
>    // Check to see if we are over the hdr size limit
> -  if (server_response_hdr_bytes >
> t_state.http_config_param->response_hdr_max_size) {
> +  if (server_response_hdr_bytes >
> t_state.txn_conf->response_hdr_max_size) {
>      state = PARSE_ERROR;
>    }
>  
> 
> 

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 6880 4155 74BD FD7C B515  2EA5 4B1D 9E08 A097 C9AE


[10/10] git commit: Added Ts-1255

Posted by zw...@apache.org.
Added Ts-1255


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/7485e0b5
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/7485e0b5
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/7485e0b5

Branch: refs/heads/master
Commit: 7485e0b5f5090b53f5afce74f19f88cdfdf239d4
Parents: f047b43
Author: Leif Hedstrom <zw...@apache.org>
Authored: Thu Aug 1 22:44:11 2013 +0200
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Thu Aug 1 22:44:11 2013 +0200

----------------------------------------------------------------------
 CHANGES | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7485e0b5/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index dc9fc4c..02d9d02 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,10 @@
 Changes with Apache Traffic Server 3.3.5
 
 
+  *) [TS-1255] Add more overridable configurations, and fix bugs in how we
+   deal with some of these (all "float" configs were completely broken). I
+   also modified the regression tests to be less easy to fool.
+
   *) [TS-1976] Prevent an invalid httpport argument being passed from
    traffic_manager to traffic_server
    Author: Thach Tran <tr...@gmail.com>


[03/10] git commit: TS-1255 Make proxy.config.http.normalize_ae_gzip overridable

Posted by zw...@apache.org.
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 <zw...@apache.org>
Authored: Sun Jul 28 00:59:56 2013 +0200
Committer: Leif Hedstrom <zw...@apache.org>
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);
 


[09/10] git commit: TS-1255 Added accept-encoding filter to overridable configs

Posted by zw...@apache.org.
TS-1255 Added accept-encoding filter to overridable configs


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/73b277f6
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/73b277f6
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/73b277f6

Branch: refs/heads/master
Commit: 73b277f6dc56fc61c27e56c14266e60091e48637
Parents: ec65b11
Author: Leif Hedstrom <zw...@apache.org>
Authored: Mon Jul 29 00:26:42 2013 +0200
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Thu Aug 1 22:42:49 2013 +0200

----------------------------------------------------------------------
 proxy/InkAPI.cc            |  8 ++++++++
 proxy/InkAPITest.cc        |  3 ++-
 proxy/api/ts/ts.h.in       |  1 +
 proxy/http/HttpConfig.cc   |  2 +-
 proxy/http/HttpConfig.h    | 14 +++++---------
 proxy/http/HttpTransact.cc |  2 +-
 6 files changed, 18 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/73b277f6/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 63001f2..5b3e728 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -7593,6 +7593,10 @@ _conf_to_memberp(TSOverridableConfigKey conf, HttpSM* sm, OverridableDataType *t
     typ = OVERRIDABLE_TYPE_INT;
     ret = &sm->t_state.txn_conf->negative_revalidating_lifetime;
     break;
+  case TS_CONFIG_HTTP_ACCEPT_ENCODING_FILTER_ENABLED:
+    typ = OVERRIDABLE_TYPE_INT;
+    ret = &sm->t_state.txn_conf->accept_encoding_filter_enabled;
+    break;
 
     // This helps avoiding compiler warnings, yet detect unhandled enum members.
   case TS_CONFIG_NULL:
@@ -8052,6 +8056,10 @@ TSHttpTxnConfigFind(const char* name, int length, TSOverridableConfigKey *conf,
 
   case 48:
     switch (name[length-1]) {
+    case 'd':
+      if (!strncmp(name, "proxy.config.http.accept_encoding_filter_enabled", length))
+        cnf = TS_CONFIG_HTTP_ACCEPT_ENCODING_FILTER_ENABLED;
+      break;
     case 'e':
       if (!strncmp(name, "proxy.config.http.cache.ignore_client_cc_max_age", length))
         cnf = TS_CONFIG_HTTP_CACHE_IGNORE_CLIENT_CC_MAX_AGE;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/73b277f6/proxy/InkAPITest.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
index 108a125..f9a0f83 100644
--- a/proxy/InkAPITest.cc
+++ b/proxy/InkAPITest.cc
@@ -7403,7 +7403,8 @@ const char *SDK_Overridable_Configs[TS_CONFIG_LAST_ENTRY] = {
   "proxy.config.http.request_header_max_size",
   "proxy.config.http.response_header_max_size",
   "proxy.config.http.negative_revalidating_enabled",
-  "proxy.config.http.negative_revalidating_lifetime"
+  "proxy.config.http.negative_revalidating_lifetime",
+  "proxy.config.http.accept_encoding_filter_enabled"
 };
 
 REGRESSION_TEST(SDK_API_OVERRIDABLE_CONFIGS) (RegressionTest * test, int /* atype ATS_UNUSED */, int *pstatus)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/73b277f6/proxy/api/ts/ts.h.in
----------------------------------------------------------------------
diff --git a/proxy/api/ts/ts.h.in b/proxy/api/ts/ts.h.in
index 4b34bd8..3379a26 100644
--- a/proxy/api/ts/ts.h.in
+++ b/proxy/api/ts/ts.h.in
@@ -679,6 +679,7 @@ extern "C"
     TS_CONFIG_HTTP_RESPONSE_HEADER_MAX_SIZE,
     TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_ENABLED,
     TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_LIFETIME,
+    TS_CONFIG_HTTP_ACCEPT_ENCODING_FILTER_ENABLED,
     TS_CONFIG_LAST_ENTRY
   } TSOverridableConfigKey;
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/73b277f6/proxy/http/HttpConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index 1f7c478..461a9b7 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -1581,7 +1581,7 @@ params->push_method_enabled = INT_TO_BOOL(m_master.push_method_enabled);
   params->referer_filter_enabled = INT_TO_BOOL(m_master.referer_filter_enabled);
   params->referer_format_redirect = INT_TO_BOOL(m_master.referer_format_redirect);
 
-  params->accept_encoding_filter_enabled = INT_TO_BOOL(m_master.accept_encoding_filter_enabled);
+  params->oride.accept_encoding_filter_enabled = INT_TO_BOOL(m_master.oride.accept_encoding_filter_enabled);
 
   params->oride.down_server_timeout = m_master.oride.down_server_timeout;
   params->oride.client_abort_threshold = m_master.oride.client_abort_threshold;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/73b277f6/proxy/http/HttpConfig.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index d4970e5..c220463 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -506,6 +506,11 @@ struct OverridableHttpConfigParams {
   MgmtByte doc_in_cache_skip_dns;
   MgmtByte flow_control_enabled;
 
+  ////////////////////////////////////////////////////////
+  // HTTP Accept-Encoding filtering based on User-Agent //
+  ////////////////////////////////////////////////////////
+  MgmtByte accept_encoding_filter_enabled;
+
   ////////////////////////////////
   // Optimize gzip alternates   //
   ////////////////////////////////
@@ -565,9 +570,6 @@ struct OverridableHttpConfigParams {
   MgmtInt connect_attempts_timeout;
   MgmtInt post_connect_attempts_timeout;
 
-  ////////////////////////
-  //  Negative Caching  //
-  ////////////////////////
   MgmtInt down_server_timeout;
   MgmtInt client_abort_threshold;
 
@@ -726,11 +728,6 @@ public:
   MgmtByte referer_filter_enabled;
   MgmtByte referer_format_redirect;
 
-  ////////////////////////////////////////////////////////
-  // HTTP Accept-Encoding filtering based on User-Agent //
-  ////////////////////////////////////////////////////////
-  MgmtByte accept_encoding_filter_enabled;
-
   //////////////////
   // Transparency //
   //////////////////
@@ -927,7 +924,6 @@ HttpConfigParams::HttpConfigParams()
     push_method_enabled(0),
     referer_filter_enabled(0),
     referer_format_redirect(0),
-    accept_encoding_filter_enabled(0),
     client_transparency_enabled(false),
     server_transparency_enabled(false),
     reverse_proxy_enabled(0),

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/73b277f6/proxy/http/HttpTransact.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index a39447e..42e0b38 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -1072,7 +1072,7 @@ HttpTransact::ModifyRequest(State* s)
   /////////////////////////////////////////////////////////
   // Modify Accept-Encoding for several specific User-Agent
   /////////////////////////////////////////////////////////
-  if (s->http_config_param->accept_encoding_filter_enabled) {
+  if (s->txn_conf->accept_encoding_filter_enabled) {
     perform_accept_encoding_filtering(s);
   }