aboutsummaryrefslogtreecommitdiffstats
path: root/src/afb-hreq.c
diff options
context:
space:
mode:
authorJose Bollo <jose.bollo@iot.bzh>2019-02-21 14:39:59 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2019-03-22 12:21:54 +0100
commit0e2b5f5b7fa3a09abf61c8253efce7c7f2b4c444 (patch)
tree85f54ba7b0301245553e86704d28dfccaa031013 /src/afb-hreq.c
parentf2f086fa99e47ca8b3001831ea3548f8758e1222 (diff)
Allow to remove libmicrohttpd (HTTP server)
This allows to remove the dependency to libmicrohttpd. At the end, this will allow either to replace it with an other HTTP library or to fully remove the HTTP server. It also makes a tiny improvement of the conditionnal compilation. Change-Id: I24106659af04453b6693f2cda0939a601391202f Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-hreq.c')
-rw-r--r--src/afb-hreq.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/afb-hreq.c b/src/afb-hreq.c
index a2df4b13..49c16921 100644
--- a/src/afb-hreq.c
+++ b/src/afb-hreq.c
@@ -15,6 +15,8 @@
* limitations under the License.
*/
+#if WITH_LIBMICROHTTPD
+
#define _GNU_SOURCE
#include <stdlib.h>
@@ -31,7 +33,7 @@
#define JSON_C_TO_STRING_NOSLASHESCAPE 0
#endif
-#if defined(USE_MAGIC_MIME_TYPE)
+#if USE_MAGIC_MIME_TYPE
#include <magic.h>
#endif
@@ -218,7 +220,7 @@ void afb_hreq_reply_free(struct afb_hreq *hreq, unsigned status, size_t size, ch
va_end(args);
}
-#if defined(USE_MAGIC_MIME_TYPE)
+#if USE_MAGIC_MIME_TYPE
#if !defined(MAGIC_DB)
#define MAGIC_DB "/usr/share/misc/magic.mgc"
@@ -262,7 +264,7 @@ static const char *mimetype_fd_name(int fd, const char *filename)
{
const char *result = NULL;
-#if defined(INFER_EXTENSION)
+#if INFER_EXTENSION
/*
* Set some well-known extensions
* Note that it is mandatory for example for css files in order to provide
@@ -307,7 +309,7 @@ static const char *mimetype_fd_name(int fd, const char *filename)
}
}
#endif
-#if defined(USE_MAGIC_MIME_TYPE)
+#if USE_MAGIC_MIME_TYPE
if (result == NULL)
result = magic_mimetype_fd(fd);
#endif
@@ -1001,3 +1003,4 @@ struct afb_hreq *afb_hreq_create()
return hreq;
}
+#endif