Commit 3fbfa33b authored by Sergey Lyubka's avatar Sergey Lyubka Committed by Maxim Ignatenko

Minor nitpicks for big_upload

    PUBLISHED_FROM=55d4270916f32ce4645965fbd7a031d7f8e1907b
parent 179aa750
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
// 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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment