TSHTTPHDRURLGET(3ts)

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

πŸ’– TSHTTPHDRURLGET πŸ’–

okay so this is a page from the Apache Traffic Server manuals, section 3ts β€” that's the C API library section, bestie, that's where all the plugin-kid functions live. grab a snack, we're getting a URL object out of an HTTP header and it's gonna be adorable. πŸŽ€


✨ NAME ✨

TSHttpHdrUrlGet β€” the TSHttpHdrUrlGet API function. that's it, that's the name, she's straightforward and we respect that. πŸ’…


✨ SYNOPSIS ✨

#include <ts/ts.h>

TSReturnCode TSHttpHdrUrlGet(TSMBuffer bufp, TSMLoc offset, TSMLoc *locp)

three args, one return code, no drama. 🌸


✨ DESCRIPTION ✨

so the whole vibe here is: you have an HTTP header, and you want the URL object that's chilling inside it. TSHttpHdrUrlGet() is how you go get her. πŸ¦‹

heads up bestie: bufp and offset must have been retrieved from a header object previously β€” like, earlier, through something such as TSHttpTxnClientReqGet(). you can't just roll up with random values and expect the universe to cooperate. that's not the move. πŸ™ˆ

on success, locp gets updated so it refers to the URL object. and like β€” real talk β€” this is a URL object, okay? not just a string, not just a vibe. it's an actual object, and you can extract URL-related information out of it. it's giving structured data. ✨

now the important part, and I need you to actually read this one, bestie:

⚠️ the value placed in locp is stable only for a single callback. other callbacks can change the URL object itself β€” not just the data inside it β€” see TSHttpHdrUrlSet() for that chaos. so do not, I repeat do not, stash that locp somewhere and come back to it later like it's gonna be fine. it will not be fine. πŸ’€
also, that value is valid only if this function returns TS_SUCCESS. if it doesn't return TS_SUCCESS, the value is not valid, periodt. no exceptions, no loopholes, no "but it worked on my machine." βœ‹

so to recap the rules of engagement: check the return code, use it within the callback, and don't let anyone else's callback mess with your URL object mid-flight. that's the whole thing. you're doing amazing. πŸ‘‘


✨ SEE ALSO ✨

go read these too, they're all friends and they all hang out together:


2026, dev@trafficserver.apache.org


and that's the page, bestie!! 🫢 this one ships with version 9.2 and it was dated Feb 12, 2026 β€” that's the version and the date right there, so if anyone asks, you know. now go forth and get that URL object, but remember: one callback only, and only if you got TS_SUCCESS. mwah. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from