You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by am...@apache.org on 2010/10/19 18:54:36 UTC
svn commit: r1024322 - in /trafficserver/traffic/branches/wccp/proxy:
http2/HttpConfig.cc http2/HttpConfig.h http2/HttpTransact.cc
mgmt2/RecordsConfig.cc
Author: amc
Date: Tue Oct 19 16:54:36 2010
New Revision: 1024322
URL: http://svn.apache.org/viewvc?rev=1024322&view=rev
Log:
Fix for using client's address for origin server.
Modified:
trafficserver/traffic/branches/wccp/proxy/http2/HttpConfig.cc
trafficserver/traffic/branches/wccp/proxy/http2/HttpConfig.h
trafficserver/traffic/branches/wccp/proxy/http2/HttpTransact.cc
trafficserver/traffic/branches/wccp/proxy/mgmt2/RecordsConfig.cc
Modified: trafficserver/traffic/branches/wccp/proxy/http2/HttpConfig.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/http2/HttpConfig.cc?rev=1024322&r1=1024321&r2=1024322&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/http2/HttpConfig.cc (original)
+++ trafficserver/traffic/branches/wccp/proxy/http2/HttpConfig.cc Tue Oct 19 16:54:36 2010
@@ -1006,6 +1006,7 @@ HttpConfig::startup()
HttpEstablishStaticConfigLongLong(c.uncacheable_requests_bypass_parent,
"proxy.config.http.uncacheable_requests_bypass_parent");
HttpEstablishStaticConfigLongLong(c.no_origin_server_dns, "proxy.config.http.no_origin_server_dns");
+ HttpEstablishStaticConfigLongLong(c.use_client_target_addr, "proxy.config.http.use_client_target_addr");
HttpEstablishStaticConfigLongLong(c.maintain_pristine_host_hdr, "proxy.config.url_remap.pristine_host_hdr");
HttpEstablishStaticConfigLongLong(c.snarf_username_from_authorization,
@@ -1346,6 +1347,7 @@ HttpConfig::reconfigure()
params->no_dns_forward_to_parent = INT_TO_BOOL(m_master.no_dns_forward_to_parent);
params->uncacheable_requests_bypass_parent = INT_TO_BOOL(m_master.uncacheable_requests_bypass_parent);
params->no_origin_server_dns = INT_TO_BOOL(m_master.no_origin_server_dns);
+ params->use_client_target_addr = INT_TO_BOOL(m_master.use_client_target_addr);
params->maintain_pristine_host_hdr = INT_TO_BOOL(m_master.maintain_pristine_host_hdr);
params->snarf_username_from_authorization = INT_TO_BOOL(m_master.snarf_username_from_authorization);
Modified: trafficserver/traffic/branches/wccp/proxy/http2/HttpConfig.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/http2/HttpConfig.h?rev=1024322&r1=1024321&r2=1024322&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/http2/HttpConfig.h (original)
+++ trafficserver/traffic/branches/wccp/proxy/http2/HttpConfig.h Tue Oct 19 16:54:36 2010
@@ -411,6 +411,7 @@ public:
MgmtInt no_dns_forward_to_parent;
MgmtInt uncacheable_requests_bypass_parent;
MgmtInt no_origin_server_dns;
+ MgmtInt use_client_target_addr;
MgmtInt maintain_pristine_host_hdr;
MgmtInt snarf_username_from_authorization;
@@ -854,6 +855,7 @@ enable_url_expandomatic(0),
no_dns_forward_to_parent(0),
uncacheable_requests_bypass_parent(1),
no_origin_server_dns(0),
+use_client_target_addr(0),
maintain_pristine_host_hdr(0),
//snarf_username_from_authorization(0),
insert_request_via_string(0),
Modified: trafficserver/traffic/branches/wccp/proxy/http2/HttpTransact.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/http2/HttpTransact.cc?rev=1024322&r1=1024321&r2=1024322&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/http2/HttpTransact.cc (original)
+++ trafficserver/traffic/branches/wccp/proxy/http2/HttpTransact.cc Tue Oct 19 16:54:36 2010
@@ -1178,11 +1178,26 @@ HttpTransact::HandleRequest(State * s)
if (handle_trace_and_options_requests(s, &s->hdr_info.client_request)) {
TRANSACT_RETURN(PROXY_INTERNAL_CACHE_NOOP, NULL);
}
- // for HTTPS requests, we must go directly to the
- // origin server. Ignore the no_dns_just_forward_to_parent setting.
-
- if (s->http_config_param->no_dns_forward_to_parent &&
- s->scheme != URL_WKSIDX_HTTPS && strcmp(s->server_info.name, "127.0.0.1") != 0) {
+ /* If the connection is client side transparent and the URL was not
+ remapped, we can use the client destination IP address instead of
+ doing a DNS lookup. This is controlled by the 'use_client_target_addr'
+ configuration parameter.
+ */
+ if (s->http_config_param->use_client_target_addr
+ && !s->url_remap_success
+ && s->client_info.is_transparent
+ ) {
+ uint32 addr = s->state_machine->ua_session->get_netvc()->get_local_ip();
+ Debug("http_trans", "[HttpTransact::HandleRequest] Skipping DNS lookup for client supplied target %u.%u.%u.%u.\n", PRINT_IP(addr));
+ s->request_data.dest_ip = addr;
+ s->server_info.ip = addr;
+ s->force_dns = 0;
+ } else if (s->http_config_param->no_dns_forward_to_parent
+ && s->scheme != URL_WKSIDX_HTTPS
+ && strcmp(s->server_info.name, "127.0.0.1") != 0
+ ) {
+ // for HTTPS requests, we must go directly to the
+ // origin server. Ignore the no_dns_just_forward_to_parent setting.
// we need to see if the hostname is an
// ip address since the parent selection code result
// could change as a result of this ip address
Modified: trafficserver/traffic/branches/wccp/proxy/mgmt2/RecordsConfig.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/mgmt2/RecordsConfig.cc?rev=1024322&r1=1024321&r2=1024322&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/mgmt2/RecordsConfig.cc (original)
+++ trafficserver/traffic/branches/wccp/proxy/mgmt2/RecordsConfig.cc Tue Oct 19 16:54:36 2010
@@ -673,6 +673,8 @@ RecordElement RecordsConfig[] = {
,
{CONFIG, "proxy.config.http.no_origin_server_dns", "", INK_INT, "0", RU_REREAD, RR_NULL, RC_INT, "[0-1]", RA_NULL}
,
+ {CONFIG, "proxy.config.http.use_client_target_addr", "", INK_INT, "0", RU_REREAD, RR_NULL, RC_INT, "[0-1]", RA_NULL}
+ ,
{CONFIG, "proxy.config.http.keep_alive_enabled", "", INK_INT, "1", RU_REREAD, RR_NULL, RC_NULL, NULL, RA_NULL}
,
{CONFIG, "proxy.config.http.keep_alive_post_out", "", INK_INT, "0", RU_REREAD, RR_NULL, RC_NULL, NULL, RA_NULL}