From caacad97ddb1e30baa4e3ddc4ed37e57df465634 Mon Sep 17 00:00:00 2001 From: Jeremy Baxter Date: Wed, 7 Aug 2024 13:25:58 +1200 Subject: [PATCH] httpmodules: init module httpmodules --- Makefile | 9 +++++---- http.d | 2 ++ httpmodules/package.d | 9 +++++++++ 3 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 httpmodules/package.d diff --git a/Makefile b/Makefile index 36b0cbb..c17cad4 100644 --- a/Makefile +++ b/Makefile @@ -2,18 +2,19 @@ DC = ldc2 CFLAGS = -Jstatic -Oz OBJS = httpd.o http.o mimetypes.o +MODULEOBJS = $(shell ls httpmodules/*.d | sed 's/\.d$$/.o/') all: httpd -httpd: ${OBJS} - ${DC} -of=httpd ${OBJS} +httpd: ${MODULEOBJS} ${OBJS} + ${DC} -of=httpd ${OBJS} ${MODULEOBJS} .SUFFIXES: .d .o .d.o: - ${DC} ${CFLAGS} -c $< + ${DC} ${CFLAGS} -od=$(dir $<) -c $< clean: - rm -f httpd ${OBJS} + rm -f httpd ${OBJS} ${MODULEOBJS} $(shell ${DC} -o- -makedeps ${OBJS}) diff --git a/http.d b/http.d index 45abd2b..40dbe2d 100644 --- a/http.d +++ b/http.d @@ -31,3 +31,5 @@ struct HTTPResponse string responseBody; string httpVersion = "HTTP/1.1"; } + +alias HTTPModule = HTTPResponse delegate (HTTPRequest); diff --git a/httpmodules/package.d b/httpmodules/package.d new file mode 100644 index 0000000..ed9c2ba --- /dev/null +++ b/httpmodules/package.d @@ -0,0 +1,9 @@ +/++ + + Reusable components of an HTTP daemon + +/ +module httpmodules; + +import http; + +HTTPModule[] httpModules = [ +];