diff --git a/docs/README.md b/docs/README.md index 9a190c03..78818275 100644 --- a/docs/README.md +++ b/docs/README.md @@ -308,7 +308,7 @@ Here is a list of build constants and their default values: |MG_ENABLE_FATFS | 0 | Enable embedded FAT FS support | |MG_ENABLE_LINES | undefined | If defined, show source file names in logs | |MG_IO_SIZE | 2048 | Granularity of the send/recv IO buffer growth | -|MG_MAX_RECV_BUF_SIZE | (3 * 1024 * 1024) | Maximum recv buffer size | +|MG_MAX_RECV_SIZE | (3 * 1024 * 1024) | Maximum recv buffer size | |MG_MAX_HTTP_HEADERS | 40 | Maximum number of HTTP headers | |MG_HTTP_INDEX | "index.html" | Index file for HTML directory | |MG_FATFS_ROOT | "/" | FAT FS root directory | diff --git a/examples/file-upload/web_root/index.html b/examples/file-upload/web_root/index.html index 72c48871..ad9ef9a1 100644 --- a/examples/file-upload/web_root/index.html +++ b/examples/file-upload/web_root/index.html @@ -23,7 +23,7 @@ a partial HTTP message has been received (or a chunk-encoded chunk). Use mg_http_delete_chunk() to release chunk memory. When 0-sized chunk is received, that's the end of the message. - Use MG_MAX_RECV_BUF_SIZE build constant to limit + Use MG_MAX_RECV_SIZE build constant to limit maximum chunk size on a server side.

In this example, JavaScript code uses "fetch()" browser API. diff --git a/examples/form-upload/main.c b/examples/form-upload/main.c index 0f8153a8..21443a01 100644 --- a/examples/form-upload/main.c +++ b/examples/form-upload/main.c @@ -10,9 +10,9 @@ // ///////////////// IMPORTANT ////////////////////////// // // Mongoose has a limit on input buffer, which also limits maximum upload size. -// It is controlled by the MG_MAX_RECV_BUF_SIZE constant, which is set by +// It is controlled by the MG_MAX_RECV_SIZE constant, which is set by // default to (3 * 1024 * 1024), i.e. 3 megabytes. -// Use -DMG_MAX_RECV_BUF_SIZE=NEW_LIMIT to override it. +// Use -DMG_MAX_BUF_SIZE=NEW_LIMIT to override it. // // Also, consider changing -DMG_IO_SIZE=SOME_BIG_VALUE to increase IO buffer // increment when reading data. diff --git a/mongoose.c b/mongoose.c index 07078af9..0a0dec88 100644 --- a/mongoose.c +++ b/mongoose.c @@ -2758,7 +2758,7 @@ static void rx_udp(struct mip_if *ifp, struct pkt *pkt) { } else if (c != NULL) { c->rem.port = pkt->udp->sport; c->rem.ip = pkt->ip->src; - if (c->recv.len >= MG_MAX_RECV_BUF_SIZE) { + if (c->recv.len >= MG_MAX_RECV_SIZE) { mg_error(c, "max_recv_buf_size reached"); } else if (c->recv.size - c->recv.len < pkt->pay.len && !mg_iobuf_resize(&c->recv, c->recv.len + pkt->pay.len)) { @@ -4220,7 +4220,7 @@ static long mg_sock_recv(struct mg_connection *c, void *buf, size_t len) { // (e.g. FreeRTOS stack) return 0 instead of -1/EWOULDBLOCK when no data static long read_conn(struct mg_connection *c) { long n = -1; - if (c->recv.len >= MG_MAX_RECV_BUF_SIZE) { + if (c->recv.len >= MG_MAX_RECV_SIZE) { mg_error(c, "max_recv_buf_size reached"); } else if (c->recv.size - c->recv.len < MG_IO_SIZE && !mg_iobuf_resize(&c->recv, c->recv.size + MG_IO_SIZE)) { diff --git a/mongoose.h b/mongoose.h index bb376421..5418d2e8 100644 --- a/mongoose.h +++ b/mongoose.h @@ -649,8 +649,8 @@ int sscanf(const char *, const char *, ...); #endif // Maximum size of the recv IO buffer -#ifndef MG_MAX_RECV_BUF_SIZE -#define MG_MAX_RECV_BUF_SIZE (3 * 1024 * 1024) +#ifndef MG_MAX_RECV_SIZE +#define MG_MAX_RECV_SIZE (3 * 1024 * 1024) #endif #ifndef MG_MAX_HTTP_HEADERS diff --git a/src/config.h b/src/config.h index 6dda7931..1f96cbb3 100644 --- a/src/config.h +++ b/src/config.h @@ -67,8 +67,8 @@ #endif // Maximum size of the recv IO buffer -#ifndef MG_MAX_RECV_BUF_SIZE -#define MG_MAX_RECV_BUF_SIZE (3 * 1024 * 1024) +#ifndef MG_MAX_RECV_SIZE +#define MG_MAX_RECV_SIZE (3 * 1024 * 1024) #endif #ifndef MG_MAX_HTTP_HEADERS diff --git a/src/mip.c b/src/mip.c index 9ac1d260..63eb1df3 100644 --- a/src/mip.c +++ b/src/mip.c @@ -446,7 +446,7 @@ static void rx_udp(struct mip_if *ifp, struct pkt *pkt) { } else if (c != NULL) { c->rem.port = pkt->udp->sport; c->rem.ip = pkt->ip->src; - if (c->recv.len >= MG_MAX_RECV_BUF_SIZE) { + if (c->recv.len >= MG_MAX_RECV_SIZE) { mg_error(c, "max_recv_buf_size reached"); } else if (c->recv.size - c->recv.len < pkt->pay.len && !mg_iobuf_resize(&c->recv, c->recv.len + pkt->pay.len)) { diff --git a/src/sock.c b/src/sock.c index fff18da8..d37956e6 100644 --- a/src/sock.c +++ b/src/sock.c @@ -278,7 +278,7 @@ static long mg_sock_recv(struct mg_connection *c, void *buf, size_t len) { // (e.g. FreeRTOS stack) return 0 instead of -1/EWOULDBLOCK when no data static long read_conn(struct mg_connection *c) { long n = -1; - if (c->recv.len >= MG_MAX_RECV_BUF_SIZE) { + if (c->recv.len >= MG_MAX_RECV_SIZE) { mg_error(c, "max_recv_buf_size reached"); } else if (c->recv.size - c->recv.len < MG_IO_SIZE && !mg_iobuf_resize(&c->recv, c->recv.size + MG_IO_SIZE)) {