Repository: kafka-rust/kafka-rust (language: rust)

Issue:
Make sure to intepret the compression type from the last 3 bits in attributes
This is an easy one; just not to forget about it. The compression type is indicated by the last _3_ bits of the `attributes` field in a fetched messageset; kafka-rust currently takes it from the last _2_.



Discussion / hints:

Fix patch:
diff --git a/src/protocol/fetch.rs b/src/protocol/fetch.rs
index a0969416c..4ad803e33 100644
--- a/src/protocol/fetch.rs
+++ b/src/protocol/fetch.rs
@@ -384,7 +384,7 @@ impl<'a> MessageSet<'a> {
                 Ok((offset, pmsg)) => {
                     // handle compression (denoted by the last 2 bits
                     // of the attr field)
-                    match pmsg.attr & 0x03 {
+                    match pmsg.attr & 0x07 {
                         c if c == Compression::NONE as i8 => {
                             // skip messages with a lower offset
                             // than the request one


Test patch: