Shivaram Lingamneni
23a3bb8f66
rename to Message and Reader; remove Event
2021-03-10 18:08:37 -05:00
Shivaram Lingamneni
3f429682a8
restore message truncation in ParseLineStrict
...
Truncation was removed in 3fafe19ebb
. This was reconsidered and found
to be potentially dangerous, since it exposes server implementations to parsed
parameters longer than 512 bytes.
This commit does the following:
1. Restores truncation
2. Reverts the test changes
3. Retains ErrorBodyTooLong as a non-fatal error reported during truncation
2021-03-03 21:59:04 -05:00
Shivaram Lingamneni
3fafe19ebb
don't actually truncate the line when parsing
...
We have the data, might as well interpret it (and return the new non-fatal
error). It's the line reader's job to prevent us from consuming excess data.
2021-03-03 11:26:38 -05:00
Shivaram Lingamneni
617723503e
expose message truncation in the API
...
ErrorInputTooLong has been split into ErrorTagsTooLong (fatal)
and ErrorBodyTooLong (non-fatal, returns a truncated message).
2021-03-03 01:02:36 -05:00
Shivaram Lingamneni
61e3317dd1
add tests for UTF8-safe truncation
2021-03-02 20:51:44 -05:00
Shivaram Lingamneni
0c71162327
Make truncation UTF8-safe
...
We should never truncate in the middle of a UTF8 codepoint.
Enabling this unconditionally, since truncation is most likely
implementation-defined.
2021-03-02 20:51:44 -05:00
Shivaram Lingamneni
18f4dccb97
validate outgoing message tag content
2021-02-22 19:30:40 -05:00
Shivaram Lingamneni
3d28146f7d
be more strict about parsing lines with \r and \n
2021-02-22 19:30:31 -05:00
Shivaram Lingamneni
27a39aed1f
add some more assembly tests
2021-02-21 17:36:50 -05:00
Shivaram Lingamneni
e489a564c1
fix #36
...
Outgoing messages were not being properly validated for \r and \n
2021-02-21 17:03:44 -05:00
Shivaram Lingamneni
dfb963d463
rename IrcMessage to IRCMessage
2021-02-15 11:23:09 -05:00
Shivaram Lingamneni
04fc29b345
fix gofmt, run tests in travis
2020-11-16 17:45:34 -05:00
Shivaram Lingamneni
245831ff95
use strings.Builder for tag unescaping
2020-11-16 15:28:46 -05:00
Shivaram Lingamneni
c52d9b251f
validate tag names and values
2020-11-15 22:02:19 -05:00
Shivaram Lingamneni
26268905a5
fix comment
2020-03-11 01:04:53 -04:00
Shivaram Lingamneni
bade7c5106
clean up ForceTrailing interface
2020-03-10 04:18:55 -04:00
Shivaram Lingamneni
d02357a7d7
fix gofmt
2020-03-10 00:12:17 -04:00
Shivaram Lingamneni
25527c5512
add a test
2020-03-09 23:58:25 -04:00
Shivaram Lingamneni
e01f4d466e
add ForceTrailing
2020-03-09 23:54:34 -04:00
Shivaram Lingamneni
4ff9a1babb
test \r and \n in message bodies
2019-07-12 18:42:17 -04:00
Shivaram Lingamneni
d3f23f4ea7
trim to newline bytes more aggressively
2019-07-12 18:42:07 -04:00
Shivaram Lingamneni
75aee58953
allow multiple spaces between parameters
2019-07-12 13:16:09 -04:00
Daniel Oaks
24277bb980
ircmsg: re-add LineBytes
2019-04-05 16:39:27 +10:00
Shivaram Lingamneni
507f0c6b24
add additional test from review feedback
2019-03-06 19:24:38 -05:00
Shivaram Lingamneni
bb05f7991a
simplify MakeMessage
2019-03-06 19:00:56 -05:00
Shivaram Lingamneni
74150f6eaf
restore simplified Line interface
2019-03-03 15:24:59 -05:00
Shivaram Lingamneni
5853469061
restore simplified ParseLine interface
2019-03-03 15:24:59 -05:00
Shivaram Lingamneni
e0907adffb
ircmsg: support ratified message-tags spec
2019-03-03 00:41:32 -05:00
Shivaram Lingamneni
3a1b8b0f0c
use bytes.Buffer to build ircmsg.IRCMessage for sending
2018-04-26 23:34:04 -04:00
Daniel Oaks
1cb16094f0
ircmsg: Make ircmsg respect emoji in tags
2018-02-11 01:12:16 +10:00
Daniel Oaks
a5eafb7ec8
ircmsg: add ParseTags function to allow parsing of tag-like strings arbitrarily
2017-08-24 08:39:31 +10:00
Daniel Oaks
ea7e22b650
ircmsg: Fix tests
2017-08-15 08:55:15 +10:00
Daniel Oaks
26e46394dd
ircmsg: Add SourceLine param to represent the line that constructed the current message
2017-08-15 08:39:39 +10:00
Daniel Oaks
8db175734c
Remove the alpha notifications on a bunch of libs,t hey're stable now
2017-08-09 08:32:11 +10:00
Daniel Oaks
dcb717d58d
ircmsg: Ignore trailing slashes while unescaping
2017-06-09 00:26:24 -06:00
Daniel Oaks
44f3a36650
ircmsg: Support different lengths for tags and rest
2017-01-13 23:56:52 +10:00
Daniel Oaks
cfa836b1b0
ircmsg: Fix case where colon is encoded into a param
2016-11-29 19:00:43 +10:00
Daniel Oaks
18e618c0fe
ircmsg: Use common behaviour of last empty param needing trailing
2016-11-28 12:30:29 +10:00
Daniel Oaks
fc23d62e1d
ircmsg: Enable max lengths for stuff
2016-11-26 19:25:37 +10:00
Daniel Oaks
ed9c4df235
ircmsg: And a bit more better
2016-11-26 19:24:55 +10:00
Daniel Oaks
63f6c66ea1
ircmsg: Improve robustness
2016-11-26 19:24:55 +10:00
Daniel Oaks
649590699f
ircmsg: Add check for : for trailing
2016-11-26 14:16:03 +10:00
Daniel Oaks
ff89a69d1b
ircmsg: Fail appropriately on empty message
2016-10-03 19:33:26 +10:00
Daniel Oaks
b885d56e16
ircmsg: Fix crash on some message types
2016-02-28 00:18:00 +10:00
Daniel Oaks
04978572cb
ircmsg: Make sure we fail at right places
2016-01-18 17:04:34 +10:00
Daniel Oaks
c0935e7388
Whoops, let's use ISC for this instead of public domain
2016-01-18 00:48:04 +10:00
Daniel Oaks
12d8fea3b4
ircmsg: Add another tags test
2016-01-18 00:21:38 +10:00
Daniel Oaks
30d558bb37
ircmsg: Add more tests
2016-01-18 00:01:57 +10:00
Daniel Oaks
3d123edd35
ircmsg: Escape things more nicely, but can't do that while unescaping
2016-01-17 23:56:39 +10:00
Daniel Oaks
d47adb204d
ircmsg: Fix tag unescaping
2016-01-17 18:27:12 +10:00