mirror of
https://github.com/cesanta/mongoose.git
synced 2024-11-25 03:29:00 +08:00
Minor nitpicks for big_upload
PUBLISHED_FROM=55d4270916f32ce4645965fbd7a031d7f8e1907b
This commit is contained in:
parent
179aa75047
commit
3fbfa33b9a
@ -1,9 +1,2 @@
|
||||
PROG = big_upload
|
||||
CFLAGS = -W -Wall -pthread -I../.. -g -O0 $(CFLAGS_EXTRA)
|
||||
SOURCES = $(PROG).c ../../mongoose.c
|
||||
|
||||
$(PROG): $(SOURCES)
|
||||
$(CC) -o $(PROG) $(SOURCES) $(CFLAGS)
|
||||
|
||||
clean:
|
||||
rm -rf $(PROG) *.exe *.dSYM *.obj *.exp .*o *.lib
|
||||
include ../examples.mk
|
||||
|
@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2015 Cesanta Software Limited
|
||||
// All rights reserved
|
||||
//
|
||||
// This example demonstrates how to handle very large requests without keeping
|
||||
// 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.
|
||||
|
||||
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"
|
||||
"Content-Lenght: 0\r\n\r\n");
|
||||
"Content-Length: 0\r\n\r\n");
|
||||
nc->flags |= MG_F_SEND_AND_CLOSE;
|
||||
return;
|
||||
}
|
||||
@ -66,9 +69,9 @@ static void handle_recv(struct mg_connection *nc) {
|
||||
data->bytes_left = hm.body.len;
|
||||
data->fp = tmpfile();
|
||||
if (data->fp == NULL) {
|
||||
mg_printf(nc,
|
||||
mg_printf(nc, "%s",
|
||||
"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;
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user