TSURLCREATE(3ts)
π 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 bufferbufp. and listen, when you're done with the handle it gives you back, release it with a call toTSHandleMLocRelease(). don't leave it hanging, that's rude πTSUrlClone()β copies everything from the URL at locationsrc_urlinside the marshal buffersrc_bufpover to a spot inside the marshal bufferdest_bufp. same deal: release the returned handle withTSHandleMLocRelease(). β¨TSUrlCopy()β copies the contents of the URL atsrc_urlin the marshal buffersrc_bufpinto the locationdest_urlin the marshal bufferdest_bufp. and here's the cute part: it works correctly even ifsrc_bufpanddest_bufppoint to totally different marshal buffers. but β οΈ it is important for the destination URL (its marshal buffer and itsTSMLoc) 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. thestartpointer is both an input and an output parameter, and it marks the start of the URL you're parsing. after a successful parse,startequalsend. theendpointer has to be exactly one byte after the last character you want parsed. the URL parsing routine just assumes that everything betweenstartandendis part of the URL β so it's up to higher level parsing routines, likeTSHttpHdrParseReq(), to figure out where the URL actually ends. iykyk. π«
π RETURN VALUES π
TSUrlParse()returns aTSParseResult.TS_PARSE_ERRORmeans something went wrong π. success shows up as eitherTS_PARSE_DONEorTS_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 π«Ά
π COPYRIGHT π
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
- ubuntu noble: trafficserver-dev 9.2.3+ds-1+deb12u1ubuntu0.1 Β· Apache-2.0
- ubuntu questing: trafficserver-dev 9.2.5+ds-1ubuntu2.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms