Shivaram Lingamneni
3a457e3fa0
ircmsg: UTF8-aware truncation during parsing
...
A message that exceeds the length limit is a protocol violation, so handling
is implementation-defined and it's not really a correctness issue for us to
truncate it additionally.
Also move TruncateUTF8Safe into ircmsg (providing an alias in ircutils for
API compatibility).
2023-02-16 09:46:57 -05:00
Shivaram Lingamneni
4fc58dea62
rename Message.Prefix to Source
2022-01-17 00:02:27 -05:00
Shivaram Lingamneni
4dc9d9bb47
rename (*ircmsg.Message).Name back to Nick
2022-01-13 04:35:19 -05:00
Shivaram Lingamneni
58477f84d8
refactor ParseNUH, move it to ircmsg, expose it in ircevent
2022-01-13 04:34:26 -05:00
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
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
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
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
e01f4d466e
add ForceTrailing
2020-03-09 23:54:34 -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
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
a5eafb7ec8
ircmsg: add ParseTags function to allow parsing of tag-like strings arbitrarily
2017-08-24 08:39:31 +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
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
c0935e7388
Whoops, let's use ISC for this instead of public domain
2016-01-18 00:48:04 +10:00
Daniel Oaks
7b07ddb2d5
ircmsg: Document a quirk with line parsing
2016-01-17 15:42:29 +10:00
Daniel Oaks
81ff74b7f0
ircmsg: Add tag escaping and unescaping
2016-01-17 12:10:51 +10:00
Daniel Oaks
92eac020e2
ircmsg: Split tags into their own file
2016-01-17 11:31:49 +10:00
Daniel Oaks
45974646a3
Make ircmsg subpackage
2016-01-17 10:19:51 +10:00