Skip to content

Conversation

@pull
Copy link

@pull pull bot commented Feb 7, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

jquast and others added 5 commits February 7, 2026 11:51
* Add MTTS fallback for CHARSET negotiation

When a client sends CHARSET REJECTED but has advertised UTF-8 support
via MTTS (MUD Terminal Type Standard), resolve encoding to UTF-8
immediately instead of waiting for connect_maxwait timeout.

MTTS can be sent via NEW_ENVIRON (MTTS=2825) or TTYPE round 3
(MTTS 2825). Bit 3 (value 8) indicates UTF-8 capability.

* Add tests for MTTS charset fallback

Test that when CHARSET REJECTED is received:
- UTF-8 is resolved if MTTS bit 3 is set
- No resolution occurs if MTTS lacks UTF-8 bit
- Both NEW_ENVIRON and TTYPE sources work

* Add deferred MTTS fallback for CHARSET rejection timing

CHARSET REJECTED can arrive before NEW_ENVIRON or TTYPE round 3
data is available. Set _charset_rejected flag in stream_writer's
REJECTED handler, then retry _check_mtts_for_utf8() in two
deferred sites: server.on_environ() when MTTS key arrives, and
server.on_ttype() when ttype3 contains MTTS data.

Also improves _check_mtts_for_utf8 docstring with spec URL and
adds debug logging for malformed MTTS values.

* Fix MTTS charset fallback tests and add edge cases

Fix protocol_factory usage (class not lambda), waiter pattern
(set_result(self) for protocol instance), client method names
(send_env/send_ttype), and negative test pattern (pytest.raises
TimeoutError instead of asyncio.sleep). Remove debug prints.

Add unit tests for _check_mtts_for_utf8 edge cases: environ
precedence over ttype3, MTTS=0, and malformed MTTS values.

* Resolve encoding wait when MTTS confirms UTF-8

The deferred MTTS checks were calling on_charset() but not unblocking
the encoding or negotiation waiters. check_negotiation() requires
_check_encoding() to return True, which gates on BINARY mode — but
MUD clients like tintin++ reject BINARY while advertising UTF-8 via
MTTS bit 3.

Set force_binary=True when MTTS confirms UTF-8 (the MUD world's
replacement for RFC 856 BINARY negotiation) and resolve
waiter_encoding directly. This lets check_negotiation() complete
immediately instead of waiting for connect_maxwait timeout.
* MUD protocol support, --connect-timeout, and code modernization

- Add MUD protocol module (telnetlib3/mud.py) with MCCP, MSSP, GMCP, MSDP
- Add MUD server example (bin/server_mud.py) with readline and wcwidth support
- Add --connect-timeout option, closes #30
- Refactor server shell, guard shells, and fingerprinting
- Improve typing, formatting (skip-magic-trailing-comma), and test coverage
- Give latin1 encoding fallback for unidentified clients
- Update docs with MUD protocol guidance and RFC references
* new: ``telnetlib3-fingerprint-server`` CLI with extended ``NEW_ENVIRON``
  for client fingerprinting (uses ``FingerprintingServer`` protocol factory).
@pull pull bot locked and limited conversation to collaborators Feb 7, 2026
@pull pull bot added the ⤵️ pull label Feb 7, 2026
@pull pull bot merged commit eb66772 into threatcode:master Feb 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants