summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3d2dcd7)
raw | patch | inline | side by side (parent: 3d2dcd7)
author | Marc Fournier <marc.fournier@camptocamp.com> | |
Tue, 1 Nov 2016 10:15:24 +0000 (11:15 +0100) | ||
committer | Florian Forster <octo@collectd.org> | |
Fri, 11 Nov 2016 13:42:03 +0000 (14:42 +0100) |
Add switch on MHD_VERSION to support both legacy and modern MHD functions.
`MHD_create_response_from_data()` is deprecated since libmicrohttpd
0.9.5 and makes the build fail since 0.9.45.
`MHD_create_response_from_data()` is deprecated since libmicrohttpd
0.9.5 and makes the build fail since 0.9.45.
src/write_prometheus.c | patch | blob | history |
diff --git a/src/write_prometheus.c b/src/write_prometheus.c
index 6c882781549eae1448a8b6e71a5ac08b0b6d74c3..6fb5a8664f3a13be51bc234448020a39bd265e10 100644 (file)
--- a/src/write_prometheus.c
+++ b/src/write_prometheus.c
else
format_text(buffer);
- struct MHD_Response *res = MHD_create_response_from_data(
+ struct MHD_Response *res =
+#if defined(MHD_VERSION) && MHD_VERSION >= 0x00090500
+ MHD_create_response_from_buffer(
+ simple.len, simple.data, MHD_RESPMEM_MUST_COPY);
+#else
+ MHD_create_response_from_data(
simple.len, simple.data, /* must_free = */ 0, /* must_copy = */ 1);
+#endif
MHD_add_response_header(res, MHD_HTTP_HEADER_CONTENT_TYPE,
want_proto ? CONTENT_TYPE_PROTO : CONTENT_TYPE_TEXT);