e8a59a1671127f87e2d22f42e84c572f28299d81Timo Sirainen#ifndef HTTP_RESPONSE_PARSER_H
e8a59a1671127f87e2d22f42e84c572f28299d81Timo Sirainen#define HTTP_RESPONSE_PARSER_H
e8a59a1671127f87e2d22f42e84c572f28299d81Timo Sirainen
dbb1fb1c51727e2050792f8c333b212e22a36d69Timo Sirainen#include "http-response.h"
6789ed17e7ca4021713507baf0dcf6979bb42e0cTimo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenstruct http_header_limits;
dbb1fb1c51727e2050792f8c333b212e22a36d69Timo Sirainenstruct http_response_parser;
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainenenum http_response_parse_flags {
e667602217af55105d44d8d9b75f09a8a9ac2f14Timo Sirainen /* Strictly adhere to the HTTP protocol specification */
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen HTTP_RESPONSE_PARSE_FLAG_STRICT = BIT(0)
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen};
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen
d67fde1a8ebc1d85704c5986d8f93aae97eccef3Timo Sirainenstruct http_response_parser *
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainenhttp_response_parser_init(struct istream *input,
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen const struct http_header_limits *hdr_limits,
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen enum http_response_parse_flags flags) ATTR_NULL(2);
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainenvoid http_response_parser_deinit(struct http_response_parser **_parser);
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainenuoff_t http_response_parser_get_last_offset(struct http_response_parser *parser);
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainenint http_response_parse_next(struct http_response_parser *parser,
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen enum http_response_payload_type payload_type,
bcd8a160ce32e5afe3566793b5a144028063b2fbTimo Sirainen struct http_response *response, const char **error_r);
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen#endif
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen