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 2011/10/17 17:06:52 UTC
svn commit: r1185237 - in /trafficserver/traffic/trunk:
contrib/perl/AdminClient/lib/Apache/TS/ mgmt/ proxy/config/ proxy/http/
Author: zwoop
Date: Mon Oct 17 15:06:51 2011
New Revision: 1185237
URL: http://svn.apache.org/viewvc?rev=1185237&view=rev
Log:
TS-973 Eliminate proxy.config.http.verbose_via_str
Modified:
trafficserver/traffic/trunk/contrib/perl/AdminClient/lib/Apache/TS/AdminClient.pm
trafficserver/traffic/trunk/mgmt/RecordsConfig.cc
trafficserver/traffic/trunk/proxy/config/records.config.default.in
trafficserver/traffic/trunk/proxy/http/HttpConfig.cc
trafficserver/traffic/trunk/proxy/http/HttpConfig.h
trafficserver/traffic/trunk/proxy/http/HttpTransact.cc
trafficserver/traffic/trunk/proxy/http/HttpTransactHeaders.cc
trafficserver/traffic/trunk/proxy/http/HttpTransactHeaders.h
Modified: trafficserver/traffic/trunk/contrib/perl/AdminClient/lib/Apache/TS/AdminClient.pm
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/contrib/perl/AdminClient/lib/Apache/TS/AdminClient.pm?rev=1185237&r1=1185236&r2=1185237&view=diff
==============================================================================
--- trafficserver/traffic/trunk/contrib/perl/AdminClient/lib/Apache/TS/AdminClient.pm (original)
+++ trafficserver/traffic/trunk/contrib/perl/AdminClient/lib/Apache/TS/AdminClient.pm Mon Oct 17 15:06:51 2011
@@ -535,7 +535,6 @@ The Apache Traffic Server Administration
proxy.config.http_ui_enabled
proxy.config.http.uncacheable_requests_bypass_parent
proxy.config.http.user_agent_pipeline
- proxy.config.http.verbose_via_str
proxy.config.http.wuts_enabled
proxy.config.icp.default_reply_port
proxy.config.icp.enabled
Modified: trafficserver/traffic/trunk/mgmt/RecordsConfig.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/RecordsConfig.cc?rev=1185237&r1=1185236&r2=1185237&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/RecordsConfig.cc (original)
+++ trafficserver/traffic/trunk/mgmt/RecordsConfig.cc Mon Oct 17 15:06:51 2011
@@ -419,8 +419,6 @@ RecordElement RecordsConfig[] = {
// # 0 - no extra info added to string
// # 1 - all extra information added
// # 2 - some extra info added
- {RECT_CONFIG, "proxy.config.http.verbose_via_str", RECD_INT, "2", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
- ,
{RECT_CONFIG, "proxy.config.http.request_via_str", RECD_STRING, "ApacheTrafficServer/" PACKAGE_VERSION, RECU_DYNAMIC, RR_NULL, RECC_NULL, NULL, RECA_NULL}
,
{RECT_CONFIG, "proxy.config.http.response_via_str", RECD_STRING, "ApacheTrafficServer/" PACKAGE_VERSION, RECU_DYNAMIC, RR_NULL, RECC_NULL, NULL, RECA_NULL}
Modified: trafficserver/traffic/trunk/proxy/config/records.config.default.in
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/config/records.config.default.in?rev=1185237&r1=1185236&r2=1185237&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/config/records.config.default.in (original)
+++ trafficserver/traffic/trunk/proxy/config/records.config.default.in Mon Oct 17 15:06:51 2011
@@ -87,9 +87,16 @@ CONFIG proxy.config.http.server_port_att
# CONFIG proxy.config.http.server_other_ports STRING 8080:X6
CONFIG proxy.config.http.server_other_ports STRING NULL
CONFIG proxy.config.http.connect_ports STRING 443 563
+ # The via settings have three values
+ # 0 - Do not modify / set this via header
+ # 1 - Update the via, with normal verbosity
+ # 2 - Update the via, with higher verbosity
CONFIG proxy.config.http.insert_request_via_str INT 1
CONFIG proxy.config.http.insert_response_via_str INT 0
-CONFIG proxy.config.http.verbose_via_str INT 2
+ # Insert a Server: header, this has three values
+ # 0 - Don't add or modify the Server: header
+ # 1 - Add a Server: header
+ # 2 - Only add a Server: header if one doesn't exist already
CONFIG proxy.config.http.response_server_enabled INT 1
CONFIG proxy.config.http.enable_url_expandomatic INT 0
CONFIG proxy.config.http.no_dns_just_forward_to_parent INT 0
Modified: trafficserver/traffic/trunk/proxy/http/HttpConfig.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/HttpConfig.cc?rev=1185237&r1=1185236&r2=1185237&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/HttpConfig.cc (original)
+++ trafficserver/traffic/trunk/proxy/http/HttpConfig.cc Mon Oct 17 15:06:51 2011
@@ -1168,7 +1168,6 @@ HttpConfig::startup()
HttpEstablishStaticConfigByte(c.oride.insert_request_via_string, "proxy.config.http.insert_request_via_str");
HttpEstablishStaticConfigByte(c.oride.insert_response_via_string, "proxy.config.http.insert_response_via_str");
- HttpEstablishStaticConfigByte(c.verbose_via_string, "proxy.config.http.verbose_via_str");
HttpEstablishStaticConfigStringAlloc(c.proxy_request_via_string, "proxy.config.http.request_via_str");
c.proxy_request_via_string_len = -1;
@@ -1444,7 +1443,6 @@ HttpConfig::reconfigure()
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->verbose_via_string = INT_TO_BYTE(m_master.verbose_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);
Modified: trafficserver/traffic/trunk/proxy/http/HttpConfig.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/HttpConfig.h?rev=1185237&r1=1185236&r2=1185237&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/HttpConfig.h (original)
+++ trafficserver/traffic/trunk/proxy/http/HttpConfig.h Mon Oct 17 15:06:51 2011
@@ -618,8 +618,6 @@ public:
MgmtByte no_origin_server_dns;
MgmtByte use_client_target_addr;
- MgmtByte verbose_via_string;
-
char *proxy_request_via_string;
int proxy_request_via_string_len;
char *proxy_response_via_string;
@@ -909,7 +907,6 @@ HttpConfigParams::HttpConfigParams()
uncacheable_requests_bypass_parent(1),
no_origin_server_dns(0),
use_client_target_addr(0),
- verbose_via_string(0),
proxy_request_via_string(0),
proxy_request_via_string_len(0),
proxy_response_via_string(0),
Modified: trafficserver/traffic/trunk/proxy/http/HttpTransact.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/HttpTransact.cc?rev=1185237&r1=1185236&r2=1185237&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/HttpTransact.cc (original)
+++ trafficserver/traffic/trunk/proxy/http/HttpTransact.cc Mon Oct 17 15:06:51 2011
@@ -7780,7 +7780,7 @@ HttpTransact::build_request(State* s, HT
s->orig_scheme = URL_WKSIDX_HTTP;
if (s->txn_conf->insert_request_via_string)
- HttpTransactHeaders::insert_via_header_in_request(s->http_config_param, s->orig_scheme, outgoing_request, s->via_string);
+ HttpTransactHeaders::insert_via_header_in_request(s, outgoing_request);
// We build 1.1 request header and then convert as necessary to
// the appropriate version in HttpTransact::build_request
@@ -7975,7 +7975,7 @@ HttpTransact::build_response(State* s, H
s->next_hop_scheme = URL_WKSIDX_HTTP;
if (s->txn_conf->insert_response_via_string)
- HttpTransactHeaders::insert_via_header_in_response(s->http_config_param, s->next_hop_scheme, outgoing_response, s->via_string);
+ HttpTransactHeaders::insert_via_header_in_response(s, outgoing_response);
HttpTransactHeaders::convert_response(outgoing_version, outgoing_response);
Modified: trafficserver/traffic/trunk/proxy/http/HttpTransactHeaders.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/HttpTransactHeaders.cc?rev=1185237&r1=1185236&r2=1185237&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/HttpTransactHeaders.cc (original)
+++ trafficserver/traffic/trunk/proxy/http/HttpTransactHeaders.cc Mon Oct 17 15:06:51 2011
@@ -1036,18 +1036,20 @@ HttpTransactHeaders::insert_server_heade
//
///////////////////////////////////////////////////////////////////////////////
void
-HttpTransactHeaders::insert_via_header_in_request(HttpConfigParams *http_config_param, int scheme, HTTPHdr *header,
- char *incoming_via)
+HttpTransactHeaders::insert_via_header_in_request(HttpTransact::State *s, HTTPHdr *header)
{
char new_via_string[1024]; // 512-bytes for hostname+via string, 512-bytes for the debug info
char *via_string = new_via_string;
- if ((http_config_param->proxy_hostname_len + http_config_param->proxy_request_via_string_len) > 512) {
+ if ((s->http_config_param->proxy_hostname_len + s->http_config_param->proxy_request_via_string_len) > 512) {
header->value_append(MIME_FIELD_VIA, MIME_LEN_VIA, "TrafficServer", 13, true);
return;
}
+ char *incoming_via = s->via_string;
+ int scheme = s->orig_scheme;
ink_assert(scheme >= 0);
+
int scheme_len = hdrtoken_index_to_length(scheme);
int32_t hversion = header->version_get().m_version;
@@ -1065,7 +1067,7 @@ HttpTransactHeaders::insert_via_header_i
*via_string++ = '0' + HTTP_MINOR(hversion);
*via_string++ = ' ';
}
- via_string += nstrcpy(via_string, http_config_param->proxy_hostname);
+ via_string += nstrcpy(via_string, s->http_config_param->proxy_hostname);
*via_string++ = '[';
/* I thought we should use the transaction local outgoing IP address but
@@ -1078,22 +1080,20 @@ HttpTransactHeaders::insert_via_header_i
*via_string++ = ' ';
*via_string++ = '(';
- memcpy(via_string, http_config_param->proxy_request_via_string, http_config_param->proxy_request_via_string_len);
- via_string += http_config_param->proxy_request_via_string_len;
+ 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;
- if (http_config_param->verbose_via_string != 0) {
- *via_string++ = ' ';
- *via_string++ = '[';
+ *via_string++ = ' ';
+ *via_string++ = '[';
- // incoming_via can be max MAX_VIA_INDICES+1 long (i.e. around 25 or so)
- if (http_config_param->verbose_via_string == 1) {
- 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++ = ']';
+ // 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;
}
+ *via_string++ = ']';
*via_string++ = ')';
*via_string = 0;
@@ -1104,17 +1104,19 @@ HttpTransactHeaders::insert_via_header_i
void
-HttpTransactHeaders::insert_via_header_in_response(HttpConfigParams *http_config_param, int scheme, HTTPHdr *header,
- char *incoming_via)
+HttpTransactHeaders::insert_via_header_in_response(HttpTransact::State *s, HTTPHdr *header)
{
char new_via_string[1024]; // 512-bytes for hostname+via string, 512-bytes for the debug info
char *via_string = new_via_string;
- if ((http_config_param->proxy_hostname_len + http_config_param->proxy_response_via_string_len) > 512) {
+ if ((s->http_config_param->proxy_hostname_len + s->http_config_param->proxy_response_via_string_len) > 512) {
header->value_append(MIME_FIELD_VIA, MIME_LEN_VIA, "TrafficServer", 13, true);
return;
}
+ char *incoming_via = s->via_string;
+ int scheme = s->next_hop_scheme;
+
ink_assert(scheme >= 0);
int scheme_len = hdrtoken_index_to_length(scheme);
int32_t hversion = header->version_get().m_version;
@@ -1133,26 +1135,25 @@ HttpTransactHeaders::insert_via_header_i
*via_string++ = '0' + HTTP_MINOR(hversion);
*via_string++ = ' ';
}
- via_string += nstrcpy(via_string, http_config_param->proxy_hostname);
+ via_string += nstrcpy(via_string, s->http_config_param->proxy_hostname);
*via_string++ = ' ';
*via_string++ = '(';
- memcpy(via_string, http_config_param->proxy_response_via_string, http_config_param->proxy_response_via_string_len);
- via_string += http_config_param->proxy_response_via_string_len;
+ 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;
- if (http_config_param->verbose_via_string != 0) {
- *via_string++ = ' ';
- *via_string++ = '[';
+ *via_string++ = ' ';
+ *via_string++ = '[';
- // incoming_via can be max MAX_VIA_INDICES+1 long (i.e. around 25 or so)
- if (http_config_param->verbose_via_string == 1) {
- 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++ = ']';
+ // 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;
}
+ *via_string++ = ']';
+
*via_string++ = ')';
*via_string = 0;
Modified: trafficserver/traffic/trunk/proxy/http/HttpTransactHeaders.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/HttpTransactHeaders.h?rev=1185237&r1=1185236&r2=1185237&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/HttpTransactHeaders.h (original)
+++ trafficserver/traffic/trunk/proxy/http/HttpTransactHeaders.h Mon Oct 17 15:06:51 2011
@@ -86,8 +86,8 @@ public:
ink_time_t response_received_time,
ink_time_t now, HTTPHdr * base, HTTPHdr * outgoing);
static void insert_server_header_in_response(const char *server_tag, int server_tag_size, HTTPHdr * header);
- static void insert_via_header_in_request(HttpConfigParams *http_config_param, int scheme, HTTPHdr *header, char *incoming_via);
- static void insert_via_header_in_response(HttpConfigParams *http_config_param, int scheme, HTTPHdr *header, char *incoming_via);
+ static void insert_via_header_in_request(HttpTransact::State *s, HTTPHdr *header);
+ static void insert_via_header_in_response(HttpTransact::State *s, HTTPHdr *header);
static bool is_request_proxy_authorized(HTTPHdr * incoming_hdr);