.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "TSHTTPPARSERCREATE" "3ts" "Apr 16, 2024" "9.2" "Apache Traffic Server" .SH NAME TSHttpParserCreate \- parse HTTP headers from memory buffers .SH SYNOPSIS .INDENT 0.0 .INDENT 3.5 .sp .EX #include .EE .UNINDENT .UNINDENT .INDENT 0.0 .TP .B \fI\%TSHttpParser\fP TSHttpParserCreate(void) .UNINDENT .INDENT 0.0 .TP .B void TSHttpParserClear(\fI\%TSHttpParser\fP parser) .UNINDENT .INDENT 0.0 .TP .B void TSHttpParserDestroy(\fI\%TSHttpParser\fP parser) .UNINDENT .INDENT 0.0 .TP .B \fI\%TSParseResult\fP TSHttpHdrParseReq(\fI\%TSHttpParser\fP parser, \fI\%TSMBuffer\fP bufp, \fI\%TSMLoc\fP offset, const char **start, const char *end) .UNINDENT .INDENT 0.0 .TP .B \fI\%TSParseResult\fP TSHttpHdrParseResp(\fI\%TSHttpParser\fP parser, \fI\%TSMBuffer\fP bufp, \fI\%TSMLoc\fP offset, const char **start, const char *end) .UNINDENT .SH DESCRIPTION .sp \fI\%TSHttpParserCreate()\fP creates an HTTP parser object. The parser\(aqs data structure contains information about the header being parsed. A single HTTP parser can be used multiple times, though not simultaneously. Before being used again, the parser must be cleared by calling \fI\%TSHttpParserClear()\fP\&. .sp \fI\%TSHttpHdrParseReq()\fP parses an HTTP request header. The HTTP header \fIoffset\fP must already be created, and must reside inside the marshal buffer \fIbufp\fP\&. The \fIstart\fP argument points to the current position of the string buffer being parsed and the \fIend\fP argument points to one byte after the end of the buffer to be parsed. On return, \fIstart\fP is modified to point past the last character parsed. .sp It is possible to parse an HTTP request header a single byte at a time using repeated calls to \fI\%TSHttpHdrParseReq()\fP\&. As long as an error does not occur, the \fI\%TSHttpHdrParseReq()\fP function will consume that single byte and ask for more. \fI\%TSHttpHdrParseReq()\fP should be called after \fI\%TS_HTTP_READ_REQUEST_HDR_HOOK\fP\&. .sp \fI\%TSHttpHdrParseResp()\fP operates in the same manner as \fI\%TSHttpHdrParseReq()\fP except it parses an HTTP response header. It should be called after \fI\%TS_HTTP_READ_RESPONSE_HDR_HOOK\fP\&. .sp \fI\%TSHttpParserClear()\fP clears the specified HTTP parser so it may be used again. .sp \fI\%TSHttpParserDestroy()\fP destroys the TSHttpParser object pointed to by \fIparser\fP\&. The \fIparser\fP pointer must not be NULL. .SH RETURN VALUES .sp \fI\%TSHttpHdrParseReq()\fP and \fI\%TSHttpHdrParseResp()\fP both return a \fI\%TSParseResult\fP value. \fI\%TS_PARSE_ERROR\fP is returned on error, \fI\%TS_PARSE_CONT\fP is returned if parsing of the header stopped because the end of the buffer was reached, and \fI\%TS_PARSE_DONE\fP when a \er\en\er\en pattern is encountered, indicating the end of the header. .SH SEE ALSO .sp \fBTSAPI(3ts)\fP .SH COPYRIGHT 2024, dev@trafficserver.apache.org .\" Generated by docutils manpage writer. .