[ https://issues.apache.org/jira/browse/TS-4570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15357900#comment-15357900 ]
ASF subversion and git services commented on TS-4570: ----------------------------------------------------- Commit 658cbb952e70507dd496b7a5e1172995523d6f38 in trafficserver's branch refs/heads/master from [~jpe...@apache.org] [ https://git-wip-us.apache.org/repos/asf?p=trafficserver.git;h=658cbb9 ] Merge pull request #740 from jpeach/fix/4570 TS-4570: Return to TS_HTTP_OS_DNS_HOOK if server address is set. > Return to TS_HTTP_OS_DNS_HOOK after explicit DNS > ------------------------------------------------ > > Key: TS-4570 > URL: https://issues.apache.org/jira/browse/TS-4570 > Project: Traffic Server > Issue Type: Improvement > Components: Core, TS API > Reporter: James Peach > Fix For: sometime > > > Consider the case of a plugin that has out -of-band routing knowledge > equivalent to DNS. So for a domain, it might have a number of possible IP > addresses. Remap plugins can implement {{TSRemapOSResponse}}, which is called > in the connection result handling path, but there's no facility for global > plugins to reroute the request. > In my case, I'm largely doing forward proxying, so I don't have a remap rule > for everything I need to route. Hence I'm a global plugin. > Here is a relatively hacky patch that backs the state machine back up to > {{TS_HTTP_OS_DNS_HOOK}} if we get a connection failure, have retries left, > and a plugin has called {{TSHttpTxnServerAddrSet}}. > {code} > $ git diff proxy/http/HttpTransact.cc > diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc > index 5ef0430..3363af1 100644 > --- a/proxy/http/HttpTransact.cc > +++ b/proxy/http/HttpTransact.cc > @@ -3762,6 +3762,11 @@ HttpTransact::handle_response_from_server(State *s) > // families - that is locked in by the client source address. > > s->state_machine->ua_session->set_host_res_style(ats_host_res_match(&s->current.server->dst_addr.sa)); > TRANSACT_RETURN(SM_ACTION_DNS_LOOKUP, OSDNSLookup); > + } else if (s->api_server_addr_set) { > + // If the address was set by a plugin, give it another chance. > + s->dns_info.os_addr_style = DNSLookupInfo::OS_ADDR_TRY_HOSTDB; > + s->current.attempts++; > + TRANSACT_RETURN(SM_ACTION_API_OS_DNS, OSDNSLookup); > } else if ((s->dns_info.srv_lookup_success || > s->host_db_info.is_rr_elt()) && > (s->txn_conf->connect_attempts_rr_retries > 0) && > (s->current.attempts % > s->txn_conf->connect_attempts_rr_retries == 0)) { > {code} > Note that some plugins might be unprepared for {{TS_HTTP_OS_DNS_HOOK}} to be > called multiple times, so we should document that. -- This message was sent by Atlassian JIRA (v6.3.4#6332)