| 7837 | } |
| 7838 | |
| 7839 | int |
| 7840 | TSHttpTxnIsCacheable(TSHttpTxn txnp, TSMBuffer request, TSMBuffer response) |
| 7841 | { |
| 7842 | sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS); |
| 7843 | HttpSM *sm = reinterpret_cast<HttpSM *>(txnp); |
| 7844 | HTTPHdr *req, *resp; |
| 7845 | |
| 7846 | // We allow for either request or response to be empty (or both), in |
| 7847 | // which case we default to the transactions request or response. |
| 7848 | if (request) { |
| 7849 | sdk_assert(sdk_sanity_check_mbuffer(request) == TS_SUCCESS); |
| 7850 | req = reinterpret_cast<HTTPHdr *>(request); |
| 7851 | } else { |
| 7852 | req = &(sm->t_state.hdr_info.client_request); |
| 7853 | } |
| 7854 | if (response) { |
| 7855 | sdk_assert(sdk_sanity_check_mbuffer(response) == TS_SUCCESS); |
| 7856 | resp = reinterpret_cast<HTTPHdr *>(response); |
| 7857 | } else { |
| 7858 | resp = &(sm->t_state.hdr_info.server_response); |
| 7859 | } |
| 7860 | |
| 7861 | // Make sure these are valid response / requests, then verify if it's cacheable. |
| 7862 | return (req->valid() && resp->valid() && HttpTransact::is_response_cacheable(&(sm->t_state), req, resp)) ? 1 : 0; |
| 7863 | } |
| 7864 | |
| 7865 | int |
| 7866 | TSHttpTxnGetMaxAge(TSHttpTxn txnp, TSMBuffer response) |
no test coverage detected