58 Event feed(std::string_view data,
size_t& consumed);
Incremental HTTP/1.1 request parser, built on llhttp (the parser Node.js uses).
Definition Http1Parser.hpp:34
void set_body_handler(std::function< void(std::string_view)> handler)
std::unique_ptr< Impl > impl_
Definition Http1Parser.hpp:90
Http1Parser(Limits limits)
bool keep_alive() const
The connection may carry another request.
Event
Definition Http1Parser.hpp:43
@ MessageComplete
Paused after a whole request; call next().
@ NeedMore
All input consumed; feed more.
@ Error
See error_status() and error_reason().
@ HeadersComplete
Paused after the header section of a request with a body.
Http1Parser()
Definition Http1Parser.hpp:51
Http1Parser(const Http1Parser &)=delete
bool chunked() const
Transfer-Encoding: chunked.
bool upgrade() const
At MessageComplete: the request asks to switch protocols.
int error_status() const
400, 413, 431 or 501 after Error.
void set_body_limit(std::function< size_t(const HttpRequest &)> limit_for)
bool expect_continue() const
"Expect: 100-continue" was sent.
bool has_body() const
A body follows the headers (chunked or Content-Length > 0).
Event feed(std::string_view data, size_t &consumed)
const std::string & error_reason() const
Http1Parser & operator=(const Http1Parser &)=delete
Definition Http1Parser.hpp:36
size_t max_headers
Definition Http1Parser.hpp:39
size_t max_body_size
Definition Http1Parser.hpp:40
size_t max_request_line
Definition Http1Parser.hpp:37
size_t max_header_bytes
Request line plus all header lines.
Definition Http1Parser.hpp:38
Represents an incoming HTTP request.
Definition HttpRequest.hpp:54