mirror of
https://github.com/macports/macports-ports.git
synced 2026-07-12 18:20:25 -07:00
95 lines
4.4 KiB
Diff
95 lines
4.4 KiB
Diff
# error: no matching function for call to 'MHD_start_daemon'
|
|
|
|
--- akumulid/httpserver.h.orig 2020-05-19 18:47:08.000000000 +0545
|
|
+++ akumulid/httpserver.h 2022-08-07 06:00:50.000000000 +0545
|
|
@@ -26,6 +26,18 @@
|
|
#include "logger.h"
|
|
#include "server.h"
|
|
|
|
+// https://github.com/macports/macports-ports/pull/8941/files
|
|
+// Beginning with v0.9.71, libmicrohttpd changed the return type
|
|
+// of most functions from int to enum MHD_Result
|
|
+// https://git.gnunet.org/gnunet.git/tree/src/include/gnunet_mhd_compat.h
|
|
+// proposes to define a constant for the return type so it works well
|
|
+// with all versions of libmicrohttpd
|
|
+#if MHD_VERSION >= 0x00097002
|
|
+#define MHD_RESULT enum MHD_Result
|
|
+#else
|
|
+#define MHD_RESULT int
|
|
+#endif
|
|
+
|
|
namespace Akumuli {
|
|
namespace Http {
|
|
|
|
|
|
--- akumulid/httpserver.cpp.orig 2020-05-19 18:47:08.000000000 +0545
|
|
+++ akumulid/httpserver.cpp 2022-08-07 07:05:55.000000000 +0545
|
|
@@ -51,21 +51,21 @@
|
|
return ApiEndpoint::UNKNOWN;
|
|
}
|
|
|
|
-static int accept_connection(void *cls,
|
|
- MHD_Connection *connection,
|
|
- const char *url,
|
|
- const char *method,
|
|
- const char *version,
|
|
- const char *upload_data,
|
|
- size_t *upload_data_size,
|
|
- void **con_cls)
|
|
+static MHD_RESULT accept_connection(void *cls,
|
|
+ MHD_Connection *connection,
|
|
+ const char *url,
|
|
+ const char *method,
|
|
+ const char *version,
|
|
+ const char *upload_data,
|
|
+ size_t *upload_data_size,
|
|
+ void **con_cls)
|
|
{
|
|
std::string path = url;
|
|
auto error_response = [&](const char* msg, unsigned int error_code) {
|
|
char buffer[0x200];
|
|
int len = snprintf(buffer, 0x200, "-%s\r\n", msg);
|
|
auto response = MHD_create_response_from_buffer(len, buffer, MHD_RESPMEM_MUST_COPY);
|
|
- int ret = MHD_queue_response(connection, error_code, response);
|
|
+ MHD_RESULT ret = MHD_queue_response(connection, error_code, response);
|
|
MHD_destroy_response(response);
|
|
return ret;
|
|
};
|
|
@@ -104,7 +104,7 @@
|
|
}
|
|
|
|
auto response = MHD_create_response_from_callback(MHD_SIZE_UNKNOWN, 64*1024, &read_callback, cursor, &free_callback);
|
|
- int ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
|
|
+ MHD_RESULT ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
|
|
MHD_destroy_response(response);
|
|
return ret;
|
|
} else {
|
|
@@ -123,7 +123,7 @@
|
|
if (path == "/api/stats") {
|
|
std::string stats = queryproc->get_all_stats();
|
|
auto response = MHD_create_response_from_buffer(stats.size(), const_cast<char*>(stats.data()), MHD_RESPMEM_MUST_COPY);
|
|
- int ret = MHD_add_response_header(response, "content-type", "application/json");
|
|
+ MHD_RESULT ret = MHD_add_response_header(response, "content-type", "application/json");
|
|
if (ret == MHD_NO) {
|
|
return ret;
|
|
}
|
|
@@ -133,7 +133,7 @@
|
|
} else if (path == "/api/function-names") {
|
|
std::string stats = queryproc->get_resource("function-names");
|
|
auto response = MHD_create_response_from_buffer(stats.size(), const_cast<char*>(stats.data()), MHD_RESPMEM_MUST_COPY);
|
|
- int ret = MHD_add_response_header(response, "content-type", "application/json");
|
|
+ MHD_RESULT ret = MHD_add_response_header(response, "content-type", "application/json");
|
|
if (ret == MHD_NO) {
|
|
return ret;
|
|
}
|
|
@@ -143,7 +143,7 @@
|
|
} else if (path == "/api/version") {
|
|
std::string version = queryproc->get_resource("version");
|
|
auto response = MHD_create_response_from_buffer(version.size(), const_cast<char*>(version.data()), MHD_RESPMEM_MUST_COPY);
|
|
- int ret = MHD_add_response_header(response, "content-type", "application/json");
|
|
+ MHD_RESULT ret = MHD_add_response_header(response, "content-type", "application/json");
|
|
if (ret == MHD_NO) {
|
|
return ret;
|
|
}
|
|
|