lrstanley / girc

:bomb: girc is a flexible IRC library for Go :ok_hand:
https://pkg.go.dev/github.com/lrstanley/girc
MIT License
138 stars 13 forks source link

sasl on freenode doesn't work #6

Closed 42wim closed 6 years ago

42wim commented 6 years ago

I'm trying to connect to freenode with SASL, but it isn't working. The CAP LS doesn't get any response. It looks like freenode expects CAP LS before NICK/USER When I moved c.listCAP() in conn.go before the NICK/USER writes it works.

lrstanley commented 6 years ago

Taking a look now.

lrstanley commented 6 years ago

It looks as though there is no specific documentation in the IRCv3 spec on the priority for such requests (specifically for SASL), and the previous servers I used during IRCv3 testing had no issues with the request occurring after name registration.

I did see mention, specifically on http://ircv3.net/specs/extensions/sasl-3.1.html of an example which shows it being in the new order which I have changed it to, but nothing else specific. This is documented:

If the client completes registration (with CAP END, NICK, USER and any other necessary messages) while the SASL authentication is still in progress, the server SHOULD abort it and send a 906 numeric, then register the client without authentication.

However, this is only documenting that if the client closes the CAP registration early, and not necessarily the order of registration.

Since I see no issues with it going before name registration, I've switched it. Upon my testing, this seems to work on the previous IRCv3 host I was testing on, on freenode, and on non-IRCv3 supporting servers.