From 6e152ae37c4075ff2a39298d450bf58258ceffe1 Mon Sep 17 00:00:00 2001 From: Přemysl Janouch
Date: Thu, 18 Oct 2018 07:17:06 +0200
Subject: More debugging information for static file serving
---
 demo-json-rpc-server.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/demo-json-rpc-server.c b/demo-json-rpc-server.c
index e210788..34cd378 100644
--- a/demo-json-rpc-server.c
+++ b/demo-json-rpc-server.c
@@ -1642,6 +1642,15 @@ request_start (struct request *self, struct str_map *headers)
 	//   Another way we could get rid of the continue_ argument is via adding
 	//   some way of marking the request as finished from within the handler.
 
+	if (g_debug_mode)
+	{
+		struct str_map_iter iter = str_map_iter_make (headers);
+		const char *value;
+		while ((value = str_map_iter_next (&iter)))
+			print_debug ("%s: %s", iter.link->key, value);
+		print_debug ("--");
+	}
+
 	bool continue_ = true;
 	LIST_FOR_EACH (struct request_handler, handler, self->ctx->handlers)
 		if (handler->try_handle (self, headers, &continue_))
@@ -1800,15 +1809,19 @@ request_handler_static_try_handle
 		return false;
 	}
 
+	// TODO: implement HEAD, we don't get that for free;
+	//   probably implies adding Content-Length
 	const char *method = str_map_find (headers, "REQUEST_METHOD");
 	if (!method || strcmp (method, "GET"))
 		return false;
 
 	// TODO: look at