mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-26 22:41:03 +08:00
Change MG_MAX_RECV_BUF_SIZE -> MG_MAX_RECV_SIZE
This commit is contained in:
parent
73a5ff1fb6
commit
a88ea776a9
@ -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 |
|
||||
|
@ -23,7 +23,7 @@
|
||||
a partial HTTP message has been received (or a chunk-encoded chunk).
|
||||
Use <code>mg_http_delete_chunk()</code> to release chunk memory.
|
||||
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.
|
||||
<br><br>
|
||||
In this example, JavaScript code uses "fetch()" browser API.
|
||||
|
@ -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.
|
||||
|
@ -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)) {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)) {
|
||||
|
@ -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)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user