TSHTTPHDRHOSTGET(3ts)

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

πŸ’– NAME πŸ’–

TSHttpHdrHostGet β€” the TSHttpHdrHostGet API function, bestie. That's it, that's the name ✨


πŸŽ€ SYNOPSIS πŸŽ€

#include <ts/ts.h>

const char *TSHttpHdrHostGet(TSMBuffer bufp, TSMLoc offset, int *length)

Look at her. So simple. So powerful. So iconic. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea β˜•: this function gets the host for the request. that's it. that's the whole job. and she does it beautifully.

bufp and offset must reference an HTTP request header β€” like, that's non-negotiable, bestie, don't come at her with a response header, she will not know what to do with that πŸ™ˆ

She returns a pointer to the host, and she stores the length in the int pointed at by length. so far so good ✨

⚠️ IMPORTANT: the returned text may not be null terminated. NOT null terminated!! do not just printf it and walk away, girl, you will be reading into the void 😭 take that length seriously. she gave it to you for a reason.

And the order of operations? obsessed. She checks the URL in the request first, and then the Host header field. URL supremacy, we love to see it πŸ‘‘

πŸ’€ NOTE πŸ’€

This is much faster than calling TSHttpTxnEffectiveUrlStringGet() and then extracting the host from the result. like, not even close. that other route is giving "walking to the kitchen to get a fork when the fork is already in your hand" energy 🍴✨

so if you were out here doing the long way... no you weren't. not anymore. we're healed 🫢


2026, dev@trafficserver.apache.org πŸ’Œ


and that's the whole page, babe!! πŸ¦‹ This was Apache Traffic Server 9.2, dated Feb 12, 2026 β€” and yes, she ate. Periodt. πŸ’…βœ¨πŸ‘‘

πŸ“¦ where this page comes from