Add "struct mg_http_message::head" attr

This commit is contained in:
cpq 2021-02-09 13:27:17 +00:00
parent 4844ed60bd
commit 42bc7b1f47
4 changed files with 10 additions and 6 deletions

View File

@ -570,8 +570,9 @@ int mg_http_parse(const char *s, size_t len, struct mg_http_message *hm) {
memset(hm, 0, sizeof(*hm));
if (req_len <= 0) return req_len;
hm->message.ptr = s;
hm->body.ptr = s + req_len;
hm->message.ptr = hm->head.ptr = s;
hm->body.ptr = end;
hm->head.len = req_len;
hm->message.len = hm->body.len = (size_t) ~0; // Set body length to infinite
// Parse request line

View File

@ -694,7 +694,8 @@ struct mg_http_message {
struct mg_str method, uri, query, proto; // Request/response line
struct mg_http_header headers[MG_MAX_HTTP_HEADERS]; // Headers
struct mg_str body; // Body
struct mg_str message; // Request line + headers + body
struct mg_str head; // Request + headers
struct mg_str message; // Request + headers + body
};
// Parameter for mg_http_serve_dir()

View File

@ -150,8 +150,9 @@ int mg_http_parse(const char *s, size_t len, struct mg_http_message *hm) {
memset(hm, 0, sizeof(*hm));
if (req_len <= 0) return req_len;
hm->message.ptr = s;
hm->body.ptr = s + req_len;
hm->message.ptr = hm->head.ptr = s;
hm->body.ptr = end;
hm->head.len = req_len;
hm->message.len = hm->body.len = (size_t) ~0; // Set body length to infinite
// Parse request line

View File

@ -16,7 +16,8 @@ struct mg_http_message {
struct mg_str method, uri, query, proto; // Request/response line
struct mg_http_header headers[MG_MAX_HTTP_HEADERS]; // Headers
struct mg_str body; // Body
struct mg_str message; // Request line + headers + body
struct mg_str head; // Request + headers
struct mg_str message; // Request + headers + body
};
// Parameter for mg_http_serve_dir()