From 3fbfa33b9a9ea8f8960ddfaed476f1faf8c7d4c2 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Tue, 13 Oct 2015 09:12:09 +0100 Subject: [PATCH] Minor nitpicks for big_upload PUBLISHED_FROM=55d4270916f32ce4645965fbd7a031d7f8e1907b --- examples/big_upload/Makefile | 9 +-------- examples/big_upload/big_upload.c | 11 +++++++---- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/examples/big_upload/Makefile b/examples/big_upload/Makefile index 426a3a3e..b362d635 100644 --- a/examples/big_upload/Makefile +++ b/examples/big_upload/Makefile @@ -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 diff --git a/examples/big_upload/big_upload.c b/examples/big_upload/big_upload.c index 576b9ab4..2d9a4fbc 100644 --- a/examples/big_upload/big_upload.c +++ b/examples/big_upload/big_upload.c @@ -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; }