mirror of https://github.com/progval/irctest.git
allow ERR_INPUTTOOLONG if a PRIVMSG cannot be relayed
This commit is contained in:
parent
1e0de7aefb
commit
74f40ad23d
|
@ -154,25 +154,30 @@ class MessageTagsTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||||
self.assertEqual(len(max_privmsg), 4096 + (512 - 2))
|
self.assertEqual(len(max_privmsg), 4096 + (512 - 2))
|
||||||
self.sendLine("alice", max_privmsg)
|
self.sendLine("alice", max_privmsg)
|
||||||
echo = self.getMessage("alice")
|
echo = self.getMessage("alice")
|
||||||
relay = self.getMessage("bob")
|
# the server may still reject this message on the grounds that the final
|
||||||
self.assertMessageMatch(
|
# parameter is too long to be relayed without truncation, once alice's
|
||||||
echo,
|
# NUH is included. however, if the message was accepted, the tags MUST
|
||||||
command="PRIVMSG",
|
# be relayed intact, because they are unquestionably valid:
|
||||||
params=["#test", StrRe("b{400,496}")],
|
if echo.command != ERR_INPUTTOOLONG:
|
||||||
tags={"+baz": "a" * 4081, "msgid": StrRe(".+"), **ANYDICT},
|
relay = self.getMessage("bob")
|
||||||
)
|
self.assertMessageMatch(
|
||||||
self.assertMessageMatch(
|
echo,
|
||||||
relay,
|
command="PRIVMSG",
|
||||||
command="PRIVMSG",
|
params=["#test", StrRe("b{400,496}")],
|
||||||
params=["#test", StrRe("b{400,496}")],
|
tags={"+baz": "a" * 4081, "msgid": StrRe(".+"), **ANYDICT},
|
||||||
tags={"+baz": "a" * 4081, "msgid": StrRe(".+"), **ANYDICT},
|
)
|
||||||
)
|
self.assertMessageMatch(
|
||||||
self.assertEqual(echo.tags["msgid"], relay.tags["msgid"])
|
relay,
|
||||||
# message may have been truncated
|
command="PRIVMSG",
|
||||||
self.assertIn("b" * 400, echo.params[1])
|
params=["#test", StrRe("b{400,496}")],
|
||||||
self.assertEqual(echo.params[1].rstrip("b"), "")
|
tags={"+baz": "a" * 4081, "msgid": StrRe(".+"), **ANYDICT},
|
||||||
self.assertIn("b" * 400, relay.params[1])
|
)
|
||||||
self.assertEqual(relay.params[1].rstrip("b"), "")
|
self.assertEqual(echo.tags["msgid"], relay.tags["msgid"])
|
||||||
|
# message may have been truncated
|
||||||
|
self.assertIn("b" * 400, echo.params[1])
|
||||||
|
self.assertEqual(echo.params[1].rstrip("b"), "")
|
||||||
|
self.assertIn("b" * 400, relay.params[1])
|
||||||
|
self.assertEqual(relay.params[1].rstrip("b"), "")
|
||||||
|
|
||||||
excess_privmsg = "@foo=bar;+baz=%s PRIVMSG #test %s" % ("a" * 4082, "b" * 495)
|
excess_privmsg = "@foo=bar;+baz=%s PRIVMSG #test %s" % ("a" * 4082, "b" * 495)
|
||||||
# TAGMSG data is over the limit, but we're within the overall limit for a line
|
# TAGMSG data is over the limit, but we're within the overall limit for a line
|
||||||
|
|
Loading…
Reference in New Issue