mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-06 15:51:25 +00:00
Change MG_MAX_RECV_BUF_SIZE -> MG_MAX_RECV_SIZE
This commit is contained in:
1 parent
73a5ff1fb6
commit
a88ea776a9
8 files changed
+12
-12
No files matched your search
+1
-1
@@ -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_FATFS | 0 | Enable embedded FAT FS support |
|
||||||
|MG_ENABLE_LINES | undefined | If defined, show source file names in logs |
|
|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_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_MAX_HTTP_HEADERS | 40 | Maximum number of HTTP headers |
|
||||||
|MG_HTTP_INDEX | "index.html" | Index file for HTML directory |
|
|MG_HTTP_INDEX | "index.html" | Index file for HTML directory |
|
||||||
|MG_FATFS_ROOT | "/" | FAT FS root directory |
|
|MG_FATFS_ROOT | "/" | FAT FS root directory |
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
a partial HTTP message has been received (or a chunk-encoded chunk).
|
a partial HTTP message has been received (or a chunk-encoded chunk).
|
||||||
Use <code>mg_http_delete_chunk()</code> to release chunk memory.
|
Use <code>mg_http_delete_chunk()</code> to release chunk memory.
|
||||||
When 0-sized chunk is received, that's the end of the message.
|
When 0-sized chunk is received, that's the end of the message.
|
||||||
Use <code>MG_MAX_RECV_BUF_SIZE</code> build constant to limit
|
Use <code>MG_MAX_RECV_SIZE</code> build constant to limit
|
||||||
maximum chunk size on a server side.
|
maximum chunk size on a server side.
|
||||||
<br><br>
|
<br><br>
|
||||||
In this example, JavaScript code uses "fetch()" browser API.
|
In this example, JavaScript code uses "fetch()" browser API.
|
||||||
|
|||||||
@@ -10,9 +10,9 @@
|
|||||||
// ///////////////// IMPORTANT //////////////////////////
|
// ///////////////// IMPORTANT //////////////////////////
|
||||||
//
|
//
|
||||||
// Mongoose has a limit on input buffer, which also limits maximum upload size.
|
// 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.
|
// 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
|
// Also, consider changing -DMG_IO_SIZE=SOME_BIG_VALUE to increase IO buffer
|
||||||
// increment when reading data.
|
// increment when reading data.
|
||||||
|
|||||||
+2
-2
@@ -2758,7 +2758,7 @@ static void rx_udp(struct mip_if *ifp, struct pkt *pkt) {
|
|||||||
} else if (c != NULL) {
|
} else if (c != NULL) {
|
||||||
c->rem.port = pkt->udp->sport;
|
c->rem.port = pkt->udp->sport;
|
||||||
c->rem.ip = pkt->ip->src;
|
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");
|
mg_error(c, "max_recv_buf_size reached");
|
||||||
} else if (c->recv.size - c->recv.len < pkt->pay.len &&
|
} else if (c->recv.size - c->recv.len < pkt->pay.len &&
|
||||||
!mg_iobuf_resize(&c->recv, 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
|
// (e.g. FreeRTOS stack) return 0 instead of -1/EWOULDBLOCK when no data
|
||||||
static long read_conn(struct mg_connection *c) {
|
static long read_conn(struct mg_connection *c) {
|
||||||
long n = -1;
|
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");
|
mg_error(c, "max_recv_buf_size reached");
|
||||||
} else if (c->recv.size - c->recv.len < MG_IO_SIZE &&
|
} else if (c->recv.size - c->recv.len < MG_IO_SIZE &&
|
||||||
!mg_iobuf_resize(&c->recv, c->recv.size + MG_IO_SIZE)) {
|
!mg_iobuf_resize(&c->recv, c->recv.size + MG_IO_SIZE)) {
|
||||||
|
|||||||
+2
-2
@@ -649,8 +649,8 @@ int sscanf(const char *, const char *, ...);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Maximum size of the recv IO buffer
|
// Maximum size of the recv IO buffer
|
||||||
#ifndef MG_MAX_RECV_BUF_SIZE
|
#ifndef MG_MAX_RECV_SIZE
|
||||||
#define MG_MAX_RECV_BUF_SIZE (3 * 1024 * 1024)
|
#define MG_MAX_RECV_SIZE (3 * 1024 * 1024)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MG_MAX_HTTP_HEADERS
|
#ifndef MG_MAX_HTTP_HEADERS
|
||||||
|
|||||||
+2
-2
@@ -67,8 +67,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Maximum size of the recv IO buffer
|
// Maximum size of the recv IO buffer
|
||||||
#ifndef MG_MAX_RECV_BUF_SIZE
|
#ifndef MG_MAX_RECV_SIZE
|
||||||
#define MG_MAX_RECV_BUF_SIZE (3 * 1024 * 1024)
|
#define MG_MAX_RECV_SIZE (3 * 1024 * 1024)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MG_MAX_HTTP_HEADERS
|
#ifndef MG_MAX_HTTP_HEADERS
|
||||||
|
|||||||
@@ -446,7 +446,7 @@ static void rx_udp(struct mip_if *ifp, struct pkt *pkt) {
|
|||||||
} else if (c != NULL) {
|
} else if (c != NULL) {
|
||||||
c->rem.port = pkt->udp->sport;
|
c->rem.port = pkt->udp->sport;
|
||||||
c->rem.ip = pkt->ip->src;
|
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");
|
mg_error(c, "max_recv_buf_size reached");
|
||||||
} else if (c->recv.size - c->recv.len < pkt->pay.len &&
|
} else if (c->recv.size - c->recv.len < pkt->pay.len &&
|
||||||
!mg_iobuf_resize(&c->recv, c->recv.len + pkt->pay.len)) {
|
!mg_iobuf_resize(&c->recv, c->recv.len + pkt->pay.len)) {
|
||||||
|
|||||||
+1
-1
@@ -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
|
// (e.g. FreeRTOS stack) return 0 instead of -1/EWOULDBLOCK when no data
|
||||||
static long read_conn(struct mg_connection *c) {
|
static long read_conn(struct mg_connection *c) {
|
||||||
long n = -1;
|
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");
|
mg_error(c, "max_recv_buf_size reached");
|
||||||
} else if (c->recv.size - c->recv.len < MG_IO_SIZE &&
|
} else if (c->recv.size - c->recv.len < MG_IO_SIZE &&
|
||||||
!mg_iobuf_resize(&c->recv, c->recv.size + MG_IO_SIZE)) {
|
!mg_iobuf_resize(&c->recv, c->recv.size + MG_IO_SIZE)) {
|
||||||
|
|||||||
Reference in new issue
Block a user