Skip to content

Max size on JSON response #2255

Discussion options

You must be logged in to vote

Well... I fail to see the "JSON" specifics in your question, you are just calling https://mongoose.ws/documentation/#mg_http_reply
Mongoose uses dynamic memory allocation. Your readJSON(), whatever it does, will return a const char *. mg_http_reply() will grab that string and try to put it on Mongoose buffer to be sent to TCP, The buffer will try to resize to fit the contents, and if it can't, you'll see an out of memory message in the log

mongoose/src/http.c

Lines 336 to 352 in d013e0f

void mg_http_reply(struct mg_connection *c, int code, const char *headers,
const char *fmt, ...) {
va_list ap;
size_t len;
mg_printf(c, "HTTP/1.1 %d %s\r\n%sContent-Length: …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by scaprile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants