journal-remote: assume received data is not compressed when Content-Encoding header is not set

Also, refuse spurious header `Content-Encoding: none`.
This commit is contained in:
Yu Watanabe
2025-02-16 20:08:39 +09:00
parent fc1cf91aa8
commit c272c06b9e
+4 -2
View 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);