From cfe77a3d5854853f3345c0e14e7bc126860d118f Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Sat, 6 May 2017 12:16:34 +0100 Subject: [PATCH] Move struct http_message::body Rationale: this is the optimisation to make JS FFI-ed API work nicer. We don't have strucuture introspection now, and do not generate offsets automatially. Thus, using a stable well-known location of the parsed message body is better, in case of number of HTTP headers macro changes. PUBLISHED_FROM=55bf25ac77060a9c81dfecd6601f037562530801 --- docs/c-api/http.h/struct_http_message.md | 4 +--- mongoose.h | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/docs/c-api/http.h/struct_http_message.md b/docs/c-api/http.h/struct_http_message.md index 60eae685..9380496d 100644 --- a/docs/c-api/http.h/struct_http_message.md +++ b/docs/c-api/http.h/struct_http_message.md @@ -5,6 +5,7 @@ symbol_kind: "struct" signature: | struct http_message { struct mg_str message; /* Whole message: request line + headers + body */ + struct mg_str body; /* Message body. 0-length for requests with no body */ /* HTTP Request line (or HTTP response line) */ struct mg_str method; /* "GET" */ @@ -28,9 +29,6 @@ signature: | /* Headers */ struct mg_str header_names[MG_MAX_HTTP_HEADERS]; struct mg_str header_values[MG_MAX_HTTP_HEADERS]; - - /* Message body */ - struct mg_str body; /* Zero-length for requests with no body */ }; --- diff --git a/mongoose.h b/mongoose.h index b9247747..a8e30c3f 100644 --- a/mongoose.h +++ b/mongoose.h @@ -4140,6 +4140,7 @@ extern "C" { /* HTTP message */ struct http_message { struct mg_str message; /* Whole message: request line + headers + body */ + struct mg_str body; /* Message body. 0-length for requests with no body */ /* HTTP Request line (or HTTP response line) */ struct mg_str method; /* "GET" */ @@ -4163,9 +4164,6 @@ struct http_message { /* Headers */ struct mg_str header_names[MG_MAX_HTTP_HEADERS]; struct mg_str header_values[MG_MAX_HTTP_HEADERS]; - - /* Message body */ - struct mg_str body; /* Zero-length for requests with no body */ }; #if MG_ENABLE_HTTP_WEBSOCKET