|
@@ -2472,6 +2472,24 @@ static int pull_all(FILE *fp, struct mg_connection *conn, char *buf, int len)
|
|
|
return nread;
|
|
|
}
|
|
|
|
|
|
+static void fast_forward_request(struct mg_connection *conn)
|
|
|
+{
|
|
|
+ char buf[MG_BUF_LEN];
|
|
|
+ int to_read, nread;
|
|
|
+
|
|
|
+ while (conn->consumed_content < conn->content_len) {
|
|
|
+ to_read = sizeof(buf);
|
|
|
+ if ((int64_t) to_read > conn->content_len - conn->consumed_content) {
|
|
|
+ to_read = (int) (conn->content_len - conn->consumed_content);
|
|
|
+ }
|
|
|
+
|
|
|
+ nread = mg_read(conn, buf, to_read);
|
|
|
+ if (nread <= 0) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
int mg_read(struct mg_connection *conn, void *buf, size_t len)
|
|
|
{
|
|
|
int64_t n, buffered_len, nread;
|
|
@@ -6269,6 +6287,7 @@ static void handle_request(struct mg_connection *conn)
|
|
|
/* 8. check if there are request handlers for this path */
|
|
|
if (conn->ctx->request_handlers != NULL && use_request_handler(conn)) {
|
|
|
/* Do nothing, callback has served the request */
|
|
|
+ fast_forward_request(conn);
|
|
|
return;
|
|
|
}
|
|
|
|