TSMIMEHDRF...ESTRINGSET(3ts)
β¨ NAME β¨
TSMimeHdrFieldValueStringSet β the TSMimeHdrFieldValueStringSet API function, bestie π (yes she's named after herself, iconic behavior)
πΈ SYNOPSIS πΈ
#include <ts/ts.h>
TSReturnCode TSMimeHdrFieldValueStringSet(TSMBuffer bufp, TSMLoc hdr,
TSMLoc field, int idx, const char *value, int length)
π DESCRIPTION π
Okay so TSMimeHdrFieldValueStringSet() sets the value of a MIME field, and honestly? she eats every time. π
The field is identified by the combo of bufp, hdr, and field, and those three have gotta match the ones that were passed to whatever function handed you field in the first place β like TSMimeHdrFieldFind(), for example. The value gets copied over to the header that bufp represents. And here's the tea: value does not have to be null terminated (and ngl, in general it should not be). π«Ά
Now, if idx is non-negative, the existing value in the field is treated as a multi-value, and idx is the 0 based index of which element you're setting. Lowkey the clearest way to say it is with an example: say the field had the value dave, grigor, tamara and TSMimeHdrFieldValueStringSet() got called with a value of syeda and an idx of 1 β the value would then be set to dave, syeda, tamara. Slay. β¨
β οΈ Bestie, listen: ifidxis non-negative it must be the index of an existing element, or exactly one past the last element β otherwise the call will fail. Periodt. In the example case above,idxmust be between 0 and 3 inclusive. You can hit upTSMimeHdrFieldValuesCount()to get the current number of elements, so you never have to guess. π§
This function returns TS_SUCCESS if the value was set, and TS_ERROR if it wasn't. That's the whole vibe check. π
π COPYRIGHT π
2026, dev@trafficserver.apache.org
That's it, that's the page π this was Apache Traffic Server's 3ts manual, version 9.2, dated Feb 12, 2026 β thanks for coming to my TED talk, now go set some header values, 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