MCPcopy Create free account
hub / github.com/apache/trafficserver / TSHttpTxnCachedRespModifiableGet

Function TSHttpTxnCachedRespModifiableGet

src/api/InkAPI.cc:4121–4155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4119}
4120
4121TSReturnCode
4122TSHttpTxnCachedRespModifiableGet(TSHttpTxn txnp, TSMBuffer *bufp, TSMLoc *obj)
4123{
4124 sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS);
4125 sdk_assert(sdk_sanity_check_null_ptr((void *)bufp) == TS_SUCCESS);
4126 sdk_assert(sdk_sanity_check_null_ptr((void *)obj) == TS_SUCCESS);
4127
4128 HttpSM *sm = reinterpret_cast<HttpSM *>(txnp);
4129 HttpTransact::State *s = &(sm->t_state);
4130 HTTPHdr *c_resp = nullptr;
4131 HTTPInfo *cached_obj = sm->t_state.cache_info.object_read;
4132 HTTPInfo *cached_obj_store = &(sm->t_state.cache_info.object_store);
4133
4134 if ((!cached_obj) || (!cached_obj->valid())) {
4135 return TS_ERROR;
4136 }
4137
4138 if (!cached_obj_store->valid()) {
4139 cached_obj_store->create();
4140 }
4141
4142 c_resp = cached_obj_store->response_get();
4143 if (!c_resp->valid()) {
4144 cached_obj_store->response_set(cached_obj->response_get());
4145 }
4146 c_resp = cached_obj_store->response_get();
4147 s->api_modifiable_cached_resp = true;
4148
4149 ink_assert(c_resp != nullptr && c_resp->valid());
4150 *(reinterpret_cast<HTTPHdr **>(bufp)) = c_resp;
4151 *obj = reinterpret_cast<TSMLoc>(c_resp->m_http);
4152 sdk_assert(sdk_sanity_check_mbuffer(*bufp) == TS_SUCCESS);
4153
4154 return TS_SUCCESS;
4155}
4156
4157TSReturnCode
4158TSHttpTxnCacheLookupStatusGet(TSHttpTxn txnp, int *lookup_status)

Callers

nothing calls this directly

Calls 7

sdk_sanity_check_txnFunction · 0.85
sdk_sanity_check_mbufferFunction · 0.85
response_getMethod · 0.80
response_setMethod · 0.80
validMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected