aboutsummaryrefslogtreecommitdiff
path: root/examples/async/Makefile
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2025-10-06 01:23:20 +0200
committerXavier Del Campo Romero <xavi92@disroot.org>2025-10-06 15:51:00 +0200
commit3e4c7c993bbbe2bdeb563fa888b900d01c4be4a1 (patch)
treebda2c376c19b11f8f76ef6aad84dea067f491934 /examples/async/Makefile
parenta0f5f7509bb9040752fa61fe0fdb447608e22b1c (diff)
Fix design issues with async responses, add async example
struct http_response did not provide users any void * that could be used to maintain a state between calls to an asynchronous HTTP response. On the other hand, the user pointer could not be used for this purpose, since it is shared among all HTTP clients for a given struct handler instance. Moreover, the length callback was still not supporting this feature, which in fact might be required by some users. Implementing this was particularly challenging, as this broke the current assumption that all bytes on a call to http_read were being processed. Now, since a client request can only be partially processed because of the length callback, http_read must take this into account so that the remaining bytes are still available for future calls, before reading again from the file descriptor.
Diffstat (limited to 'examples/async/Makefile')
-rw-r--r--examples/async/Makefile29
1 files changed, 29 insertions, 0 deletions
diff --git a/examples/async/Makefile b/examples/async/Makefile
new file mode 100644
index 0000000..d0a42c2
--- /dev/null
+++ b/examples/async/Makefile
@@ -0,0 +1,29 @@
+.POSIX:
+
+PROJECT = async
+DEPS = \
+ main.o
+LIBWEB = ../../libweb.a
+DYNSTR = ../../dynstr/libdynstr.a
+CFLAGS = -I ../../include -I ../../dynstr/include
+LIBWEB_FLAGS = -L ../../ -l web
+DYNSTR_FLAGS = -L ../../dynstr -l dynstr
+
+all: $(PROJECT)
+
+clean:
+ rm -f $(DEPS)
+
+distclean: clean
+ rm -f $(PROJECT)
+
+FORCE:
+
+$(PROJECT): $(DEPS) $(LIBWEB) $(DYNSTR)
+ $(CC) $(LDFLAGS) $(DEPS) $(LIBWEB_FLAGS) $(DYNSTR_FLAGS) -o $@
+
+$(LIBWEB): FORCE
+ +cd ../../ && $(MAKE)
+
+$(DYNSTR): FORCE
+ +cd ../../dynstr && $(MAKE)