Add MCCP2 compressed stream support

This commit is contained in:
2026-09-17 16:18:16 +02:00
parent da967f4d56
commit 158ee2568c
8 changed files with 238 additions and 45 deletions
+16
View File
@@ -1,5 +1,7 @@
# encoding: UTF-8
require "zlib"
require_relative "test_helper"
require_relative "../lib/meow/telnet"
require_relative "../lib/meow/text_pipeline"
@@ -74,4 +76,18 @@ module MeowTextPipelineTest
MeowTest.assert_equal([[:remote_echo, true]], result.events)
MeowTest.assert(pipeline.remote_echo?)
end
MeowTest.test("Text pipeline processes MCCP2 output normally") do
pipeline = MeowClient::TextPipeline.new("UTF-8")
negotiation = bytes(Telnet::IAC, Telnet::WILL, Telnet::COMPRESS2)
marker = bytes(Telnet::IAC, Telnet::SB, Telnet::COMPRESS2, Telnet::IAC, Telnet::SE)
payload = "red\e[31m text\e[0m\r\n".b
result = pipeline.feed(negotiation + marker + Zlib::Deflate.deflate(payload))
MeowTest.assert_equal(["red text"], result.records)
MeowTest.assert_equal([bytes(Telnet::IAC, Telnet::DO, Telnet::COMPRESS2)], result.replies)
MeowTest.assert_equal([[:compression, true]], result.events)
ensure
pipeline.close if pipeline != nil
end
end