embolalia/willie — pull request #689 by Khabi (2014-12-18 00:54:19+00:00)
Title: [irc] Auth Issue bug when CAP is called before NICK and USER

On some servers it seems that issuing CAP before NICK and USER can cause the connection to fail.

Example from a failed attempt:

Trying 2610:150:4b0f::...
Connected to chat.freenode.net.
Escape character is '^]'.
:morgan.freenode.net NOTICE * :*** Looking up your hostname...
:morgan.freenode.net NOTICE * :*** Checking Ident
:morgan.freenode.net NOTICE * :*** Couldn't look up your hostname
CAP LS
NICK atestuser
USER willie +iw willie :willie
:morgan.freenode.net NOTICE * :*** No Ident response
:morgan.freenode.net CAP * LS :account-notify extended-join identify-msg multi-prefix sasl
ERROR :Closing Link: 2607:f4e8:120:10:44f5:dc8b:7e80:1b47 (Connection timed out)
Connection closed by foreign host.

Example after moving CAP LS to after Authentication:
Trying 2610:150:4b0f::...
Connected to chat.freenode.net.
Escape character is '^]'.
:morgan.freenode.net NOTICE * :*** Looking up your hostname...
:morgan.freenode.net NOTICE * :*** Checking Ident
:morgan.freenode.net NOTICE * :*** Couldn't look up your hostname
NICK atestuser
USER willie +iw willie :willie
CAP LS
:morgan.freenode.net NOTICE * :*** No Ident response
:morgan.freenode.net 001 atestuser :Welcome to the freenode Internet Relay Chat Network atestuser

:morgan.freenode.net 376 atestuser :End of /MOTD command.
:atestuser MODE atestuser :+i
:morgan.freenode.net CAP atestuser LS :account-notify extended-join identify-msg multi-prefix sasl