jaraco / irc

Full-featured Python IRC library for Python.
MIT License
392 stars 87 forks source link

Fix crash on non-UTF-8 encoded messages #104

Closed aldum closed 8 years ago

jrabbit commented 8 years ago

This should catch a specific exception right now it'll eat every exception

jaraco commented 8 years ago

Thanks but no thanks. I'm not sure I fully understand the implications of suppressing the exception and stopping iteration. For example, I imagine you could DoS the server by sending two undecodeable lines in each packet.

See the readme on the recommendations for how to handle encoding problems. The library provides clear interfaces on how to handle robustly any encoding situations.

As many times as users have encountered this situation, I would be inclined to change the default behavior from raising exceptions to replacing undecodeable characters, a la

irc.client.ServerConnection.buffer_class.errors = 'replace'

But one thing I don't want to do is alter the codebase in a way that silently suppresses errors without giving clients any control over it.

aldum commented 8 years ago

You're right, it's not a very well-engineered solution. Thanks for your time.