Github user jpeach commented on a diff in the pull request: https://github.com/apache/trafficserver/pull/834#discussion_r78049417 --- Diff: proxy/InkAPI.cc --- @@ -5730,6 +5730,66 @@ TSHttpTxnParentProxySet(TSHttpTxn txnp, const char *hostname, int port) sm->t_state.api_info.parent_proxy_port = port; } +TSReturnCode +TSHttpTxnParentSelectionUrlGet(TSHttpTxn txnp, TSMBuffer bufp, TSMLoc obj) +{ + sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS); + sdk_assert(sdk_sanity_check_mbuffer(bufp) == TS_SUCCESS); + sdk_assert(sdk_sanity_check_url_handle(obj) == TS_SUCCESS); + + HttpSM *sm = (HttpSM *)txnp; + URL u, *l_url; + + u.m_heap = ((HdrHeapSDKHandle *)bufp)->m_heap; + u.m_url_impl = (URLImpl *)obj; + if (!u.valid()) + return TS_ERROR; + + l_url = sm->t_state.cache_info.parent_selection_url; + if (l_url && l_url->valid()) { + u.copy(l_url); + return TS_SUCCESS; + } + + return TS_ERROR; +} + +TSReturnCode +TSHttpTxnParentSelectionUrlSet(TSHttpTxn txnp, TSMBuffer bufp, TSMLoc obj) +{ + sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS); + sdk_assert(sdk_sanity_check_mbuffer(bufp) == TS_SUCCESS); + sdk_assert(sdk_sanity_check_url_handle(obj) == TS_SUCCESS); + + HttpSM *sm = (HttpSM *)txnp; + URL u, *l_url; + + u.m_heap = ((HdrHeapSDKHandle *)bufp)->m_heap; + u.m_url_impl = (URLImpl *)obj; + if (!u.valid()) { + return TS_ERROR; + } + + l_url = sm->t_state.cache_info.parent_selection_url; + if (!l_url) { + sm->t_state.cache_info.parent_selection_url_storage.create(NULL); + sm->t_state.cache_info.parent_selection_url = &(sm->t_state.cache_info.parent_selection_url_storage); + l_url = sm->t_state.cache_info.parent_selection_url; + } + + if (!l_url || !l_url->valid()) { + return TS_ERROR; + } else { + l_url->copy(&u); + } + + Debug("parent_select", "TSHttpTxnParentSelectionUrlSet() parent_selection_url : addr = 0x%lx val = 0x%lx", --- End diff -- Use ``%p`` to format pointer values.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---