Break cluster lines on a bare carriage return

N1MM splits the telnet stream on CR, not LF, which says some nodes send CR with
no LF after it. Against those the assembler was handing the whole session back
as one unfinished line.

Also adds "user:" to the login prompts, which N1MM matches and we did not.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-27 15:53:23 +00:00
parent 2b8033ccdd
commit 2b5ab54e94
4 changed files with 52 additions and 11 deletions

View File

@@ -31,4 +31,31 @@ public class LineAssemblerTests
Assert.Empty(assembler.Add("login: "));
Assert.Equal("login: ", assembler.Pending);
}
/// N1MM splits on CR alone, so some nodes evidently leave the LF out.
[Fact]
public void ALineEndedWithACarriageReturnAloneIsStillALine()
{
LineAssembler assembler = new();
Assert.Equal(["one", "two"], assembler.Add("one\rtwo\r"));
}
[Fact]
public void CarriageReturnAndLineFeedTogetherAreOneEnding()
{
LineAssembler assembler = new();
Assert.Equal(["one"], assembler.Add("one\r\n"));
Assert.Equal("", assembler.Pending);
}
[Fact]
public void AnEndingSplitAcrossTwoBlocksIsStillOneEnding()
{
LineAssembler assembler = new();
Assert.Equal(["one"], assembler.Add("one\r"));
Assert.Empty(assembler.Add("\n"));
}
}