ark::comms::HttpRequestParser
Defined in header “ark/comms/http_request.hh”.
A very simple class meant for decoding HTTP requests. You can use this class to consume bytes from a socket and decode them into requests, or generate your own requests.
Methods
-
void add_bytes(const std::string & bytes)
Adds bytes onto the given HTTP request. As you consume bytes, you can check to see when the request is ready, and then generate it. -
bool ready()
Returns true if we have consumed enough bytes to produce a valid HTTP request, or false otherwise. -
HttpRequest parse()
Parses the bytes that have been received to date, in order to produce a valid HTTP request. -
size_t size()
Returns the number of bytes in the buffer to date. -
core::ByteBuffer & data()
Return a reference to the underlying byte buffer, to support more efficient reads.