6f381c
From ea9b3a664f5e67d0ee6b0bf6ca362835ae11fedc Mon Sep 17 00:00:00 2001
6f381c
From: Yu Watanabe <watanabe.yu+github@gmail.com>
6f381c
Date: Mon, 20 Dec 2021 20:48:32 +0900
6f381c
Subject: [PATCH] journal-remote: use MHD_HTTP_CONTENT_TOO_LARGE as
6f381c
 MHD_HTTP_PAYLOAD_TOO_LARGE is deprecated since 0.9.74
6f381c
6f381c
(cherry picked from commit 30df858f43b14a55c6650b43bea12cbf2cc0bc67)
6f381c
6f381c
Related: #2122499
6f381c
---
6f381c
 src/journal-remote/journal-remote-main.c |  2 +-
6f381c
 src/journal-remote/microhttpd-util.h     | 10 +++++++---
6f381c
 2 files changed, 8 insertions(+), 4 deletions(-)
6f381c
6f381c
diff --git a/src/journal-remote/journal-remote-main.c b/src/journal-remote/journal-remote-main.c
6f381c
index 47fe9d7433..bcaa370099 100644
6f381c
--- a/src/journal-remote/journal-remote-main.c
6f381c
+++ b/src/journal-remote/journal-remote-main.c
6f381c
@@ -304,7 +304,7 @@ static int request_handler(
6f381c
                         /* When serialized, an entry of maximum size might be slightly larger,
6f381c
                          * so this does not correspond exactly to the limit in journald. Oh well.
6f381c
                          */
6f381c
-                        return mhd_respondf(connection, 0, MHD_HTTP_PAYLOAD_TOO_LARGE,
6f381c
+                        return mhd_respondf(connection, 0, MHD_HTTP_CONTENT_TOO_LARGE,
6f381c
                                             "Payload larger than maximum size of %u bytes", ENTRY_SIZE_MAX);
6f381c
         }
6f381c
 
6f381c
diff --git a/src/journal-remote/microhttpd-util.h b/src/journal-remote/microhttpd-util.h
6f381c
index 26909082a1..dd0ca1d9bd 100644
6f381c
--- a/src/journal-remote/microhttpd-util.h
6f381c
+++ b/src/journal-remote/microhttpd-util.h
6f381c
@@ -38,9 +38,13 @@
6f381c
 #  define MHD_HTTP_NOT_ACCEPTABLE MHD_HTTP_METHOD_NOT_ACCEPTABLE
6f381c
 #endif
6f381c
 
6f381c
-/* Renamed in µhttpd 0.9.53 */
6f381c
-#ifndef MHD_HTTP_PAYLOAD_TOO_LARGE
6f381c
-#  define MHD_HTTP_PAYLOAD_TOO_LARGE MHD_HTTP_REQUEST_ENTITY_TOO_LARGE
6f381c
+/* Renamed in µhttpd 0.9.74 (8c644fc1f4d498ea489add8d40a68f5d3e5899fa) */
6f381c
+#ifndef MHD_HTTP_CONTENT_TOO_LARGE
6f381c
+#  ifdef MHD_HTTP_PAYLOAD_TOO_LARGE
6f381c
+#    define MHD_HTTP_CONTENT_TOO_LARGE MHD_HTTP_PAYLOAD_TOO_LARGE /* 0.9.53 or newer */
6f381c
+#  else
6f381c
+#    define MHD_HTTP_CONTENT_TOO_LARGE MHD_HTTP_REQUEST_ENTITY_TOO_LARGE
6f381c
+#  endif
6f381c
 #endif
6f381c
 
6f381c
 #if MHD_VERSION < 0x00094203