jquast / telnetlib3

Python Telnet server and client Protocol library using asyncio

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem with COM-PORT-CONTROL subnegotiation

albireox opened this issue · comments

I have a server that sends a COM-PORT-CONTROL subnegotiation with every message. In particular I always receive bytes

[255 250 44 106 96 255 240]

before the actual message. My understanding is that this correspond to the server communicating the linestate. I've tried several things to disable the sending of that subnegotiation but either I'm not doing it correctly or the server ignores those commands.

The problem is that telnetlib3 detects the subnegotiation but because it's not one of the ones that it knows how to handle it raises

ValueError: SB unhandled: cmd=COM_PORT_OPTION, buf=deque([b',', b'j', b'`'])

This doesn't actually crash the code (I still get the message) but I'm unable to catch the exception or disable it, which means it's triggered every time I receive a message.

Would it be possible to either:

a) Handle the COM-PORT-CONTROL subnegotiation (even if it's with an empty fn_call).
b) Provide a method to ignore the exception, or maybe make it a warning that can be ignored.

I can provide a PR for either option if I'm told what's preferred.

a) support it if you can, or otherwise forward the bytestream beyond the sb data so it can continue fine

sorry that i think it took a long time to just release this to pypi today, 2.0.0