| 8229 | }; |
| 8230 | |
| 8231 | static int |
| 8232 | altinfo_hook_handler(TSCont contp, TSEvent event, void *edata) |
| 8233 | { |
| 8234 | AltInfoTestData *data = nullptr; |
| 8235 | TSHttpTxn txnp = nullptr; |
| 8236 | |
| 8237 | CHECK_SPURIOUS_EVENT(contp, event, edata); |
| 8238 | data = static_cast<AltInfoTestData *>(TSContDataGet(contp)); |
| 8239 | |
| 8240 | switch (event) { |
| 8241 | case TS_EVENT_HTTP_READ_REQUEST_HDR: |
| 8242 | txnp = static_cast<TSHttpTxn>(edata); |
| 8243 | TSHttpTxnCntlSet(txnp, TS_HTTP_CNTL_SKIP_REMAPPING, true); |
| 8244 | TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE); |
| 8245 | break; |
| 8246 | |
| 8247 | case TS_EVENT_HTTP_SELECT_ALT: { |
| 8248 | TSMBuffer clientreqbuf; |
| 8249 | TSMBuffer cachereqbuf; |
| 8250 | TSMBuffer cacherespbuf; |
| 8251 | |
| 8252 | TSMLoc clientreqhdr; |
| 8253 | TSMLoc cachereqhdr; |
| 8254 | TSMLoc cacheresphdr; |
| 8255 | |
| 8256 | TSHttpAltInfo infop = static_cast<TSHttpAltInfo>(edata); |
| 8257 | |
| 8258 | data->run_at_least_once = true; |
| 8259 | if (TSHttpAltInfoClientReqGet(infop, &clientreqbuf, &clientreqhdr) != TS_SUCCESS) { |
| 8260 | SDK_RPRINT(data->test, "TSHttpAltInfoClientReqGet", "TestCase", TC_FAIL, |
| 8261 | "TSHttpAltInfoClientReqGet doesn't return TS_SUCCESS"); |
| 8262 | data->test_passed_txn_alt_info_client_req_get = false; |
| 8263 | } else { |
| 8264 | if ((clientreqbuf == reinterpret_cast<TSMBuffer>(&(((HttpAltInfo *)infop)->m_client_req))) && |
| 8265 | (clientreqhdr == reinterpret_cast<TSMLoc>(((HttpAltInfo *)infop)->m_client_req.m_http))) { |
| 8266 | SDK_RPRINT(data->test, "TSHttpAltInfoClientReqGet", "TestCase", TC_PASS, "ok"); |
| 8267 | } else { |
| 8268 | SDK_RPRINT(data->test, "TSHttpAltInfoClientReqGet", "TestCase", TC_FAIL, "Value's Mismatch"); |
| 8269 | data->test_passed_txn_alt_info_client_req_get = false; |
| 8270 | } |
| 8271 | } |
| 8272 | |
| 8273 | if (TSHttpAltInfoCachedReqGet(infop, &cachereqbuf, &cachereqhdr) != TS_SUCCESS) { |
| 8274 | SDK_RPRINT(data->test, "TSHttpAltInfoCachedReqGet", "TestCase", TC_FAIL, |
| 8275 | "TSHttpAltInfoCachedReqGet doesn't return TS_SUCCESS"); |
| 8276 | data->test_passed_txn_alt_info_cached_req_get = false; |
| 8277 | } else { |
| 8278 | if ((cachereqbuf == reinterpret_cast<TSMBuffer>(&(((HttpAltInfo *)infop)->m_cached_req))) && |
| 8279 | (cachereqhdr == reinterpret_cast<TSMLoc>(((HttpAltInfo *)infop)->m_cached_req.m_http))) { |
| 8280 | SDK_RPRINT(data->test, "TSHttpAltInfoCachedReqGet", "TestCase", TC_PASS, "ok"); |
| 8281 | } else { |
| 8282 | SDK_RPRINT(data->test, "TSHttpAltInfoCachedReqGet", "TestCase", TC_FAIL, "Value's Mismatch"); |
| 8283 | data->test_passed_txn_alt_info_cached_req_get = false; |
| 8284 | } |
| 8285 | } |
| 8286 | |
| 8287 | if (TSHttpAltInfoCachedRespGet(infop, &cacherespbuf, &cacheresphdr) != TS_SUCCESS) { |
| 8288 | SDK_RPRINT(data->test, "TSHttpAltInfoCachedRespGet", "TestCase", TC_FAIL, |
nothing calls this directly
no test coverage detected