Open josef-dijon opened 11 months ago
It looks looks it's the upstream library since that response is retrieved here
https://github.com/itzg/rcon-cli/blob/7f7f4f17150018dc375b3a1053f1b9d99c6eb178/cli/entry.go#L75
Ahh yes, looking closer at https://developer.valvesoftware.com/wiki/Source_RCON_Protocol#Multiple-packet_Responses it does look like the RCON spec. limits responses to 4096 byte.
However, it does also look like it supports multi packet chunking of responses larger than 4096, which does seem to be supported by james4k's rcon lib: https://github.com/james4k/rcon/blob/34a67ca2b2d65052cacddc7a1415b568f8b932a1/rcon_test.go#L77C1-L78C1
My go knowledge is pretty much non-existent though, so I could be way off track here.
Good find; however, I'm not sure how to proceed given that unit test. It asserts it read the response sizes it expected, but in our case how would we know there are more to read? Just read until the response is an empty string?
That's a pretty typical pattern, like as if you were reading from a socket, although that's not a guarantee that that's how james4k/rcon is intended to be used I guess. I'll need to have a look further.
Running rcon-cli for my minecraft server I can see that the response buffer of rcon-cli is limited to 4096 as can be seen below:
Note that the
help
command response seems to be cut off with the last characters being[<ar
. The last character corresponding to the 4096th byte in the response. This wouldn't be a huge deal ashelp
is not the most critical command, but the more problematic issue is that the remaining bytes that are to be sent from the server pollute the buffer of any subsequent commands that are run.I have a few mods installed that add to the server help command output, which I guess is why you might not have come up against this issue before. Namely, WorldEdit does seem to pollute the command palette significantly.
Anyway, would be worth implementing a batched read until there are no more bytes left in the response to return.
Let me know if I can help out in any way. I'm about to go on holiday, I might submit a pull request with a fix when I return :)