HttpRequestParse
Description
Parse an HTTP/1.1 request out of in into req. req must already be initialized with HttpRequestInit(...) so the parser has an allocator to write into.
Success
Returns a pointer past the parsed request line + headers (start of the body).
Failure
Returns in unchanged when the input is malformed.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Http.c:20:
HttpRequest req = HttpRequestInit(alloc_base);
const char *next = HttpRequestParse(&req, raw);
bool ok = (next != raw) && (req.method == HTTP_REQUEST_METHOD_GET) && (req.url.length == 11) &&- In
Http.c:102:
}
const char *HttpRequestParse(HttpRequest *req, const char *in) {
if (!req || !req->allocator || !in) {
LOG_FATAL("invalid arguments");- In
Beam.c:61:
HttpRequest req = HttpRequestInit(scope);
const char *end = HttpRequestParse(&req, raw.data);
if (end == raw.data) {
LOG_INFO("[{}] (unparseable request, {} bytes)", client_addr, (u64)prefix_len);
Last updated on