3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 21:19:31 +01:00

IRCNetwork: don't attempt to send more than 510 bytes per message

Some IRCds like ngIRCd will SQUIT you if you try to do so, though most just ignore this kind of overflow.
This commit is contained in:
James Lu 2017-07-07 20:05:10 -07:00
parent 3a42c8e835
commit 51fb269d0d

View File

@ -1347,7 +1347,7 @@ class IRCNetwork(PyLinkNetworkCoreWithUtils):
# Safeguard against newlines in input!! Otherwise, each line gets # Safeguard against newlines in input!! Otherwise, each line gets
# treated as a separate command, which is particularly nasty. # treated as a separate command, which is particularly nasty.
data = data.replace('\n', ' ') data = data.replace('\n', ' ')
encoded_data = data.encode(self.encoding, 'replace') + b"\n" encoded_data = data.encode(self.encoding, 'replace')[:510] + b"\n"
log.debug("(%s) -> %s", self.name, data) log.debug("(%s) -> %s", self.name, data)