Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions irctest/server_tests/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
The PRIVMSG and NOTICE commands.
"""

import pytest

from irctest import cases
from irctest.numerics import ERR_INPUTTOOLONG
from irctest.patma import ANYSTR
Expand Down Expand Up @@ -123,26 +125,31 @@ def testNoticeNonexistentChannel(self):


class TagsTestCase(cases.BaseServerTestCase):
@pytest.mark.parametrize("tag_length", [4096, 10000])
@cases.mark_capabilities("message-tags")
@cases.xfailIf(
lambda self: bool(
lambda self, tag_length: bool(
self.controller.software_name == "UnrealIRCd"
and self.controller.software_version == 5
),
"UnrealIRCd <6.0.7 dropped messages with excessively large tags: "
"https://bugs.unrealircd.org/view.php?id=5947",
)
def testLineTooLong(self):
def testLineTooLong(self, tag_length):
self.connectClient("bar", capabilities=["message-tags"], skip_if_cap_nak=True)
self.connectClient(
"recver", capabilities=["message-tags"], skip_if_cap_nak=True
)
self.joinChannel(1, "#xyz")
monsterMessage = "@+clientOnlyTagExample=" + "a" * 4096 + " PRIVMSG #xyz hi!"

monsterMessage = (
"@+clientOnlyTagExample=" + "a" * tag_length + " PRIVMSG #xyz hi!"
)
self.sendLine(1, monsterMessage)
replies = self.getMessages(1)
self.assertIn(ERR_INPUTTOOLONG, set(reply.command for reply in replies))
self.assertEqual(self.getMessages(2), [], "overflowing message was relayed")
if len(replies) > 0:
self.assertIn(ERR_INPUTTOOLONG, set(reply.command for reply in replies))


class LengthLimitTestCase(cases.BaseServerTestCase):
Expand Down
Loading