]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journal-remote: assume received data is not compressed when Content-Encoding header...
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 11 Feb 2025 07:42:59 +0000 (16:42 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 16 Feb 2025 11:08:39 +0000 (20:08 +0900)
Also, refuse spurious header `Content-Encoding: none`.

src/journal-remote/journal-remote-main.c

index 3579b507efdbd32fb70e3b78b2e93c61c0c5fe41..97b040af321db6eaa53b67152ab890ad67cf9d86 100644 (file)
@@ -322,11 +322,13 @@ static mhd_result request_handler(
                 header = MHD_lookup_connection_value(connection, MHD_HEADER_KIND, "Content-Encoding");
                 if (header) {
                         Compression c = compression_lowercase_from_string(header);
-                        if (c < 0 || !compression_supported(c))
+                        if (c <= 0 || !compression_supported(c))
                                 return mhd_respondf(connection, 0, MHD_HTTP_UNSUPPORTED_MEDIA_TYPE,
                                                     "Unsupported Content-Encoding type: %s", header);
                         source->compression = c;
-                }
+                } else
+                        source->compression = COMPRESSION_NONE;
+
                 return process_http_upload(connection,
                                            upload_data, upload_data_size,
                                            source);