this function should be called at TS_EVENT_HTTP_READ_RESPONSE_HDR
| 6533 | |
| 6534 | // this function should be called at TS_EVENT_HTTP_READ_RESPONSE_HDR |
| 6535 | void |
| 6536 | TSHttpTxnRedirectUrlSet(TSHttpTxn txnp, const char *url, const int url_len) |
| 6537 | { |
| 6538 | sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS); |
| 6539 | sdk_assert(sdk_sanity_check_null_ptr((void *)url) == TS_SUCCESS); |
| 6540 | |
| 6541 | HttpSM *sm = reinterpret_cast<HttpSM *>(txnp); |
| 6542 | |
| 6543 | ats_free(sm->redirect_url); |
| 6544 | sm->redirect_url = nullptr; |
| 6545 | sm->redirect_url_len = 0; |
| 6546 | |
| 6547 | sm->redirect_url = const_cast<char *>(url); |
| 6548 | sm->redirect_url_len = url_len; |
| 6549 | sm->enable_redirection = true; |
| 6550 | sm->redirection_tries = 0; |
| 6551 | |
| 6552 | // Make sure we allow for at least one redirection. |
| 6553 | if (sm->t_state.txn_conf->number_of_redirections <= 0) { |
| 6554 | sm->t_state.setup_per_txn_configs(); |
| 6555 | sm->t_state.my_txn_conf().number_of_redirections = 1; |
| 6556 | } |
| 6557 | } |
| 6558 | |
| 6559 | const char * |
| 6560 | TSHttpTxnRedirectUrlGet(TSHttpTxn txnp, int *url_len_ptr) |
no test coverage detected