From a56c430db057326d3f33f3eaa5bd5c9ad0bb91f4 Mon Sep 17 00:00:00 2001 From: shuiyisong <113876041+shuiyisong@users.noreply.github.com> Date: Mon, 6 Jan 2025 17:10:56 +0800 Subject: [PATCH] fix: pass unknown encoding in decompression layer (#5300) fix: allow pass unknown in decompression layer --- src/servers/src/http.rs | 8 ++++---- tests-integration/tests/http.rs | 8 ++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/servers/src/http.rs b/src/servers/src/http.rs index 816bccc61e..eba588fdbd 100644 --- a/src/servers/src/http.rs +++ b/src/servers/src/http.rs @@ -747,7 +747,7 @@ impl HttpServer { .layer( ServiceBuilder::new() .layer(HandleErrorLayer::new(handle_error)) - .layer(RequestDecompressionLayer::new()), + .layer(RequestDecompressionLayer::new().pass_through_unaccepted(true)), ) .with_state(log_state) } @@ -767,7 +767,7 @@ impl HttpServer { .layer( ServiceBuilder::new() .layer(HandleErrorLayer::new(handle_error)) - .layer(RequestDecompressionLayer::new()), + .layer(RequestDecompressionLayer::new().pass_through_unaccepted(true)), ) .with_state(log_state) } @@ -860,7 +860,7 @@ impl HttpServer { .layer( ServiceBuilder::new() .layer(HandleErrorLayer::new(handle_error)) - .layer(RequestDecompressionLayer::new()), + .layer(RequestDecompressionLayer::new().pass_through_unaccepted(true)), ) .route("/ping", routing::get(influxdb_ping)) .route("/health", routing::get(influxdb_health)) @@ -881,7 +881,7 @@ impl HttpServer { .layer( ServiceBuilder::new() .layer(HandleErrorLayer::new(handle_error)) - .layer(RequestDecompressionLayer::new()), + .layer(RequestDecompressionLayer::new().pass_through_unaccepted(true)), ) .with_state(otlp_handler) } diff --git a/tests-integration/tests/http.rs b/tests-integration/tests/http.rs index 4245527cf7..0027700e80 100644 --- a/tests-integration/tests/http.rs +++ b/tests-integration/tests/http.rs @@ -1898,6 +1898,14 @@ pub async fn test_loki_pb_logs(store_type: StorageType) { HeaderName::from_static("content-type"), HeaderValue::from_static("application/x-protobuf"), ), + ( + HeaderName::from_static("content-encoding"), + HeaderValue::from_static("snappy"), + ), + ( + HeaderName::from_static("accept-encoding"), + HeaderValue::from_static("identity"), + ), ( HeaderName::from_static(GREPTIME_LOG_TABLE_NAME_HEADER_NAME), HeaderValue::from_static("loki_table_name"),