direct-connect / go-dcpp

Hybrid Direct Connect hub written in Go.
BSD 3-Clause "New" or "Revised" License
36 stars 9 forks source link

Unable to login with swedish letters in nick #92

Open RoLex opened 5 years ago

RoLex commented 5 years ago

i was trying to connect to hub via nmdc using nick Lördag containing swedish letters using encoding CP1251. hub disconnects me with message:

handshake failed: read tcp 51.77.46.171:1411->A.B.C.D:59640: i/o timeout
dennwc commented 5 years ago

I'm getting a different error:

invalid name: encoding: rune not supported by encoding. ("Lördag")

This one is from the name validation - it tries to convert the name to a fallback encoding (CP1251 for that hub) and fails. This check is to make sure that NMDC clients will still see the whole user list.

Your error is different though.

RoLex commented 5 years ago

but what is solution for this? some clients maybe have this nick and want to use your hub, they can not? letter ö in CP1252 is same byte as ц in CP1251. why hub can not use CP1251 (as defult) instead? like every other nmdc hubs without encoding support do > Lцrdag.

dennwc commented 5 years ago

Because it won't be possible to enter with Lцrdag name. Hub will have to track that name collision as well.

I agree that this is a problem, but the only "good" and correct solution would be to not show users with UTF-8 names to users with CP1251. Or switch clients to UTF-8.

RoLex commented 5 years ago

ok. so maybe hub should atleast send message to client saying that he should add this hub to favorites and select UTF-8 encoding in favorute hub settings? so he can use hub properly.

dennwc commented 5 years ago

Makes sense. Although I want to try a different approach first.

As described in nmdc/1 draft, we can make a new protocol version called "nmdc/1" and make it work with only UTF-8. This will only work with ALPN, of course.

Currently, only Ncdc does full ALPN negotiation, but this is not a problem because switching NMDC<->ADC is harder than switching to a new protocol version.

So I plan to first make a few more changes to clients so they support ALPN with a single protocol properly, then make redirects to nmdcs://. Next, then most of the users are connected via TLS, we can discuss the features included in "nmdc/1" and I will update the hub and the clients to support it and force UTF-8 on it.