From 55517d48ed6124a2cc34eba820a40c2303cf2fcb Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Wed, 1 Jun 2022 16:25:04 +0100 Subject: [PATCH] Change linux target --- examples/http-server/Makefile | 9 ++++----- mongoose.c | 1 + src/http.c | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/http-server/Makefile b/examples/http-server/Makefile index eefab512..90a85f38 100644 --- a/examples/http-server/Makefile +++ b/examples/http-server/Makefile @@ -7,7 +7,7 @@ VC98 = docker run -it --rm -e Tmp=. -v $(ROOT):$(ROOT) -w $(CURDIR) mdashnet/vc9 LIN = docker run -it --rm -v $(ROOT):$(ROOT) -w $(CURDIR) mdashnet/cc2 all: $(PROG) - $(DEBUGGER) ./$(PROG) $(ARGS) + $(RUN) ./$(PROG) $(ARGS) $(PROG): main.c Makefile $(CC) ../../mongoose.c main.c -I../.. $(CFLAGS) -o $@ @@ -18,10 +18,9 @@ mongoose.exe: main.c mingw: gcc ../../mongoose.c main.c -I../.. -W -Wall -DMG_ENABLE_IPV6=1 -DMG_ENABLE_LINES=1 -D_POSIX_C_SOURCE=200000L -lws2_32 -o mongoose.exe -linux: all -linux: CFLAGS += -O2 -fsanitize=address,undefined,shift,null,return,bounds,alignment,object-size,bool,enum -static-libasan -#linux: CC = $(LIN) cc -#linux: DEBUGGER = $(LIN) +linux: example +linux: CFLAGS += -O2 +linux: CC = $(LIN) cc clean: rm -rf $(PROG) *.o *.dSYM *.gcov *.gcno *.gcda *.obj *.exe *.ilk *.pdb mongoose mongoose_* mongoose.* diff --git a/mongoose.c b/mongoose.c index ecfa1ddb..54ee145f 100644 --- a/mongoose.c +++ b/mongoose.c @@ -1679,6 +1679,7 @@ void mg_http_serve_dir(struct mg_connection *c, struct mg_http_message *hm, if (flags < 0) { // Do nothing: the response has already been sent by uri_to_path() } else if (flags == 0) { + // File not found - serve 404 mg_http_serve_file(c, hm, opts->page404, opts); } else if (flags & MG_FS_DIR) { listdir(c, hm, opts, path); diff --git a/src/http.c b/src/http.c index 657b4a8a..26bc4e92 100644 --- a/src/http.c +++ b/src/http.c @@ -685,6 +685,7 @@ void mg_http_serve_dir(struct mg_connection *c, struct mg_http_message *hm, if (flags < 0) { // Do nothing: the response has already been sent by uri_to_path() } else if (flags == 0) { + // File not found - serve 404 mg_http_serve_file(c, hm, opts->page404, opts); } else if (flags & MG_FS_DIR) { listdir(c, hm, opts, path);