Login with yggdrasil server 'hitmc.cc' will get

```
Login failed : Invalid server response.
```

Print the raw response which is `result` in [/MinecraftClient/Protocol/ProtocolHandler.cs#L554](f6797cb4b5/MinecraftClient/Protocol/ProtocolHandler.cs (L554))
(Every test shows like this)

```
HTTP/1.1 200 OK
...

1e1
{"accessToken":"...","clientToken":"...","availableProfiles":[{"id":"..","name":".."},{"id":"..","na
f
me":"ok_bot"}]}
0
```

After splited by line:
- 1e1
- {"accessToken": ... ,"na
- f
- me":"ok_bot"}]}
- 0

The response when Login with 'littleskin.cn' which works fine is:

```
HTTP/1.1 200 OK
...

1e1
{"accessToken":"...","clientToken":"...","availableProfiles":[{"id":"..","name":".."},{"id":"..","name":"ok_bot"}]}
0

```

After splited by line:
- 1e1
- {"accessToken": ... ,"name":"ok_bot"}]}
- 0
-
-

So adding [1] and [3] will make both 'hitmc.cc' and 'littleskin.cn' work fine.
This commit is contained in:
oldkingOK 2024-01-10 11:00:04 +08:00
parent f6797cb4b5
commit 734de2a9ac

View file

@ -1100,7 +1100,8 @@ namespace MinecraftClient.Protocol
statusCode = int.Parse(raw_result.Split(' ')[1], NumberStyles.Any, CultureInfo.CurrentCulture);
if (statusCode != 204)
{
postResult = raw_result[(raw_result.IndexOf("\r\n\r\n") + 4)..].Split("\r\n")[1];
var splited = raw_result[(raw_result.IndexOf("\r\n\r\n") + 4)..].Split("\r\n");
postResult = splited[1] + splited[3];
}
else
{