sstephenson / hector

A private group chat server for people you trust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Connection isn't completing properly

tecnobrat opened this issue · comments

Both Xchat and ZNC don't believe the connection is complete after connecting. Neither of their after connect hooks (like auto join) fire properly.

Here is what it looks like when I connect to a hector server:

* 001 TecnoBrat :Welcome to IRC

Comparably, when I connect to freenode:

* Welcome to the freenode Internet Relay Chat Network TecnoBrat

Here is the difference in the raw packets:

>> 001 TecnoBrat :Welcome to IRC

And freenode:

>> :kornbluth.freenode.net 001 TecnoBrat :Welcome to the freenode Internet Relay Chat Network TecnoBrat

Raws mentioned that the prefix is optional .. however it doesn't look like clients actually respect that.

I've noticed this as well with a few other IRC commands. (see https://github.com/leedo/alice/blob/master/lib/Alice/Role/IRCEvents.pm#L257-258 for an example

Okay, I talked to a ZNC developer, who acknowledged that ZNC does assume the first parameter of each message is a prefix (:kornbluth.freenode.net), and in fact doesn't even look at it—simply eats up the first parameter, no matter what it is. In this case, it's gobbling up 001 and then trying to figure out what the TecnoBrat command is.

We looked at the RFCs, and there's some ambiguity between the "optional" prefix in section 2.3 and the "must" in section 2.4, which covers numeric replies such as 001.

If it was just ZNC with this behavior, I'd prefer submitting a patch to them and leaving Hector be, but it looks like XChat might make the same assumption, and who knows what other edge case clients are out there. I think Hector should start sending the server name as a message prefix.

All tests pass and ZNC 0.202 connects successfully as of b4fd7ee. I'll test with XChat and Snak (another client found to exhibit this issue) tomorrow, and maybe we can get a release out.

I reproduced this bug in Hector 1.0.5 using XChat and Snak. It's fixed on my topic branch.

Thanks for reporting this, @tecnobrat! Time for Hector 1.0.6!