DOKK / manpages / debian 12 / trafficserver-dev / TSHttpTxnServerRespGet.3ts.en
TSHTTPTXNSERVERRESPGET(3ts) Apache Traffic Server TSHTTPTXNSERVERRESPGET(3ts)

TSHttpTxnServerRespGet - TSHttpTxnServerRespGet API function

#include <ts/ts.h>



Get the response header sent by the upstream server. This will only be useful in a callback on a hook that is called after the upstream responds, and if there was an upstream response. For instance, if the inbound request has no remap rule and remap is required then there will be no server response because no outbound connection was made. In this case the function will return TS_ERROR.

The response header is returned in bufp and offset. bufp is the heap in which the header resides, and offset is the location in that heap. These will be used in subsequent calls to retrieve information from the header.

int get_response_status(TSHttpTxn txn) {

TSMBuffer resp_heap = nullptr;
TSMLoc resp_hdr = nullptr;
if (TS_SUCCESS == TSHttpTxnServerRespGet(tnx, &resp_heap, &resp_hdr)) {
return TSHttpHdrStatusGet(resp_headp, resp_hdr);
}
return HTTP_STATUS_NONE; }


2023, dev@trafficserver.apache.org

November 2, 2023 9.2