diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gns/gnunet-bcd.c | 5 | ||||
-rw-r--r-- | src/gns/gnunet-gns-proxy.c | 4 | ||||
-rw-r--r-- | src/include/Makefile.am | 1 | ||||
-rw-r--r-- | src/include/gnunet_mhd_compat.h | 43 | ||||
-rw-r--r-- | src/namestore/gnunet-namestore-fcfsd.c | 11 | ||||
-rw-r--r-- | src/pq/pq_result_helper.c | 2 | ||||
-rw-r--r-- | src/rest/gnunet-rest-server.c | 22 | ||||
-rw-r--r-- | src/transport/plugin_transport_http_server.c | 12 |
8 files changed, 75 insertions, 25 deletions
diff --git a/src/gns/gnunet-bcd.c b/src/gns/gnunet-bcd.c index d6de86fa0..6ceff4a9a 100644 --- a/src/gns/gnunet-bcd.c +++ b/src/gns/gnunet-bcd.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include <microhttpd.h> | 28 | #include <microhttpd.h> |
29 | #include "gnunet_util_lib.h" | 29 | #include "gnunet_util_lib.h" |
30 | #include "gnunet_mhd_compat.h" | ||
30 | 31 | ||
31 | /** | 32 | /** |
32 | * Error page to display if submitted GNS key is invalid. | 33 | * Error page to display if submitted GNS key is invalid. |
@@ -91,7 +92,7 @@ struct Entry | |||
91 | /** | 92 | /** |
92 | * Main request handler. | 93 | * Main request handler. |
93 | */ | 94 | */ |
94 | static int | 95 | static MHD_RESULT |
95 | access_handler_callback (void *cls, | 96 | access_handler_callback (void *cls, |
96 | struct MHD_Connection *connection, | 97 | struct MHD_Connection *connection, |
97 | const char *url, | 98 | const char *url, |
@@ -153,7 +154,7 @@ access_handler_callback (void *cls, | |||
153 | struct stat st; | 154 | struct stat st; |
154 | struct MHD_Response *response; | 155 | struct MHD_Response *response; |
155 | int fd; | 156 | int fd; |
156 | int ret; | 157 | MHD_RESULT ret; |
157 | 158 | ||
158 | const char *gpg_fp = MHD_lookup_connection_value (connection, | 159 | const char *gpg_fp = MHD_lookup_connection_value (connection, |
159 | MHD_GET_ARGUMENT_KIND, | 160 | MHD_GET_ARGUMENT_KIND, |
diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c index 5b8348d43..c0572fe40 100644 --- a/src/gns/gnunet-gns-proxy.c +++ b/src/gns/gnunet-gns-proxy.c | |||
@@ -43,7 +43,7 @@ | |||
43 | #include "gnunet_gns_service.h" | 43 | #include "gnunet_gns_service.h" |
44 | #include "gnunet_identity_service.h" | 44 | #include "gnunet_identity_service.h" |
45 | #include "gns.h" | 45 | #include "gns.h" |
46 | 46 | #include "gnunet_mhd_compat.h" | |
47 | 47 | ||
48 | /** | 48 | /** |
49 | * Default Socks5 listen port. | 49 | * Default Socks5 listen port. |
@@ -1827,7 +1827,7 @@ con_val_iter (void *cls, | |||
1827 | * #MHD_NO if the socket must be closed due to a serious | 1827 | * #MHD_NO if the socket must be closed due to a serious |
1828 | * error while handling the request | 1828 | * error while handling the request |
1829 | */ | 1829 | */ |
1830 | static int | 1830 | static MHD_RESULT |
1831 | create_response (void *cls, | 1831 | create_response (void *cls, |
1832 | struct MHD_Connection *con, | 1832 | struct MHD_Connection *con, |
1833 | const char *url, | 1833 | const char *url, |
diff --git a/src/include/Makefile.am b/src/include/Makefile.am index 5c57b5be2..d2c254ae6 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am | |||
@@ -62,6 +62,7 @@ gnunetinclude_HEADERS = \ | |||
62 | gnunet_json_lib.h \ | 62 | gnunet_json_lib.h \ |
63 | gnunet_load_lib.h \ | 63 | gnunet_load_lib.h \ |
64 | gnunet_cadet_service.h \ | 64 | gnunet_cadet_service.h \ |
65 | gnunet_mhd_compat.h \ | ||
65 | gnunet_microphone_lib.h \ | 66 | gnunet_microphone_lib.h \ |
66 | gnunet_mst_lib.h \ | 67 | gnunet_mst_lib.h \ |
67 | gnunet_mq_lib.h \ | 68 | gnunet_mq_lib.h \ |
diff --git a/src/include/gnunet_mhd_compat.h b/src/include/gnunet_mhd_compat.h new file mode 100644 index 000000000..0cfcc6445 --- /dev/null +++ b/src/include/gnunet_mhd_compat.h | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2020 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @author Christian Grothoff | ||
23 | * | ||
24 | * @file | ||
25 | * MHD compatibility definitions for warning-less compile of | ||
26 | * our code against MHD before and after #MHD_VERSION 0x00097002. | ||
27 | */ | ||
28 | #include <microhttpd.h> | ||
29 | |||
30 | #if MHD_VERSION >= 0x00097002 | ||
31 | /** | ||
32 | * Data type to use for functions return an "MHD result". | ||
33 | */ | ||
34 | #define MHD_RESULT enum MHD_Result | ||
35 | |||
36 | #else | ||
37 | |||
38 | /** | ||
39 | * Data type to use for functions return an "MHD result". | ||
40 | */ | ||
41 | #define MHD_RESULT int | ||
42 | |||
43 | #endif | ||
diff --git a/src/namestore/gnunet-namestore-fcfsd.c b/src/namestore/gnunet-namestore-fcfsd.c index fa0f835d1..67fc5bdf4 100644 --- a/src/namestore/gnunet-namestore-fcfsd.c +++ b/src/namestore/gnunet-namestore-fcfsd.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include "gnunet_identity_service.h" | 36 | #include "gnunet_identity_service.h" |
37 | #include "gnunet_gnsrecord_lib.h" | 37 | #include "gnunet_gnsrecord_lib.h" |
38 | #include "gnunet_namestore_service.h" | 38 | #include "gnunet_namestore_service.h" |
39 | #include "gnunet_mhd_compat.h" | ||
39 | 40 | ||
40 | /** | 41 | /** |
41 | * Invalid method page. | 42 | * Invalid method page. |
@@ -507,10 +508,10 @@ fill_s_reply (const char *info, | |||
507 | * specified offset | 508 | * specified offset |
508 | * @param off offset of data in the overall value | 509 | * @param off offset of data in the overall value |
509 | * @param size number of bytes in data available | 510 | * @param size number of bytes in data available |
510 | * @return MHD_YES to continue iterating, | 511 | * @return #MHD_YES to continue iterating, |
511 | * MHD_NO to abort the iteration | 512 | * #MHD_NO to abort the iteration |
512 | */ | 513 | */ |
513 | static int | 514 | static MHD_RESULT |
514 | post_iterator (void *cls, | 515 | post_iterator (void *cls, |
515 | enum MHD_ValueKind kind, | 516 | enum MHD_ValueKind kind, |
516 | const char *key, | 517 | const char *key, |
@@ -754,7 +755,7 @@ lookup_it_finished (void *cls) | |||
754 | * #MHD_NO if the socket must be closed due to a serious | 755 | * #MHD_NO if the socket must be closed due to a serious |
755 | * error while handling the request | 756 | * error while handling the request |
756 | */ | 757 | */ |
757 | static int | 758 | static MHD_RESULT |
758 | create_response (void *cls, | 759 | create_response (void *cls, |
759 | struct MHD_Connection *connection, | 760 | struct MHD_Connection *connection, |
760 | const char *url, | 761 | const char *url, |
@@ -767,7 +768,7 @@ create_response (void *cls, | |||
767 | struct MHD_Response *response; | 768 | struct MHD_Response *response; |
768 | struct Request *request; | 769 | struct Request *request; |
769 | struct GNUNET_CRYPTO_EcdsaPublicKey pub; | 770 | struct GNUNET_CRYPTO_EcdsaPublicKey pub; |
770 | int ret; | 771 | MHD_RESULT ret; |
771 | 772 | ||
772 | (void) cls; | 773 | (void) cls; |
773 | (void) version; | 774 | (void) version; |
diff --git a/src/pq/pq_result_helper.c b/src/pq/pq_result_helper.c index 1fb1e71c0..dc64597f8 100644 --- a/src/pq/pq_result_helper.c +++ b/src/pq/pq_result_helper.c | |||
@@ -345,7 +345,7 @@ extract_rsa_signature (void *cls, | |||
345 | { | 345 | { |
346 | struct GNUNET_CRYPTO_RsaSignature **sig = dst; | 346 | struct GNUNET_CRYPTO_RsaSignature **sig = dst; |
347 | size_t len; | 347 | size_t len; |
348 | const char *res; | 348 | const void *res; |
349 | int fnum; | 349 | int fnum; |
350 | 350 | ||
351 | (void) cls; | 351 | (void) cls; |
diff --git a/src/rest/gnunet-rest-server.c b/src/rest/gnunet-rest-server.c index 02a2c6daf..30eade623 100644 --- a/src/rest/gnunet-rest-server.c +++ b/src/rest/gnunet-rest-server.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <microhttpd.h> | 27 | #include <microhttpd.h> |
28 | #include "gnunet_util_lib.h" | 28 | #include "gnunet_util_lib.h" |
29 | #include "gnunet_rest_plugin.h" | 29 | #include "gnunet_rest_plugin.h" |
30 | 30 | #include "gnunet_mhd_compat.h" | |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * Default Socks5 listen port. | 33 | * Default Socks5 listen port. |
@@ -302,7 +302,7 @@ url_iterator (void *cls, | |||
302 | } | 302 | } |
303 | 303 | ||
304 | 304 | ||
305 | static int | 305 | static MHD_RESULT |
306 | post_data_iter (void *cls, | 306 | post_data_iter (void *cls, |
307 | enum MHD_ValueKind kind, | 307 | enum MHD_ValueKind kind, |
308 | const char *key, | 308 | const char *key, |
@@ -359,11 +359,11 @@ post_data_iter (void *cls, | |||
359 | * @a upload_data provided; the method must update this | 359 | * @a upload_data provided; the method must update this |
360 | * value to the number of bytes NOT processed; | 360 | * value to the number of bytes NOT processed; |
361 | * @param con_cls pointer to location where we store the 'struct Request' | 361 | * @param con_cls pointer to location where we store the 'struct Request' |
362 | * @return MHD_YES if the connection was handled successfully, | 362 | * @return #MHD_YES if the connection was handled successfully, |
363 | * MHD_NO if the socket must be closed due to a serious | 363 | * #MHD_NO if the socket must be closed due to a serious |
364 | * error while handling the request | 364 | * error while handling the request |
365 | */ | 365 | */ |
366 | static int | 366 | static MHD_RESULT |
367 | create_response (void *cls, | 367 | create_response (void *cls, |
368 | struct MHD_Connection *con, | 368 | struct MHD_Connection *con, |
369 | const char *url, | 369 | const char *url, |
@@ -430,7 +430,7 @@ create_response (void *cls, | |||
430 | rest_conndata_handle); | 430 | rest_conndata_handle); |
431 | con_handle->pp = MHD_create_post_processor (con, | 431 | con_handle->pp = MHD_create_post_processor (con, |
432 | 65536, | 432 | 65536, |
433 | post_data_iter, | 433 | &post_data_iter, |
434 | rest_conndata_handle); | 434 | rest_conndata_handle); |
435 | if (*upload_data_size) | 435 | if (*upload_data_size) |
436 | { | 436 | { |
@@ -509,9 +509,13 @@ create_response (void *cls, | |||
509 | allow_headers); | 509 | allow_headers); |
510 | } | 510 | } |
511 | run_mhd_now (); | 511 | run_mhd_now (); |
512 | int ret = MHD_queue_response (con, con_handle->status, con_handle->response); | 512 | { |
513 | cleanup_handle (con_handle); | 513 | MHD_RESULT ret = MHD_queue_response (con, |
514 | return ret; | 514 | con_handle->status, |
515 | con_handle->response); | ||
516 | cleanup_handle (con_handle); | ||
517 | return ret; | ||
518 | } | ||
515 | } | 519 | } |
516 | 520 | ||
517 | 521 | ||
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index 20bdb6273..eef83b29d 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include "plugin_transport_http_common.h" | 33 | #include "plugin_transport_http_common.h" |
34 | #include <microhttpd.h> | 34 | #include <microhttpd.h> |
35 | #include <regex.h> | 35 | #include <regex.h> |
36 | 36 | #include "gnunet_mhd_compat.h" | |
37 | 37 | ||
38 | #if BUILD_HTTPS | 38 | #if BUILD_HTTPS |
39 | #define PLUGIN_NAME "https_server" | 39 | #define PLUGIN_NAME "https_server" |
@@ -1741,9 +1741,9 @@ add_cors_headers (struct MHD_Response *response) | |||
1741 | * @param upload_data upload data | 1741 | * @param upload_data upload data |
1742 | * @param upload_data_size size of @a upload_data | 1742 | * @param upload_data_size size of @a upload_data |
1743 | * @param httpSessionCache the session cache to remember the connection | 1743 | * @param httpSessionCache the session cache to remember the connection |
1744 | * @return MHD_YES if connection is accepted, MHD_NO on reject | 1744 | * @return #MHD_YES if connection is accepted, #MHD_NO on reject |
1745 | */ | 1745 | */ |
1746 | static int | 1746 | static MHD_RESULT |
1747 | server_access_cb (void *cls, | 1747 | server_access_cb (void *cls, |
1748 | struct MHD_Connection *mhd_connection, | 1748 | struct MHD_Connection *mhd_connection, |
1749 | const char *url, | 1749 | const char *url, |
@@ -1757,7 +1757,7 @@ server_access_cb (void *cls, | |||
1757 | struct ServerRequest *sc = *httpSessionCache; | 1757 | struct ServerRequest *sc = *httpSessionCache; |
1758 | struct GNUNET_ATS_Session *s; | 1758 | struct GNUNET_ATS_Session *s; |
1759 | struct MHD_Response *response; | 1759 | struct MHD_Response *response; |
1760 | int res = MHD_YES; | 1760 | MHD_RESULT res = MHD_YES; |
1761 | 1761 | ||
1762 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1762 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1763 | _ ( | 1763 | _ ( |
@@ -2025,9 +2025,9 @@ server_connection_cb (void *cls, | |||
2025 | * @param cls plugin as closure | 2025 | * @param cls plugin as closure |
2026 | * @param addr address of incoming connection | 2026 | * @param addr address of incoming connection |
2027 | * @param addr_len number of bytes in @a addr | 2027 | * @param addr_len number of bytes in @a addr |
2028 | * @return MHD_YES if connection is accepted, MHD_NO if connection is rejected | 2028 | * @return #MHD_YES if connection is accepted, #MHD_NO if connection is rejected |
2029 | */ | 2029 | */ |
2030 | static int | 2030 | static MHD_RESULT |
2031 | server_accept_cb (void *cls, | 2031 | server_accept_cb (void *cls, |
2032 | const struct sockaddr *addr, | 2032 | const struct sockaddr *addr, |
2033 | socklen_t addr_len) | 2033 | socklen_t addr_len) |