mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-08 16:11:18 +00:00
Minor nitpicks for big_upload
PUBLISHED_FROM=55d4270916f32ce4645965fbd7a031d7f8e1907b
This commit is contained in:
1 parent
179aa75047
commit
3fbfa33b9a
2 files changed
+8
-12
No files matched your search
@@ -1,9 +1,2 @@
|
|||||||
PROG = big_upload
|
PROG = big_upload
|
||||||
CFLAGS = -W -Wall -pthread -I../.. -g -O0 $(CFLAGS_EXTRA)
|
include ../examples.mk
|
||||||
SOURCES = $(PROG).c ../../mongoose.c
|
|
||||||
|
|
||||||
$(PROG): $(SOURCES)
|
|
||||||
$(CC) -o $(PROG) $(SOURCES) $(CFLAGS)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -rf $(PROG) *.exe *.dSYM *.obj *.exp .*o *.lib
|
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2015 Cesanta Software Limited
|
||||||
|
// All rights reserved
|
||||||
|
//
|
||||||
// This example demonstrates how to handle very large requests without keeping
|
// This example demonstrates how to handle very large requests without keeping
|
||||||
// them in memory.
|
// them in memory.
|
||||||
|
|
||||||
@@ -49,9 +52,9 @@ static void handle_recv(struct mg_connection *nc) {
|
|||||||
// This is the request that we don't want to buffer in memory.
|
// This is the request that we don't want to buffer in memory.
|
||||||
|
|
||||||
if (hm.body.len == (size_t) ~0 || hm.body.len == 0) {
|
if (hm.body.len == (size_t) ~0 || hm.body.len == 0) {
|
||||||
mg_printf(nc,
|
mg_printf(nc, "%s",
|
||||||
"HTTP/1.1 411 Content-Length required\r\n"
|
"HTTP/1.1 411 Content-Length required\r\n"
|
||||||
"Content-Lenght: 0\r\n\r\n");
|
"Content-Length: 0\r\n\r\n");
|
||||||
nc->flags |= MG_F_SEND_AND_CLOSE;
|
nc->flags |= MG_F_SEND_AND_CLOSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -66,9 +69,9 @@ static void handle_recv(struct mg_connection *nc) {
|
|||||||
data->bytes_left = hm.body.len;
|
data->bytes_left = hm.body.len;
|
||||||
data->fp = tmpfile();
|
data->fp = tmpfile();
|
||||||
if (data->fp == NULL) {
|
if (data->fp == NULL) {
|
||||||
mg_printf(nc,
|
mg_printf(nc, "%s",
|
||||||
"HTTP/1.1 500 Failed to open a file\r\n"
|
"HTTP/1.1 500 Failed to open a file\r\n"
|
||||||
"Content-Lenght: 0\r\n\r\n");
|
"Content-Length: 0\r\n\r\n");
|
||||||
nc->flags |= MG_F_SEND_AND_CLOSE;
|
nc->flags |= MG_F_SEND_AND_CLOSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user