---
name: "TSHttpTxnServerRespGet"
section: "3ts"
platform: "linux"
package: "trafficserver-dev"
version: "9.2.5+ds-0+deb12u4"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/TSHttpTxnServerRespGet"
---

# TSHttpTxnServerRespGet(3ts)

TSHttpTxnServerRespGet API function

## NAME

TSHttpTxnServerRespGet - TSHttpTxnServerRespGet API function

## SYNOPSIS

```
#include <ts/ts.h>
```

- ***TSReturnCode* TSHttpTxnServerRespGet(*TSHttpTxn* txnp, *TSMBuffer* \*bufp, *TSMLoc* \*offset)**

  ## DESCRIPTION

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;
}
```

## COPYRIGHT

2026, dev@trafficserver.apache.org
