ircv3 / ircv3-ideas

46 stars 3 forks source link

Fixing the unknowns in IRC #47

Open realJoshByrnes opened 5 years ago

realJoshByrnes commented 5 years ago

Maybe I've missed it, but there is a bunch of stuff that is not really specific in IRC, and seems to depend on the implementation of client/server.

What should happen if a NUL (0x00) is received within a message? Should spaces be trimmed from the beginning of a message (presumably, yes) What nickname should be used before a client/server is registered (ie. a client connects and issues an Unknown Command, in the reply raw, which name should be used)

I'm sure there are others... It would be great to weed these out.

DanielOaks commented 5 years ago

Just moved over to -ideas because it probably fits better here.

For the nickname case, I believe using * in place of the user's nick is customary? Honestly though making sure that sorta thing's pretty standard would be good though. Space at the start of messages, yeah definitely but not sure how servers in the real world respond. I'll see whether I can properly check these out though.

realJoshByrnes commented 5 years ago

As for the space, RFC 1459 does note this:

The prefix, command, and all parameters are separated by one (or more) ASCII space character(s) (0x20).

This comment in itself could be considered ambiguous - can multiple spaces seperate a prefix and a command? or is it only multiple if singular spaces are used between three or more items?

It seems wise to remove any leading ASCII space characters, but it should be noted that they can not be trimmed from the ending due to the trailing parameters. Also, with the exception of in the trailing parameters, any repeating spaces should be treated as a single.

I dare say that It's likely every implementation currently treats it this way, but it should be defined in the documentation to prevent ambiguity. I have noted in the past that some trailing spaces were trimmed, where they should be preserved in the trailing parameter.

SadieCat commented 5 years ago

What should happen if a NUL (0x00) is received within a message?

RFC 1459 2.3.1 specifies this:

    4) The NUL character is not special in message framing, and
    basically could end up inside a parameter, but as it would
    cause extra complexities in normal C string handling. Therefore
    NUL is not allowed within messages.

Should spaces be trimmed from the beginning of a message (presumably, yes)

Assuming you mean a wire message not a PRIVMSG/NOTICE I looked into this recently and it seems like every server implementation trims preceding whitespace.

What nickname should be used before a client/server is registered (ie. a client connects and issues an Unknown Command, in the reply raw, which name should be used)

At least InspIRCd does not send unknown command numerics before registration.

realJoshByrnes commented 5 years ago

RFC 1459 2.3.1 specifies this:

@SaberUK It's clear that it's not allowed, but what should happen to it?

Should it END the message (data before it processed) Should it DELIMIT the message (data before and after processed as two messages) Should the whole message be dropped? etc.

This is the kind of thing that should be clear in the spec, and reducing ambiguity ensures more consistent implementations.

Herringway commented 5 years ago

it's not an IRC message. it should be treated like all the other things that aren't IRC messages.