7384b4e78eaab44693c985192276e31322155e32Stephan Bosch#ifndef HTTP_HEADER_PARSER_H
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch#define HTTP_HEADER_PARSER_H
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch
feba5e502b2131c9a1c766b7ef9ff041dbf71d1dStephan Boschstruct http_header_limits;
7384b4e78eaab44693c985192276e31322155e32Stephan Boschstruct http_header_parser;
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch
7ebcb054e0d3cc4be54038cbf763ec4189d9725bStephan Boschenum http_header_parse_flags {
7ebcb054e0d3cc4be54038cbf763ec4189d9725bStephan Bosch /* Strictly adhere to the HTTP protocol specification */
7ebcb054e0d3cc4be54038cbf763ec4189d9725bStephan Bosch HTTP_HEADER_PARSE_FLAG_STRICT = BIT(0)
7ebcb054e0d3cc4be54038cbf763ec4189d9725bStephan Bosch};
7ebcb054e0d3cc4be54038cbf763ec4189d9725bStephan Bosch
feba5e502b2131c9a1c766b7ef9ff041dbf71d1dStephan Boschstruct http_header_parser *
feba5e502b2131c9a1c766b7ef9ff041dbf71d1dStephan Boschhttp_header_parser_init(struct istream *input,
7ebcb054e0d3cc4be54038cbf763ec4189d9725bStephan Bosch const struct http_header_limits *limits,
7ebcb054e0d3cc4be54038cbf763ec4189d9725bStephan Bosch enum http_header_parse_flags flags);
7384b4e78eaab44693c985192276e31322155e32Stephan Boschvoid http_header_parser_deinit(struct http_header_parser **_parser);
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch
7384b4e78eaab44693c985192276e31322155e32Stephan Boschvoid http_header_parser_reset(struct http_header_parser *parser);
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch
7384b4e78eaab44693c985192276e31322155e32Stephan Boschint http_header_parse_next_field(struct http_header_parser *parser,
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch const char **name_r, const unsigned char **data_r, size_t *size_r,
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch const char **error_r);
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch#endif