TSHTTPPARSERCREATE(3ts)

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

πŸ’– TSHTTPPARSERCREATE πŸ’–

okay bestie, welcome to the Apache Traffic Server page for TSHttpParserCreate β€” manual section 3ts, and yes it's giving "let me parse HTTP headers from memory buffers" ✨ no cap.


🌸 SYNOPSIS 🌸

#include <ts/ts.h>

TSHttpParser TSHttpParserCreate(void)

void TSHttpParserClear(TSHttpParser parser)

void TSHttpParserDestroy(TSHttpParser parser)

TSParseResult TSHttpHdrParseReq(TSHttpParser parser, TSMBuffer bufp,
TSMLoc offset, const char **start, const char *end)

TSParseResult TSHttpHdrParseResp(TSHttpParser parser, TSMBuffer bufp,
TSMLoc offset, const char **start, const char *end)

✨ DESCRIPTION ✨

TSHttpParserCreate() creates an HTTP parser object, periodt. The parser's data structure is literally holding info about the header being parsed. One single HTTP parser can be used multiple times β€” but not simultaneously, okay? Before you use it again, you have to clear it by calling TSHttpParserClear(). no skipping that step πŸ’…

TSHttpHdrParseReq() parses an HTTP request header. The HTTP header offset must already be created, and it must reside inside the marshal buffer bufp. The start argument points to the current position of the string buffer being parsed, and the end argument points to one byte after the end of the buffer to be parsed. On return, start is modified to point past the last character parsed. iconic behaviour honestly πŸ¦‹

and bestie, it is possible to parse an HTTP request header a single byte at a time using repeated calls to TSHttpHdrParseReq(). As long as an error does not occur, TSHttpHdrParseReq() will consume that single byte and ask for more. TSHttpHdrParseReq() should be called after TS_HTTP_READ_REQUEST_HDR_HOOK.

TSHttpHdrParseResp() operates in the same manner as TSHttpHdrParseReq() except it parses an HTTP response header. It should be called after TS_HTTP_READ_RESPONSE_HDR_HOOK.

TSHttpParserClear() clears the specified HTTP parser so it may be used again. like a little reset, a lil refresh, self-care for your parser 🫢

TSHttpParserDestroy() destroys the TSHttpParser object pointed to by parser. and this one is serious: the parser pointer must not be NULL. do not do that. πŸ™ˆ


🌈 RETURN VALUES 🌈

TSHttpHdrParseReq() and TSHttpHdrParseResp() both return a TSParseResult value. Here's the vibe check:

  • TS_PARSE_ERROR β€” returned on error 😭
  • TS_PARSE_CONT β€” returned if parsing of the header stopped because the end of the buffer was reached
  • TS_PARSE_DONE β€” returned when a \r\n\r\n pattern is encountered, indicating the end of the header πŸ‘‘

πŸ’œ SEE ALSO πŸ’œ


2026, dev@trafficserver.apache.org


okay that's the whole page bestie, you ate πŸ’…βœ¨ this was Apache Traffic Server, version 9.2, dated Feb 12, 2026 β€” TSHTTPPARSERCREATE(3ts), signing off, mwah πŸŽ€πŸ¦‹πŸ’–

πŸ“¦ where this page comes from