Skip to content

Commit

Permalink
testLineTooLong: Also check with an egregiously long line
Browse files Browse the repository at this point in the history
  • Loading branch information
progval committed Aug 11, 2024
1 parent e3485b9 commit aee70e8
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 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,29 @@ 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)
self.assertEqual(self.getMessages(2), [], "overflowing message was relayed")
replies = self.getMessages(1)
self.assertIn(ERR_INPUTTOOLONG, set(reply.command for reply in replies))
if len(replies) > 0:
self.assertIn(ERR_INPUTTOOLONG, set(reply.command for reply in replies))


class LengthLimitTestCase(cases.BaseServerTestCase):
Expand Down

0 comments on commit aee70e8

Please sign in to comment.