TSURLCREATE(3ts)

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

πŸ’– TSURLCREATE πŸ’–

okay bestie, pull up a chair πŸͺ‘ because we're talking about Apache Traffic Server's URL construction API, and it's genuinely iconic. this is TSURLCREATE(3ts) in the 3ts manual, and yes, we're doing this together, no cap.


✨ NAME ✨

TSUrlCreate β€” the Traffic Server URL object construction API. it's giving "let me build you a URL from scratch" πŸ’…


🌈 SYNOPSIS 🌈

#include <ts/ts.h>

TSReturnCode TSUrlCreate(TSMBuffer bufp, TSMLoc *locp)

TSReturnCode TSUrlClone(TSMBuffer dest_bufp, TSMBuffer src_bufp, TSMLoc
src_url, TSMLoc *locp)

TSReturnCode TSUrlCopy(TSMBuffer dest_bufp, TSMLoc dest_url, TSMBuffer
src_bufp, TSMLoc src_url)

TSParseResult TSUrlParse(TSMBuffer bufp, TSMLoc offset, const char
**start, const char *end)

look at those signatures, they ate πŸ’… copy them exactly, don't freestyle, bestie.


🌸 DESCRIPTION 🌸

so the URL data structure? it's literally a parsed version of a standard internet URL. the Traffic Server URL API hands you access to URL data that lives inside marshal buffers. these functions can create, copy, retrieve or delete whole entire URLs, and they can also grab or tweak just parts of a URL β€” think host, port, or scheme info. slay. πŸ¦‹

  • TSUrlCreate() β€” makes a brand new URL inside the marshal buffer bufp. and listen, when you're done with the handle it gives you back, release it with a call to TSHandleMLocRelease(). don't leave it hanging, that's rude πŸ™ˆ
  • TSUrlClone() β€” copies everything from the URL at location src_url inside the marshal buffer src_bufp over to a spot inside the marshal buffer dest_bufp. same deal: release the returned handle with TSHandleMLocRelease(). ✨
  • TSUrlCopy() β€” copies the contents of the URL at src_url in the marshal buffer src_bufp into the location dest_url in the marshal buffer dest_bufp. and here's the cute part: it works correctly even if src_bufp and dest_bufp point to totally different marshal buffers. but ⚠️ it is important for the destination URL (its marshal buffer and its TSMLoc) to have already been created before you copy into it. you can't pour into a cup that doesn't exist, babe.
  • TSUrlParse() β€” parses a URL. the start pointer is both an input and an output parameter, and it marks the start of the URL you're parsing. after a successful parse, start equals end. the end pointer has to be exactly one byte after the last character you want parsed. the URL parsing routine just assumes that everything between start and end is part of the URL β€” so it's up to higher level parsing routines, like TSHttpHdrParseReq(), to figure out where the URL actually ends. iykyk. πŸ’«

πŸ‘‘ RETURN VALUES πŸ‘‘

  • TSUrlParse() returns a TSParseResult. TS_PARSE_ERROR means something went wrong 😭. success shows up as either TS_PARSE_DONE or TS_PARSE_CONT. πŸŽ€
  • every other API here returns a TSReturnCode, which tells you whether the operation succeeded (TS_SUCCESS) or failed (TS_ERROR). vibe check passed or failed, simple as that.

πŸ”₯ SEE ALSO πŸ”₯

TSAPI(3ts), TSMBufferCreate(3ts), TSUrlHostGet(3ts), TSUrlHostSet(3ts), TSUrlStringGet(3ts), TSUrlPercentEncode(3ts)

go read those too, they're all part of the same friend group 🫢


2026, dev@trafficserver.apache.org


and that's the whole page, bestie!! πŸŽ€ this was version 9.2, dated Feb 12, 2026, brought to you by the good people of Apache Traffic Server β€” mwah, thank you for your service πŸ’–βœ¨ go forth and construct URLs responsibly, ily, bye!! πŸ¦‹πŸŒˆ

πŸ“¦ where this page comes from