From 653585ebdd3185ec32dbd61d0c6b9733e2e9797a Mon Sep 17 00:00:00 2001 From: Patrick Griffis Date: Wed, 22 Sep 2021 11:54:34 -0500 Subject: Re-enable HTTP compression The original commit (9865ed8989befe9653fb3cd919fb5518b09274d2) disabling it claimed it fixed OCI downloads. This no longer seems to be a problem. This has also exposed new bugs as some servers will send gzip compressed data when the client does not send Accept-Encoding. If we leave this enabled that issue goes away. --- common/flatpak-utils-http.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/flatpak-utils-http.c b/common/flatpak-utils-http.c index 2ba18d5c..0a230c37 100644 --- a/common/flatpak-utils-http.c +++ b/common/flatpak-utils-http.c @@ -540,7 +540,6 @@ flatpak_create_soup_session (const char *user_agent) SOUP_SESSION_TIMEOUT, 60, SOUP_SESSION_IDLE_TIMEOUT, 60, NULL); - soup_session_remove_feature_by_type (soup_session, SOUP_TYPE_CONTENT_DECODER); http_proxy = g_getenv ("http_proxy"); if (http_proxy) { @@ -955,10 +954,13 @@ flatpak_cache_http_uri_once (SoupSession *soup_session, if (flags & FLATPAK_HTTP_FLAGS_STORE_COMPRESSED) { + soup_session_remove_feature_by_type (soup_session, SOUP_TYPE_CONTENT_DECODER); soup_message_headers_replace (m->request_headers, "Accept-Encoding", "gzip"); data.store_compressed = TRUE; } + else if (!soup_session_has_feature (soup_session, SOUP_TYPE_CONTENT_DECODER)) + soup_session_add_feature_by_type (soup_session, SOUP_TYPE_CONTENT_DECODER); soup_request_send_async (SOUP_REQUEST (request), cancellable, -- cgit v1.2.1