richardphibel / rpms / systemd

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