TSHTTPTXNSERVERADDRSET(3ts)
π NAME π
TSHttpTxnServerAddrSet β the API function TSHttpTxnServerAddrSet, bestie. That's it, that's the name, and it's lowkey iconic.
β¨ SYNOPSIS β¨
#include <ts/ts.h>
TSReturnCode TSHttpTxnServerAddrSet(TSHttpTxn txnp, struct sockaddr const *addr)
π¦ DESCRIPTION π¦
okay so, this one sets the origin server address for the transaction txnp. The port lives inside addr too, so it's a whole package deal β and the address family? Also decided by whatever's in addr. No separate flag, no extra drama.
The address data gets copied out of addr, so once you hand it over you do not have to keep that object alive. It's not holding a grudge, it's not holding a pointer, you can let it go. π«Ά
ⰠTiming check: this hook must be called no later thanTS_HTTP_OS_DNS_HOOK. If you call it prior toTS_HTTP_OS_DNS_HOOK, DNS resolution will not be done, because like⦠the address of the server is already known. Why would it look it up? It wouldn't. Periodt.
πΈ RETURN VALUE πΈ
TS_ERROR gets returned if addr does not contain a valid IPv4 or IPv6 address with a valid (non-zero) port. So like, give it a real address and an actual port, bestie, not vibes. π
π NOTES π
- If Traffic Server is configured to retry connections to origin servers and
TSHttpTxnServerAddrGet()has been called, Traffic Server will return toTS_HTTP_OS_DNS_HOOKso to let the plugin set a different server address. - Plugins should be prepared for
TS_HTTP_OS_DNS_HOOKand any subsequent hooks to be called multiple times. Not once. Multiple. Be ready. π - Once a plugin calls
TSHttpTxnServerAddrGet(), any prior DNS resolution results are lost. Gone. Poof. π - The plugin should use
TSHttpTxnServerAddrGet()to preserve any DNS Results that might need.
no cap: that last point is the whole survival strategy. If you care about your DNS results, grab them with TSHttpTxnServerAddrGet() before they get Thanos-snapped. β
π₯ SEE ALSO π₯
π COPYRIGHT π
2026, dev@trafficserver.apache.org
and that's the whole page, bestie π this came from the Apache Traffic Server manual, version 9.2, dated Feb 12, 2026 β go forth and set those server addresses responsibly, mwah π§β¨
π¦ 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