mirror of
https://github.com/cesanta/mongoose.git
synced 2025-01-04 13:15:36 +08:00
Fix multipart handling for small files
PUBLISHED_FROM=b43cb8ca061d50ea8c0b6b20287b9382a4a6be22
This commit is contained in:
parent
55c2634416
commit
ce53e9dd2b
13
mongoose.c
13
mongoose.c
@ -5177,6 +5177,15 @@ void mg_http_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
|||||||
mg_handle_chunked(nc, hm, io->buf + req_len, io->len - req_len);
|
mg_handle_chunked(nc, hm, io->buf + req_len, io->len - req_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MG_ENABLE_HTTP_STREAMING_MULTIPART
|
||||||
|
if (req_len > 0 && (s = mg_get_http_header(hm, "Content-Type")) != NULL &&
|
||||||
|
s->len >= 9 && strncmp(s->p, "multipart", 9) == 0) {
|
||||||
|
mg_http_multipart_begin(nc, hm, req_len);
|
||||||
|
mg_http_multipart_continue(nc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif /* MG_ENABLE_HTTP_STREAMING_MULTIPART */
|
||||||
|
|
||||||
/* TODO(alashkin): refactor this ifelseifelseifelseifelse */
|
/* TODO(alashkin): refactor this ifelseifelseifelseifelse */
|
||||||
if ((req_len < 0 ||
|
if ((req_len < 0 ||
|
||||||
(req_len == 0 && io->len >= MG_MAX_HTTP_REQUEST_SIZE))) {
|
(req_len == 0 && io->len >= MG_MAX_HTTP_REQUEST_SIZE))) {
|
||||||
@ -5266,10 +5275,6 @@ void mg_http_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
|||||||
mg_http_call_endpoint_handler(nc, trigger_ev, hm);
|
mg_http_call_endpoint_handler(nc, trigger_ev, hm);
|
||||||
#endif
|
#endif
|
||||||
mbuf_remove(io, hm->message.len);
|
mbuf_remove(io, hm->message.len);
|
||||||
#ifdef MG_ENABLE_HTTP_STREAMING_MULTIPART
|
|
||||||
} else {
|
|
||||||
mg_http_multipart_begin(nc, hm, req_len);
|
|
||||||
#endif /* MG_ENABLE_HTTP_STREAMING_MULTIPART */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void) pd;
|
(void) pd;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user