]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journal-remote: increase memory limit per connection to avoid errors with HTTPS 1729/head
authorDongsu Park <dongsu@endocode.com>
Wed, 21 Oct 2015 12:51:10 +0000 (14:51 +0200)
committerDongsu Park <dongsu@endocode.com>
Fri, 30 Oct 2015 14:12:48 +0000 (15:12 +0100)
Explicitly set MHD_OPTION_CONNECTION_MEMORY_LIMIT to a larger value,
when setting up microhttpd, to give more memory per HTTP(S) connection.

This way systemd-journal-remote can now prevent microhttpd from failing
in creating response headers with messages like "Not enough memory for
write", especially when lots of HTTPS requests arrive. That's precisely
because MHD_OPTION_CONNECTION_MEMORY_LIMIT in libmicrohttpd defaults to
32768, which is in practice insufficient in this case.
See also https://gnunet.org/bugs/view.php?id=4007 for more details.

Fixes: https://github.com/coreos/bugs/issues/927
src/journal-remote/journal-remote.c

index 44550532b65bfb2c21abc8f611cbd7c38c9a65c5..20be5420963dc0192217895f12af9ab42d6b02b9 100644 (file)
@@ -648,11 +648,12 @@ static int setup_microhttpd_server(RemoteServer *s,
                 { MHD_OPTION_NOTIFY_COMPLETED, (intptr_t) request_meta_free},
                 { MHD_OPTION_EXTERNAL_LOGGER, (intptr_t) microhttpd_logger},
                 { MHD_OPTION_LISTEN_SOCKET, fd},
+                { MHD_OPTION_CONNECTION_MEMORY_LIMIT, DATA_SIZE_MAX},
                 { MHD_OPTION_END},
                 { MHD_OPTION_END},
                 { MHD_OPTION_END},
                 { MHD_OPTION_END}};
-        int opts_pos = 3;
+        int opts_pos = 4;
         int flags =
                 MHD_USE_DEBUG |
                 MHD_USE_DUAL_STACK |