TSHTTPTXNSERVERRESPGET(3ts)

πŸ“¦
version 9.2.5 Β· 4 versions
, in ubuntu noble, ubuntu questing

πŸ’– TSHttpTxnServerRespGet β€” no cap, the 3ts glow-up πŸ’–

okay bestie, so this is a page from the Apache Traffic Server manuals, and it's filed under 3ts (that's the section, iykyk). It's about one very specific little function and honestly? She's niche but she's iconic. Let's get into it. πŸ¦‹


✨ NAME ✨

TSHttpTxnServerRespGet β€” the TSHttpTxnServerRespGet API function. that's it, that's the name, she said what she said. πŸ’…


🌸 SYNOPSIS 🌸

#include <ts/ts.h>

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

like. look at her. three args, one return code, zero drama. ✨


🫢 DESCRIPTION 🫢

So what does she do? She gets you the response header that the upstream server sent back. That's the whole vibe.

But bestie, listen, timing is everything. This is only useful:

  • inside a callback on a hook that gets called after the upstream responds, and
  • only if there actually was an upstream response. 🫠

Not me having to break the bad news… if the inbound request has no remap rule and remap is required, then there's no server response at all, because literally no outbound connection was ever made. Nothing happened. The vibe was simply not there. In that case this function returns TS_ERROR. 😭

When it does work, the response header comes back to you in bufp and offset. So like:

  • bufp β€” the heap where the header is chilling 🌈
  • offset β€” the location of the header inside that heap πŸ“

and you'll be passing those two along to all your subsequent calls when you wanna pull info out of that header. slay.

here's the little example they gave, verbatim, don't @ me about the variable names, I'm just the messenger:

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;
}
okay real talk for a sec: copy code exactly as it's written here, tnx and resp_headp and all. I am not the one who named them. πŸ’€

2026, dev@trafficserver.apache.org


and that's the whole page, bestie, you ate it. πŸ“ this was pulled from Apache Traffic Server docs, 9.2 edition, dated Feb 12, 2026, and it lives its best life as TSHTTPTXNSERVERRESPGET(3ts). go forth and get those headers. πŸ’œπŸ§šβœ¨

πŸ“¦ where this page comes from