Commit cfe77a3d authored by Sergey Lyubka's avatar Sergey Lyubka Committed by Cesanta Bot

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
parent a0527a7f
...@@ -5,6 +5,7 @@ symbol_kind: "struct" ...@@ -5,6 +5,7 @@ symbol_kind: "struct"
signature: | signature: |
struct http_message { struct http_message {
struct mg_str message; /* Whole message: request line + headers + body */ 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) */ /* HTTP Request line (or HTTP response line) */
struct mg_str method; /* "GET" */ struct mg_str method; /* "GET" */
...@@ -28,9 +29,6 @@ signature: | ...@@ -28,9 +29,6 @@ signature: |
/* Headers */ /* Headers */
struct mg_str header_names[MG_MAX_HTTP_HEADERS]; struct mg_str header_names[MG_MAX_HTTP_HEADERS];
struct mg_str header_values[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 */
}; };
--- ---
......
...@@ -4140,6 +4140,7 @@ extern "C" { ...@@ -4140,6 +4140,7 @@ extern "C" {
/* HTTP message */ /* HTTP message */
struct http_message { struct http_message {
struct mg_str message; /* Whole message: request line + headers + body */ 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) */ /* HTTP Request line (or HTTP response line) */
struct mg_str method; /* "GET" */ struct mg_str method; /* "GET" */
...@@ -4163,9 +4164,6 @@ struct http_message { ...@@ -4163,9 +4164,6 @@ struct http_message {
/* Headers */ /* Headers */
struct mg_str header_names[MG_MAX_HTTP_HEADERS]; struct mg_str header_names[MG_MAX_HTTP_HEADERS];
struct mg_str header_values[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 #if MG_ENABLE_HTTP_WEBSOCKET
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment