[
https://issues.apache.org/jira/browse/TS-4388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15263135#comment-15263135
]
ASF GitHub Bot commented on TS-4388:
------------------------------------
GitHub user jpeach opened a pull request:
https://github.com/apache/trafficserver/pull/606
TS-4388: Fix TSHttpTxnParentProxySet
This PR fixes ``TSHttpTxnParentProxySet``.
The first two commits are minor cleanups of cruft. The third one fixes the
API tests so that they don't interfere with each other when they register
multiple global hooks. The final one actually fixes the
``TSHttpTxnParentProxySet`` API, primarily by restricting access to private
``ParentResult`` data and providing accessors that enforce the correct policy.
I've tested that this works correctly with the tests and with my plugin. I
don't have any way to test that I haven't broken the various parent retry
features.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/jpeach/trafficserver jpeach/parent-proxy-api
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/trafficserver/pull/606.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #606
----
commit 295908ee95fed93c469a1b96508d0fab12609650
Author: James Peach <[email protected]>
Date: 2016-04-27T18:12:11Z
TS-4388: Remove useless record API defines.
commit 10b81dbfead0238a62d6dde832172e6f14528da6
Author: James Peach <[email protected]>
Date: 2016-04-27T18:20:25Z
TS-4388: Remove unused HttpConfig::parent_proxy_routing_enable.
commit 1c32eba4449787153b5b232b69c1e30497fb0647
Author: James Peach <[email protected]>
Date: 2016-04-28T20:02:38Z
TS-4388: Fix global hook handling in API tests.
Many of the API regression tests work by trampolining off a global
hook (which is really waht you have to do). However, there's no way
to unregister a global hook, so once the test is done, it needs to
be careful to co-operate with the remaining tests. We clear the
continuation data, and if is is clear, we either ignore the event
or re-enable the HTTP transaction.
commit 2cf6f9a99e1176a8d97529ef9c4eb4d0a8aa437a
Author: James Peach <[email protected]>
Date: 2016-04-27T22:16:32Z
TS-4388: TSHttpTxnParentProxySet crashes in parent selection.
Fix ParentResult to handle the case where the parent is specified
by the TSHttpTxnParentProxySet API. Encapsulate the internals of
the result better so that it is easier for the HTTP state machine
to do the right thing.
----
> parent proxy crashes with TSHttpTxnParentProxySet
> -------------------------------------------------
>
> Key: TS-4388
> URL: https://issues.apache.org/jira/browse/TS-4388
> Project: Traffic Server
> Issue Type: Bug
> Components: Plugins
> Reporter: James Peach
> Assignee: John Rushford
> Fix For: 7.0.0
>
>
> If you call {{TSHttpTxnParentProxySet}} to explicitly set a parent proxy
> target, the proxy request will fail because it is not initialized correctly.
> {code}
> [Switching to Thread 0x7ffff5023700 (LWP 24309)]
> 0x000000000061da0a in HttpTransact::build_request (s=0x7fffe2f43278,
> base_request=0x7fffe2f43990,
> outgoing_request=0x7fffe2f43a10, outgoing_version=...) at
> HttpTransact.cc:7852
> 7852 } else if (s->current.request_to == PARENT_PROXY &&
> !s->parent_result.rec->parent_is_proxy &&
> (gdb) p s->current.request_to
> $1 = HttpTransact::PARENT_PROXY
> (gdb) p s->parent_result
> $2 = {r = PARENT_SPECIFIED, hostname = 0x7ffff7e29c19 "127.0.0.1", port =
> 10090, retry = false, line_number = -1, epoch = 0x0,
> rec = 0xeeeeffff, last_parent = 0, start_parent = 0, wrap_around = false,
> last_lookup = 0}
> (gdb)
> {code}
> The corresponding {{HttpTransact.cc}} code is:
> {code}
> } else if (s->current.request_to == PARENT_PROXY &&
> !s->parent_result.rec->parent_is_proxy &&
> outgoing_request->is_target_in_url()) {
> // If the parent is an origin server remove the hostname from the url.
> DebugTxn("http_trans", "[build_request] removing target from URL for a
> parent origin.");
> HttpTransactHeaders::remove_host_name_from_url(outgoing_request);
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)