HttpRequest.parse

Parses content which is expected to be either the start of a HTTP message or a HTTP message fragment that continues the content passed on the last call to this method. If this method is called again after having finished, it will reset the status first and start parsing a new request message.

class HttpRequest
size_t
parse

Parameters

content cstring

content to parse

msg_body_length size_t

callback returning the message body length; will be called at most once after the message header has been parsed.

Return Value

Type: size_t

number of elements consumed from content.

Throws

HttpParseException - on parse error: if * the number of start line tokens is different from 3 or * a regular header_line does not contain a ':'; - on limit excess: if * the header size in bytes exceeds the requested limit or * the number of header lines in exceeds the requested limit.

HttpException if - the HTTP method is unknown or - the HTTP version identifier is unknown or - the URI is missing or - the URI length exceeds the requested max_uri_length.

Note that msg_body_length() may throw a HttpException, especially if - the announced message body length exceeds an allowed limit or - the announced message body length cannot be determined because header parameters are missing.

Meta