Updated Branches: refs/heads/master e8d05ed7c -> 2511fd571
TS-1282 Verbosity on Via header was not honored properly Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/2511fd57 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/2511fd57 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/2511fd57 Branch: refs/heads/master Commit: 2511fd571796480ce39bc999d70ed7d0b490a4c8 Parents: e8d05ed Author: Leif Hedstrom <[email protected]> Authored: Wed May 30 11:52:47 2012 -0600 Committer: Leif Hedstrom <[email protected]> Committed: Wed May 30 11:52:47 2012 -0600 ---------------------------------------------------------------------- CHANGES | 4 +++ proxy/config/records.config.default.in | 3 +- proxy/http/HttpConfig.cc | 4 +- proxy/http/HttpTransactHeaders.cc | 40 +++++++++++++++------------ 4 files changed, 30 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2511fd57/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index b40d767..e5380c7 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,8 @@ -*- coding: utf-8 -*- +Changes with Apache Traffic Server 3.1.5 (or 3.3.0 EDIT) + *) [TS-1282] Verbosity settings for Via headers is broken. + + Changes with Apache Traffic Server 3.1.4 *) [TS-1279] Fix build system for gcc < 4.3. http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2511fd57/proxy/config/records.config.default.in ---------------------------------------------------------------------- diff --git a/proxy/config/records.config.default.in b/proxy/config/records.config.default.in index 5bbf60d..4fa439a 100644 --- a/proxy/config/records.config.default.in +++ b/proxy/config/records.config.default.in @@ -102,10 +102,11 @@ CONFIG proxy.config.alarm.abs_path STRING NULL CONFIG proxy.config.http.server_ports STRING 8080 # Ports on the origin server to which a blind tunnel may connect. CONFIG proxy.config.http.connect_ports STRING 443 563 - # The via settings have three values + # The via settings have four values # 0 - Do not modify / set this via header # 1 - Update the via, with normal verbosity # 2 - Update the via, with higher verbosity + # 3 - Update the via, with highest verbosity CONFIG proxy.config.http.insert_request_via_str INT 1 CONFIG proxy.config.http.insert_response_via_str INT 0 # Insert a Server: header, this has three values http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2511fd57/proxy/http/HttpConfig.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc index 3f5c1f2..0667565 100644 --- a/proxy/http/HttpConfig.cc +++ b/proxy/http/HttpConfig.cc @@ -1437,8 +1437,8 @@ HttpConfig::reconfigure() params->parent_proxy_routing_enable = INT_TO_BOOL(m_master.parent_proxy_routing_enable); params->enable_url_expandomatic = INT_TO_BOOL(m_master.enable_url_expandomatic); - params->oride.insert_request_via_string = INT_TO_BOOL(m_master.oride.insert_request_via_string); - params->oride.insert_response_via_string = INT_TO_BOOL(m_master.oride.insert_response_via_string); + params->oride.insert_request_via_string = m_master.oride.insert_request_via_string; + params->oride.insert_response_via_string = m_master.oride.insert_response_via_string; params->proxy_request_via_string = ats_strdup(m_master.proxy_request_via_string); params->proxy_request_via_string_len = (params->proxy_request_via_string) ? strlen(params->proxy_request_via_string) : 0; params->proxy_response_via_string = ats_strdup(m_master.proxy_response_via_string); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2511fd57/proxy/http/HttpTransactHeaders.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpTransactHeaders.cc b/proxy/http/HttpTransactHeaders.cc index 1047290..c09d66a 100644 --- a/proxy/http/HttpTransactHeaders.cc +++ b/proxy/http/HttpTransactHeaders.cc @@ -1081,17 +1081,19 @@ HttpTransactHeaders::insert_via_header_in_request(HttpTransact::State *s, HTTPHd memcpy(via_string, s->http_config_param->proxy_request_via_string, s->http_config_param->proxy_request_via_string_len); via_string += s->http_config_param->proxy_request_via_string_len; - *via_string++ = ' '; - *via_string++ = '['; + if (s->txn_conf->insert_request_via_string > 1) { + *via_string++ = ' '; + *via_string++ = '['; - // incoming_via can be max MAX_VIA_INDICES+1 long (i.e. around 25 or so) - if (s->txn_conf->insert_request_via_string < 2) { - via_string += nstrcpy(via_string, incoming_via); - } else { - memcpy(via_string, incoming_via + VIA_CLIENT, VIA_SERVER - VIA_CLIENT); - via_string += VIA_SERVER - VIA_CLIENT; + // incoming_via can be max MAX_VIA_INDICES+1 long (i.e. around 25 or so) + if (s->txn_conf->insert_request_via_string > 2) { // Highest verbosity + via_string += nstrcpy(via_string, incoming_via); + } else { + memcpy(via_string, incoming_via + VIA_CLIENT, VIA_SERVER - VIA_CLIENT); + via_string += VIA_SERVER - VIA_CLIENT; + } + *via_string++ = ']'; } - *via_string++ = ']'; *via_string++ = ')'; *via_string = 0; @@ -1140,17 +1142,19 @@ HttpTransactHeaders::insert_via_header_in_response(HttpTransact::State *s, HTTPH memcpy(via_string, s->http_config_param->proxy_response_via_string, s->http_config_param->proxy_response_via_string_len); via_string += s->http_config_param->proxy_response_via_string_len; - *via_string++ = ' '; - *via_string++ = '['; + if (s->txn_conf->insert_response_via_string > 1) { + *via_string++ = ' '; + *via_string++ = '['; - // incoming_via can be max MAX_VIA_INDICES+1 long (i.e. around 25 or so) - if (s->txn_conf->insert_request_via_string < 2) { - via_string += nstrcpy(via_string, incoming_via); - } else { - memcpy(via_string, incoming_via + VIA_CACHE, VIA_PROXY - VIA_CACHE); - via_string += VIA_PROXY - VIA_CACHE; + // incoming_via can be max MAX_VIA_INDICES+1 long (i.e. around 25 or so) + if (s->txn_conf->insert_response_via_string > 2) { // Highest verbosity + via_string += nstrcpy(via_string, incoming_via); + } else { + memcpy(via_string, incoming_via + VIA_CACHE, VIA_PROXY - VIA_CACHE); + via_string += VIA_PROXY - VIA_CACHE; + } + *via_string++ = ']'; } - *via_string++ = ']'; *via_string++ = ')'; *via_string = 0;
